documentationfor yFiles for HTML 2.6

Finds all simple directed or undirected paths between one or more startNodes and endNodes.

Inheritance Hierarchy
Paths

Remarks

Other Path-Related Algorithms

yFiles for HTML supports a number of other algorithms related to paths in a graph:

  • 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

Examples

Calculating all simple paths between start and end nodes
// prepare the paths algorithm
const algorithm = new Paths({
  startNodes: startNode,
  endNodes: endNode
})
// run the algorithm
const result = algorithm.run(graph)

// Highlight paths between start and end
for (const path of result.paths) {
  for (const pathEdge of path.edges) {
    graph.setStyle(pathEdge, pathEdgeStyle)
  }
}

Type Details

yfiles module
view-layout-bridge
yfiles-umd modules
view-layout-bridge
Legacy UMD name
yfiles.analysis.Paths

See Also

The number of simple paths may be exponential to the graph size and,thus, the time and memory consumption of this class can be very high.

Constructors

Properties

Methods