Package pygraphlib :: Module pygraph :: Class UGraph
[show private | hide private]
[frames | no frames]

Class UGraph

DGraph --+
         |
        UGraph


Undirected graphs.
>>> from pygraphlib import pygraph
>>> graph = pygraph.UGraph()
>>> graph.add_edge(1,2)
>>> print graph
UGraph: 2 nodes, 1 edges

Method Summary
  __init__(self, *kwlist, **kwargs)
  __str__(self)
User friendly representation
  add_edge(self, head, tail, wt, data, create_nodes)
Adds a directed edge going from head to tail.
  all_degree(self, node)
The total degree of a node
  all_nbrs(self, node)
The total degree of a node
  graph_error(self, msg)
Reports an error message
  number_of_edges(self)
Returns the number of edges
    Inherited from DGraph
  __contains__(self, node)
Test whether a node is in the graph
  __iter__(self)
Iterates over all nodes in the graph
  __len__(self)
Returns the number of nodes
  __repr__(self)
User friendly and verbose representation
  add_node(self, node, data)
Creates a new node with a node.
  all_edges(self, node)
Returns a list containing all incoming and outging edges
  edge_data(self, edge)
Returns the data associated with an edge
  edge_head(self, edge)
Returns the head of the edge.
  edge_list(self)
Returns a list of all edge_ids in the graph
  edge_nodes(self, edge)
Returns the head and the tail of an edge.
  edge_tail(self, edge)
Returns the tail of the edge.
  get_edge(self, head, tail)
Returns the edge that connects the head to tail
  get_edge_data(self, edge)
Sets the data for an edge
  get_edge_wt(self, edge)
Gets the wt of the edge
  hide_edge(self, edge)
Hides an edge from the graph.
  hide_node(self, node)
Hides a node from the graph.
  inc_degree(self, node)
Returns the number of incoming edges
  inc_edges(self, node)
Returns a list of the incoming edges
  inc_nbrs(self, node)
Returns a list of nodes connected by incoming edges.
  node_data(self, node)
Returns the data associated with a node
  node_list(self)
Returns a list of the nodes in the graph.
  number_of_hidden_edges(self)
Returns the number of hidden edges.
  number_of_hidden_nodes(self)
Returns the number of hidden nodes.
  number_of_nodes(self)
Returns the number of nodes
  out_degree(self, node)
Returns the number of outgoing edges
  out_edges(self, node)
Returns a list of the outgoing edges.
  out_nbrs(self, node)
Returns a list of nodes connected by outgoing edges.
  restore_all_edges(self)
Restores all hidden edges.
  restore_all_nodes(self)
Restores all hidden nodes.
  restore_edge(self, edge)
Restores a hidden edge.
  restore_node(self, node)
Restores a hidden node
  set_edge_data(self, edge_id, edge_data)
Fets the data for an edge
  set_edge_wt(self, edge, wt)
Sets the wt of the edge

Method Details

__str__(self)
(Informal representation operator)

User friendly representation
Overrides:
pygraphlib.pygraph.DGraph.__str__

add_edge(self, head, tail, wt=1.0, data=None, create_nodes=True)

Adds a directed edge going from head to tail. The wt and edge_data parameters allow you to associate a numerical weight wt and/or arbitrary data with the edge. If create_nodes=True it will automatically create the non existing nodes.
Overrides:
pygraphlib.pygraph.DGraph.add_edge (inherited documentation)

all_degree(self, node)

The total degree of a node
Overrides:
pygraphlib.pygraph.DGraph.all_degree

all_nbrs(self, node)

The total degree of a node
Overrides:
pygraphlib.pygraph.DGraph.all_nbrs

graph_error(self, msg)

Reports an error message
Overrides:
pygraphlib.pygraph.DGraph.graph_error

number_of_edges(self)

Returns the number of edges
Overrides:
pygraphlib.pygraph.DGraph.number_of_edges

Generated by Epydoc 2.1 on Wed Jan 5 09:38:28 2005 http://epydoc.sf.net