GraphEdge
index
../../../../piana/code/Graph/GraphEdge.py

File     : GraphEdge.py
Author   : Daniel Jaeggi and Ramon Aragues
Creation : 2003
Contents : main class providing graph processing methods
Comments :
 
=======================================================================================================
The basic edge class linking teo nodes in a graph.
 
The edge is initialised with two node objects and optional attributes.
Further attributes may be added later.

 
Modules
       
sys

 
Classes
       
GraphEdge

 
class GraphEdge
    The basic edge class linking teo nodes in a graph.
 
The edge is initialised with two node objects and optional attributes.
Further attributes may be added later.
 
  Methods defined here:
__eq__(self, other)
__init__(self, node1_id, node2_id, attribute_object=None, graph=None, original=1, propagated=0, extended=0, hidden=0)
GraphEdge is initialized with two node identifiers, optional GraphEdgeAttribute and parameters indicating origin of the edge
 
"original" states whether the edge comes from the standard set of edges (loaded from file, database, ...) or not
 
"expanded_from" and "expansion_type" indicate if the edge comes from an expansion
 
"graph" is the Graph where the edge belongs (one edge can only be in one graph)
__ne__(self, other)
__repr__(self)
__str__(self)
direction(self)
Returns the direction of the edge
   0 --> Bidirectional
   1 --> A to B
  -1 --> B to A
distance(self)
Returns a distance/length like value.
get_db_edge_id(self)
returns the identifier of the external database for this edge. If the edge doesn't come from an external database, it will
return None
 
this method simply calls the get_edge_db_id of the attribute, which is specific to each edge attribute.
get_edge_attribute_object(self)
returns GraphEdgeAttribute object of the GraphEdge
get_edge_id(self)
returns the edge id internal to Graph (composed by the two node identifiers)
this is different from the database identifier, which is obtained from the edge attribute
get_end_node_id(self)
returns the  end node object of this edge
get_node_ids(self)
returns both nodes in a list [start_node, end_node]
get_partner_id(self, query_node_id)
Returns the other partner node of the edge.
Argument is one node id
get_start_node_id(self)
returns the start node object of this edge
hide(self)
Hides the edge and checks the two nodes defining the edge to see if they
need to be hidden too.
is_extended(self)
returns whether the edge is extended (1) or not (0)
 
more details about the propagation can be obtained from the edge_attribute
is_hidden(self)
if node is hidden, returns 1
if node is not hidden returns 0
is_original(self)
returns whether the edge is original (1) or not (0)
is_propagated(self)
returns whether the edge is propagated (1) or not (0)
 
more details about the propagation can be obtained from the edge_attribute
merge_attribute(self, new_attribute_object, ignore_ids=0)
Merges new_attribute with the existing attribute of the GraphEdge. Since the way of merging attributes
depends on the kind of attribute, all the merging process is performed by the method merge_attribute of
the corresponding attribute
merge_edges(self, new_edge, ignore_ids=0)
merges two edges (ie. merges the attribute of the new_edge into the attribute of current edge)
set_attribute(self, attribute_object)
Adds an attribute to the edge.
set_extended(self, extended)
changes the status of the edge
 
extended == 1 means the edge was added to the graph as an edge of a node added to the graph as a result of an expansion
 
details on the kind of extension can be obtained from the edge_attribute
set_original(self, original)
changes the status of the edge
 
original == 1 means the edge was added to the graph from the original set of root nodes
set_propagated(self, propagated)
changes the status of the edge
 
propagated == 1 means the edge was added to the graph as a propagation of the edge of another node
 
details on the kind of propagation can be obtained from the edge_attribute
unhide(self)
Unhides the edge and the nodes associated with it.

 
Data
        verbose = 0