Package pgraph :: Module graph :: Class graph
[show private | hide private]
[frames | no frames]

Type graph

object --+
         |
        graph

Known Subclasses:
function, module


To Do:

Method Summary
  __init__(self, id)
  add_cluster(self, cluster)
Add a pgraph cluster to the graph.
  add_edge(self, edge, prevent_dups)
Add a pgraph edge to the graph.
  add_graph(self, other_graph)
Alias of graph_cat().
  add_node(self, node)
Add a pgraph node to the graph.
  del_cluster(self, id)
Remove a cluster from the graph.
  del_edge(self, id, src, dst)
Remove an edge from the graph.
  del_graph(self, other_graph)
Alias of graph_sub().
  del_node(self, id)
Remove a node from the graph.
List edges_from(self, id)
Enumerate the edges from the specified node.
List edges_to(self, id)
Enumerate the edges to the specified node.
Mixed find_cluster(self, attribute, value)
Find and return the cluster with the specified attribute / value pair.
Mixed find_cluster_by_node(self, attribute, value)
Find and return the cluster that contains the node with the specified attribute / value pair.
Mixed find_edge(self, attribute, value)
Find and return the edge with the specified attribute / value pair.
Mixed find_node(self, attribute, value)
Find and return the node with the specified attribute / value pair.
  graph_cat(self, other_graph)
Concatenate the other graph into the current one.
pgraph.graph graph_down(self, from_node_id, max_depth)
Create a new graph, looking down, from the specified node id to the specified depth.
  graph_intersect(self, other_graph)
Remove all elements from the current graph that do not exist in the other graph.
pgraph.graph graph_proximity(self, center_node_id, max_depth_up, max_depth_down)
Create a proximity graph centered around the specified node.
  graph_sub(self, other_graph)
Remove the elements shared between the current graph and other graph from the current graph.
pgraph.graph graph_up(self, to_node_id, max_depth)
Create a new graph, looking up, from the specified node id to the specified depth.
String render_graph_gml(self)
Render the GML graph description.
pydot.Dot render_graph_graphviz(self)
Render the graphviz graph structure.
String render_graph_udraw(self)
Render the uDraw graph description.
String render_graph_udraw_update(self)
Render the uDraw graph update description.
List sorted_nodes(self)
Return a list of the nodes within the graph, sorted by id.
  update_node_id(self, current_id, new_id)
Simply updating the id attribute of a node will sever the edges to / from the given node.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Class Variable Summary
list clusters = []
dict edges = {}
NoneType id = None                                                                  
dict nodes = {}

Method Details

add_cluster(self, cluster)

Add a pgraph cluster to the graph.
Parameters:
cluster - Cluster to add to graph
           (type=pGRAPH Cluster)

add_edge(self, edge, prevent_dups=True)

Add a pgraph edge to the graph. Ensures a node exists for both the source and destination of the edge.
Parameters:
edge - Edge to add to graph
           (type=pGRAPH Edge)
prevent_dups - (Optional, Def=True) Flag controlling whether or not the addition of duplicate edges is ok
           (type=Boolean)

add_graph(self, other_graph)

Alias of graph_cat(). Concatenate the other graph into the current one.
Parameters:
other_graph - Graph to concatenate into this one.
           (type=pgraph.graph)

See Also: graph_cat()

To Do: Add support for clusters

add_node(self, node)

Add a pgraph node to the graph. Ensures a node with the same id does not already exist in the graph.
Parameters:
node - Node to add to graph
           (type=pGRAPH Node)

del_cluster(self, id)

Remove a cluster from the graph.
Parameters:
id - Identifier of cluster to remove from graph
           (type=Mixed)

del_edge(self, id=None, src=None, dst=None)

Remove an edge from the graph. There are two ways to call this routine, with an edge id:
   graph.del_edge(id)
or by specifying the edge source and destination:
   graph.del_edge(src=source, dst=destination)
Parameters:
id - (Optional) Identifier of edge to remove from graph
           (type=Mixed)
src - (Optional) Source of edge to remove from graph
           (type=Mixed)
dst - (Optional) Destination of edge to remove from graph
           (type=Mixed)

del_graph(self, other_graph)

Alias of graph_sub(). Remove the elements shared between the current graph and other graph from the current graph.
Parameters:
other_graph - Graph to diff/remove against
           (type=pgraph.graph)

See Also: graph_sub()

To Do: Add support for clusters

del_node(self, id)

Remove a node from the graph.

edges_from(self, id)

Enumerate the edges from the specified node.
Parameters:
id - Identifier of node to enumerate edges from
           (type=Mixed)
Returns:
List of edges from the specified node
           (type=List)

edges_to(self, id)

Enumerate the edges to the specified node.
Parameters:
id - Identifier of node to enumerate edges to
           (type=Mixed)
Returns:
List of edges to the specified node
           (type=List)

find_cluster(self, attribute, value)

Find and return the cluster with the specified attribute / value pair.
Parameters:
attribute - Attribute name we are looking for
           (type=String)
value - Value of attribute we are looking for
           (type=Mixed)
Returns:
Cluster, if attribute / value pair is matched. None otherwise.
           (type=Mixed)

find_cluster_by_node(self, attribute, value)

Find and return the cluster that contains the node with the specified attribute / value pair.
Parameters:
attribute - Attribute name we are looking for
           (type=String)
value - Value of attribute we are looking for
           (type=Mixed)
Returns:
Cluster, if node with attribute / value pair is matched. None otherwise.
           (type=Mixed)

find_edge(self, attribute, value)

Find and return the edge with the specified attribute / value pair.
Parameters:
attribute - Attribute name we are looking for
           (type=String)
value - Value of attribute we are looking for
           (type=Mixed)
Returns:
Edge, if attribute / value pair is matched. None otherwise.
           (type=Mixed)

find_node(self, attribute, value)

Find and return the node with the specified attribute / value pair.
Parameters:
attribute - Attribute name we are looking for
           (type=String)
value - Value of attribute we are looking for
           (type=Mixed)
Returns:
Node, if attribute / value pair is matched. None otherwise.
           (type=Mixed)

graph_cat(self, other_graph)

Concatenate the other graph into the current one.
Parameters:
other_graph - Graph to concatenate into this one.
           (type=pgraph.graph)

To Do: Add support for clusters

graph_down(self, from_node_id, max_depth)

Create a new graph, looking down, from the specified node id to the specified depth.
Parameters:
from_node_id - Node to use as start of down graph
           (type=pgraph.node)
max_depth - Number of levels to include in down graph (-1 for infinite)
           (type=Integer)
Returns:
Down graph around specified node.
           (type=pgraph.graph)

graph_intersect(self, other_graph)

Remove all elements from the current graph that do not exist in the other graph.
Parameters:
other_graph - Graph to intersect with
           (type=pgraph.graph)

To Do: Add support for clusters

graph_proximity(self, center_node_id, max_depth_up=2, max_depth_down=2)

Create a proximity graph centered around the specified node.
Parameters:
center_node_id - Node to use as center of proximity graph
           (type=pgraph.node)
max_depth_up - (Optional, Def=2) Number of upward levels to include in proximity graph
           (type=Integer)
max_depth_down - (Optional, Def=2) Number of downward levels to include in proximity graph
           (type=Integer)
Returns:
Proximity graph around specified node.
           (type=pgraph.graph)

graph_sub(self, other_graph)

Remove the elements shared between the current graph and other graph from the current graph.
Parameters:
other_graph - Graph to diff/remove against
           (type=pgraph.graph)

To Do: Add support for clusters

graph_up(self, to_node_id, max_depth)

Create a new graph, looking up, from the specified node id to the specified depth.
Parameters:
to_node_id - Node to use as start of up graph
           (type=pgraph.node)
max_depth - Number of levels to include in up graph (-1 for infinite)
           (type=Integer)
Returns:
Up graph to the specified node.
           (type=pgraph.graph)

render_graph_gml(self)

Render the GML graph description.
Returns:
GML graph description.
           (type=String)

render_graph_graphviz(self)

Render the graphviz graph structure.
Returns:
Pydot object representing entire graph
           (type=pydot.Dot)

render_graph_udraw(self)

Render the uDraw graph description.
Returns:
uDraw graph description.
           (type=String)

render_graph_udraw_update(self)

Render the uDraw graph update description.
Returns:
uDraw graph description.
           (type=String)

sorted_nodes(self)

Return a list of the nodes within the graph, sorted by id.
Returns:
List of nodes, sorted by id.
           (type=List)

update_node_id(self, current_id, new_id)

Simply updating the id attribute of a node will sever the edges to / from the given node. This routine will correctly update the edges as well.
Parameters:
current_id - Current ID of node whose ID we want to update
           (type=Long)
new_id - New ID to update to.
           (type=Long)

Class Variable Details

clusters

Type:
list
Value:
[]                                                                     

edges

Type:
dict
Value:
{}                                                                     

id

Type:
NoneType
Value:
None                                                                  

nodes

Type:
dict
Value:
{}                                                                     

Generated by Epydoc 2.1 on Fri Jun 16 17:16:25 2006 http://epydoc.sf.net