Skip to content

Commit 2c8b104

Browse files
"Cannot be trusted" rewrite
1 parent 9a142d4 commit 2c8b104

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

doc/modules/ROOT/pages/algorithms/dag/longest-path.adoc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ include::partial$/operations-reference/alpha-note.adoc[]
1616

1717
== Introduction
1818

19-
Finding the longest path that leads to a node in a graph is possible to do in linear time for the special case of DAGs.
19+
Finding the longest path that leads to a node in a graph is possible to do in linear time for the special case of DAGs, that is graphs which do not contain cycles.
20+
21+
The GDS implementation for this problem is based on topological sort and operates in linear time.
22+
When the graph is not a DAG, any node that belongs to component containing at least one cycle will be excluded from the results.
23+
That is, the implementation will only give results for those components of the graph that form DAGs.
2024

21-
GDS implementation for this algorithm is based on topological sort and takes linear time.
22-
If the graph is not a DAG, the runtime is still linear, but the results cannot be trusted.
2325
You can use xref:algorithms/dag/topological-sort.adoc[topological sort] to make sure the graph is a DAG.
2426

2527
The algorithm supports weighted and unweighted graphs.

0 commit comments

Comments
 (0)