GraphNodeAttribute
index
../../../../piana/code/Graph/GraphNodeAttribute.py

File     : GraphNodeAttribute.py
Author   : Daniel Jaeggi and Ramon Aragues
Creation : 2003
Contents : class NodeAttribute
 
=======================================================================================================
 
Skeleton attribute classes for nodes in a graph.
 
nodes in a graph are just abstract containers and only have
"real world" meanings by containing attributes. For each particular
problem, custon edge and node attributes must be defined.
 
For example, we may be modeling the network formed by Hollywood actors.
Actors form the nodes and films in which both actors have starred form
the edges. We could then define custom node attributes thus:
 
class Actor(NodeAttribute):
    # class defining an movie actor
    def __init__(self, name, n_oscars=0, speciality='hollywood_blockbusters'):
        self.name = name
        self.n_oscars = int(n_oscars)
        self.speciality = speciality
 
Attributes in this way can be arbitrarily complex

 
Classes
       
GraphNodeAttribute

 
class GraphNodeAttribute
    The master class for all GraphNode attributes. It is envisaged that this
class will form the basis for custom attribute classes.
 
  Methods defined here:
__eq__(self, other)
When defining new Attribute classes, the equality operator MUST be overridden.
Otherwise, adding further attributes to existing nodes in the graph may cause
duplicated attributes.
get_node_id(self)
must be overwritten with a method that returns an identifier of this attribute
merge_attribute(self, attribute_object, ignore_ids)
Must be overwritten by a method specific to the kind of node being used for the Graph
 
merges existing attribute with atribute_object passed as argument