def add_edge(self, edge, wt = <NUM_LIT:1>, label="<STR_LIT>", attrs = []):
u, v = edge<EOL>for n in [u,v]:<EOL><INDENT>if not n in self.node_neighbors:<EOL><INDENT>raise AdditionError( "<STR_LIT>" % n )<EOL><DEDENT>if not n in self.node_incidence:<EOL><INDENT>raise AdditionError( "<STR_LIT>" % n )<EOL><DEDENT><DEDENT>if v in self.node_neighbors[u] and u in self.node_incidence[v]:<EOL><INDENT>raise AdditionError("<STR_LIT>" % (u, v))<EOL><DEDENT>else:<EOL><INDENT>self.node_neighbors[u].append(v)<EOL>self.node_incidence[v].append(u)<EOL>self.set_edge_weight((u, v), wt)<EOL>self.add_edge_attributes( (u, v), attrs )<EOL>self.set_edge_properties( (u, v), label=label, weight=wt )<EOL><DEDENT>
Add an directed edge to the graph connecting two nodes.

An edge, here, is a pair of nodes like C{(n, m)}.

@type  edge: tuple
@param edge: Edge.

@type  wt: number
@param wt: Edge weight.

@type  label: string
@param label: Edge label.

@type  attrs: list
@param attrs: List of node attributes specified as (attribute, value) tuples.