documentationfor yFiles for HTML 3.0.0.3

LongestPath

Finds the longest directed path in an acyclic graph.

Inheritance Hierarchy
LongestPath

Remarks

Other Path-Related Algorithms

@PRODUCT@ supports a number of other algorithms related to paths in a graph:

  • Paths – finds all paths between a set of source and a set of target nodes
  • Chains – finds all chains, that is, sequences of nodes that are each connected with just an edge without branches
  • Cycle – finds a cycle if one exists
  • LongestPath – finds the longest path in the graph

Shortest Path Algorithms

@PRODUCT@ also supports a number of other algorithms that compute shortest paths in a graph:

Examples

Highlighting a longest path of a graph
// prepare the longest path detection algorithm
const algorithm = new LongestPath()
// run the algorithm
const result = algorithm.run(graph)

// highlight the cycle
for (const edge of result.edges) {
  graph.setStyle(edge, highlightLongestPathStyle)
}

Type Details

yFiles module
view-layout-bridge

See Also

Constructors

Properties

Methods