GraphEdgeAttribute
index
../../../../piana/code/Graph/GraphEdgeAttribute.py

File     : GraphEdgeAttribute.py
Author   : Daniel Jaeggi and Ramon Aragues
Creation : 2003
Contents : class GraphEdgeAttribute
 
=======================================================================================================
 
Skeleton attribute classes for edges in a graph.
 
Edges in a graph are just abstract containers and only have
"real world" meanings by containing attributes. For each particular
problem, custon edge 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 edge and node attributes thus:
 
class FilmLink(EdgeAttribute):
    # class defining edge between 2 actors based on appearance in the same film
    def __init__(self, film, director, year):
        self.film = film
        self.director = director
        self.year = year
    
 
Attributes in this way can be arbitrarily complex

 
Classes
       
GraphEdgeAttribute

 
class GraphEdgeAttribute
    The master class for all GraphEdge 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.
direction(self)
To be overridden. Returns a direction like value.
Defaults to return 0 (i.e. bidirectional)
distance(self)
To be overridden. Returns a distance like value.
Defaults to return 1
get_creation_information(self)
must be overwriteen by a method specific to the kind of Edge being used by the graph
 
it returns the information necessary to create the object, in a tuple
get_db_edge_id(self)
returns the external database identifier of the edge, in case the graph has been constructed from an external database
 
Must be overridden by a method specific to the subclass of GraphEdgeAttribute that interfaces with the database
merge_attribute(self, new_edge_attribute, ignore_ids)
must be overwritten by a method specific to the kind of Edge being used by the graph
 
merges the attribute of the object with the new edge attribute passed as argument