documentationfor yFiles for HTML 2.6

LongestPath

Finds the longest directed path in an acyclic graph.

Inheritance Hierarchy
LongestPath

Remarks

Other Path-Related Algorithms

yFiles for HTML 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

yFiles for HTML 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
yfiles-umd modules
view-layout-bridge
Legacy UMD name
yfiles.analysis.LongestPath

See Also

Constructors

Properties

Methods