pygraph

Package pygraph |

# Package pygraph

python-graph

A library for working with graphs in Python.

Version: 1.8.2

Data structure classes are located at `pygraph.classes`.

Exception classes are located at `pygraph.classes.exceptions`.

Search filters are located at `pygraph.algorithms.filters`.

Heuristics for the A* algorithm are exposed in `pygraph.algorithms.heuristics`.

A quick introductory example:

    >>> # Import the module and instantiate a graph object
    >>> from pygraph.classes.graph import graph
    >>> from pygraph.algorithms.searching import depth_first_search
    >>> gr = graph()
    >>> # Add nodes
    >>> gr.add_nodes(['X','Y','Z'])
    >>> gr.add_nodes(['A','B','C'])
    >>> # Add edges
    >>> gr.add_edge(('X','Y'))
    >>> gr.add_edge(('X','Z'))
    >>> gr.add_edge(('A','B'))
    >>> gr.add_edge(('A','C'))
    >>> gr.add_edge(('Y','B'))
    >>> # Depth first search rooted on node X
    >>> st, pre, post = depth_first_search(gr, root='X')
    >>> # Print the spanning tree
    >>> print st
    {'A': 'B', 'C': 'A', 'B': 'Y', 'Y': 'X', 'X': None, 'Z': 'X'}

Submodules
pygraph.algorithms: Algorithms pygraph.algorithms.accessibility: Accessibility algorithms. pygraph.algorithms.critical: Critical path algorithms and transitivity detection algorithm. pygraph.algorithms.cycles: Cycle detection algorithms. pygraph.algorithms.filters: Set of searching filters. pygraph.algorithms.filters.find: Search filter for finding a specific node. pygraph.algorithms.filters.null: Null searching filter. pygraph.algorithms.filters.radius: Radial search filter. pygraph.algorithms.generators: Random graph generators. pygraph.algorithms.heuristics: Set of search heuristics. pygraph.algorithms.heuristics.chow: Edmond Chow's heuristic for A*. pygraph.algorithms.heuristics.euclidean: A* heuristic for euclidean graphs. pygraph.algorithms.minmax: Minimization and maximization algorithms. pygraph.algorithms.pagerank: PageRank algoritm pygraph.algorithms.searching: Search algorithms. pygraph.algorithms.sorting: Sorting algorithms. pygraph.algorithms.traversal: Traversal algorithms. pygraph.algorithms.utils: Miscellaneous useful stuff. pygraph.classes: Data structure classes. pygraph.classes.digraph: Digraph class pygraph.classes.exceptions: Exceptions. pygraph.classes.graph: Graph class pygraph.classes.hypergraph: Hypergraph class pygraph.mixins: Mixins. pygraph.mixins.basegraph pygraph.mixins.common pygraph.mixins.labeling pygraph.readwrite: Readwrite algorithms. pygraph.readwrite.markup: Functions for reading and writing graphs in a XML markup.

Variables
| __package__ = `None`