Package networkx :: Module xgraph
[hide private]
[frames] | no frames]

Module xgraph

source code

Base class for XGraph.

XGraph allows self-loops and multiple edges with arbitrary (hashable) objects as nodes and arbitrary objects associated with edges.

Examples

Create an empty graph structure (a "null graph") with no nodes and no edges

>>> from networkx import *
>>> G=XGraph()  # default no self-loops, no multiple edges

You can add nodes in the same way as the simple Graph class >>> G.add_nodes_from(xrange(100,110))

You can add edges as for simple Graph class, but with optional edge data/labels/objects.

>>> G.add_edges_from([(1,2,0.776),(1,3,0.535)])

For graph coloring problems, one could use >>> G.add_edges_from([(1,2,"blue"),(1,3,"red")])




Author: Aric Hagberg (hagberg@lanl.gov) Pieter Swart (swart@lanl.gov) Dan Schult(dschult@colgate.edu)

Classes [hide private]
  XGraph
A class implementing general undirected graphs, allowing (optional) self-loops, multiple edges, arbitrary (hashable) objects as nodes and arbitrary objects associated with edges.
Functions [hide private]
 
_test_suite() source code