Package pygraph :: Package algorithms :: Module cycles

Module cycles

Cycle detection algorithms.

Functions
list
find_cycle(graph)
Find a cycle in the given graph.
Variables
  __package__ = 'pygraph.algorithms'
Function Details

find_cycle(graph)

 

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, digraph) - Graph.
Returns: list
List of nodes.