Package pygraph :: Package algorithms :: Module searching

Module searching

Search algorithms.

Functions
tuple
breadth_first_search(graph, root=None, filter=null())
Breadth-first search.
tuple
depth_first_search(graph, root=None, filter=null())
Depth-first search.
Variables
  __package__ = 'pygraph.algorithms'
Function Details

breadth_first_search(graph, root=None, filter=null())

 

Breadth-first search.

Parameters:
  • graph (graph, digraph) - Graph.
  • root (node) - Optional root node (will explore only root's connected component)
Returns: tuple
A tuple containing a dictionary and a list.
  1. Generated spanning tree
  2. Graph's level-based ordering

depth_first_search(graph, root=None, filter=null())

 

Depth-first search.

Parameters:
  • graph (graph, digraph) - Graph.
  • root (node) - Optional root node (will explore only root's connected component)
Returns: tuple
A tupple containing a dictionary and two lists:
  1. Generated spanning tree
  2. Graph's preordering
  3. Graph's postordering