Function is_cyclic_undirected

Source
pub fn is_cyclic_undirected<G>(g: G) -> bool
Expand description

[Generic] Return true if the input graph contains a cycle.

Always treats the input graph as if undirected.

§Arguments:

g: an input graph that always treated as undirected.

§Returns

true: if the input graph contains a cycle. false: otherwise.

§Complexity

  • Time complexity: amortized O(|E|).
  • Auxiliary space: O(|V|).

where |V| is the number of nodes and |E| is the number of edges.