GraphNode
index
../../../../piana/code/Graph/GraphNode.py

File     : GraphNode.py
Author   : Daniel Jaeggi and Ramon Aragues
Creation : 2003
Contents : main class providing graph processing methods
Comments :
 
 
=======================================================================================================
A basic class defining a node in a graph.
 
The basic node class on which the graph is built.
Must be given unique nodeID.
Optionally given an attribute object GraphNodeAttribute.

 
Modules
       
sys

 
Classes
       
GraphNode

 
class GraphNode
    A basic class defining a node in a graph.
 
The basic node class on which the graph is built.
Must be given unique nodeID.
Optionally given an attribute object GraphNodeAttribute.
 
  Methods defined here:
__eq__(self, other)
__ge__(self, other)
__gt__(self, other)
__init__(self, nodeID, attribute=None, isRoot=0, graph=None, expanded_from=None, expansion_type=None, ishidden=0, alternative_id=None)
__le__(self, other)
__lt__(self, other)
__ne__(self, other)
__repr__(self)
__str__(self)
add_edges(self, list_edge_ids)
Adds edges from list_edges to node.edges, after checking they do not exist already
 
This is used to update in the node which neighbours it currently has in the graph
get_degree(self, all=0)
Returns the nodal degree taking into account hidden edges which
are not included. This is the default behaviour.
If all is set to true, hidden edges will also be included.
get_edge_ids(self, filter_mode='all')
Return a list of edge ids where node participates
 
filter_mode not working at the minute. Future usage will be:
    -> will not return nodes if the node is hidden or the edge connecting them is hidden.
    -> if filter_mode=="all" is set true, will return all nodes irrespective of hidden status
get_neighbour_ids(self, all=0)
Return a list of neighbouring nodes.
 
 
Attention! argument 'all' not working.
    Normally: Will not return nodes if the node is hidden or the edge connecting them is hidden.
       -> If "all" is set true, will return all nodes irrespective of hidden status
get_neighbour_ids_dic(self, all=0)
Return a list of neighbouring nodes.
 
Attention! argument 'all' not working.
    Normally: Will not return nodes if the node is hidden or the edge connecting them is hidden.
       -> If "all" is set true, will return all nodes irrespective of hidden status
get_node_alternative_id(self)
returns the alternative node id of this node
get_node_attribute_object(self)
returns list of GraphNodeAttribute objects
get_node_id(self)
returns the node id of this node
get_number_neighbours(self)
returns the number of neighbours of this node in the graph where it belongs
get_number_shared_neighbours(self, other_node_neighbours_ids_list)
returns the number of neighbours of self node that are as well in other_node_neighbours_ids_list (which is a list with neighbours of another node)
hide(self)
Hides the node and all edges associated with it
is_expanded(self)
returns [None, None] if it is not a node coming from an expansion
 
otherwise returns [node id that generated this node, type of expansion that generated this node]
is_hidden(self)
if node is hidden, returns 1
if node is not hidden returns 0
is_root(self)
Returns 1 if it is a root node (node that was used to build graph
merge_attribute(self, attribute_object, ignore_ids=0)
Merges current attribute with attribute_object passed as argument
 
Since GraphNode does not know the specific details of its attributes, this method just calls
the method merge_attribute of the current attribute
 
ignore_ids=1 merges attributes regardless of their ids
merge_nodes(self, node_object, ignore_ids=0)
merges current node with node_object passed as argument, as well as their attributes
 
ignore_ids=1 merges attributes regardless of their ids
set_as_expanded(self, expanded_from, expansion_type)
Sets the node as a result from an expansion
 
expanded_from is the node_id that originated this expanded node
expansion_type is the expansion name that originated this expanded node
set_as_root(self)
Sets the node as one of the root nodes.
set_attribute(self, attribute_object)
Sets the GraphNodeAttribute "attribute_object" object to current node.
Attribute must be an GraphNodeAttribute object.
set_node_id(self, new_node_id=None)
changes current nodeID for new_node_id
unhide(self)
Unhides the node.

 
Data
        verbose = 0
verbose_has_edge = 0