documentationfor yFiles for HTML 2.6

Finds a directed or undirected cycle of edges in a graph.

Inheritance Hierarchy
Cycle

Remarks

The graph can be directed or undirected.

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
  • LongestPath – finds the longest path in the graph

Examples

Highlighting the edge of a cycle in a graph
// prepare the cycle detection algorithm
const algorithm = new Cycle({
  // We are only interested in finding directed cycles
  directed: true
})
// run the algorithm
const result = algorithm.run(graph)

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

Type Details

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

See Also

Constructors

Properties

Methods