Options
All
  • Public
  • Public/Protected
  • All
Menu

The DirectedCycle class represents a data type for determining whether the underlying digraph has a directed cycle. The hasCycle operation determines whether the digraph has a directed cycle and, and of so, the cycle operation returns one.

Be aware that this algorithm just detects whethere there is at least one cycle. So if there are several cycles,

DirectedCycle returns only one of them without any guarantee which one.

Underlying digraph is anylized during creating instance of DirectedCycle. It means that if you have another digraph or even if you've changed underlying digraph after creating an instance of DirectedCycle, you should create new instance of DirectedCycle for new/changed digraph.

Graph analysis runs in O(E + V) time during the instance creating. Than running times of hasCycle and cycle are O(1).

For additional documentation, see Section 4.2 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.

Type parameters

  • V

Hierarchy

  • DirectedCycle

Implemented by

Index

Methods

Methods

cycle

  • Returns a directed cycle if the digraph has a directed cycle, and [] otherwise.

    Returns Collection<Vertex<V>>

    a directed cycle if the digraph has a directed cycle, and [] otherwise.

hasCycle

  • hasCycle(): boolean
  • Does the digraph have a directed cycle?

    Returns boolean

    true if the digraph has a directed cycle, false otherwise.

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc