Package graph :: Package algorithms :: Module cycles

Module cycles

Cycle detection algorithms.

Functions
list
find_cycle(graph, directed=False)
Find a cycle in the given graph.
Function Details

find_cycle(graph, directed=False)

 

Find a cycle in the given graph.

This function will return a list of nodes which form a cycle in the graph or an empty list if no cycle exists.

Parameters:
  • graph (graph) - Graph.
Returns: list
List of nodes.