Edge
Base edge representation.
Edges have five properties:
- start, which is the starting node
- end, which is the end node
- is_directed, which indicates if the edge is
directed or undirected
- name, which is a unique, non-None value optionally
passed in at instantiation time, and used for hashing
comparisons
- data, which is a dictionary of all non-private
(ie, user-defined) attributes of this node
Properties
def start(self):
Returns the starting point for this edge.
def end(self):
Returns the ending point for this edge.
def is_directed(self):
Returns whether this is a directed edge or not.
Constructors
def __init__(self, start, end, name=None, is_directed=True, **kwargs):
Initializes the Edge.
Accepts start and end arguments, which should be Node objects,
an optional name (one will be autogenerated based on object id
if not provided), the is_directed flag, which controls whether
this is a directed or undirected edge, and a variable number of
kwargs, which will be mapped into attributes.
Usage:
>>> e = Edge(Node("A"), Node("B"), "AB", is_directed=False, weight=5) >>> e.name "AB" >>> e.start Node(name=A) >>> e.end Node(name=B) >>> e.weight 5
Functions
def other_end(self, starting_point):
Returns the other end of the edge from the given point.
If the point given is not an endpoint on this edge or the
endpoint on a directed edge, this raises AttributeError.

