Skip to content
Snippets Groups Projects
Commit 3e1100b7 authored by Bob Lantz's avatar Bob Lantz
Browse files

Clarify MultiTopo docstrs and copy addLInk opts

Note: it's a bit confusing, but we need to copy the link
parameter dicts (since we update them with node info), but we
can share the node dicts. Perhaps we should copy the node
dicts as well...
parent 086afe85
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,8 @@ def __init__( self ):
def add_node( self, node, attr_dict=None, **attrs):
"""Add node to graph
attr_dict: attribute dict (optional)
attrs: more attributes (optional)"""
attrs: more attributes (optional)
warning: updates attr_dict with attrs"""
attr_dict = {} if attr_dict is None else attr_dict
attr_dict.update( attrs )
self.node[ node ] = attr_dict
......@@ -31,7 +32,9 @@ def add_node( self, node, attr_dict=None, **attrs):
def add_edge( self, src, dst, key=None, attr_dict=None, **attrs ):
"""Add edge to graph
key: optional key
attr_dict: optional attribute dict"""
attr_dict: optional attribute dict
attrs: more attributes
warning: udpates attr_dict with attrs"""
attr_dict = {} if attr_dict is None else attr_dict
attr_dict.update( attrs )
self.node.setdefault( src, {} )
......@@ -151,6 +154,7 @@ def addLink( self, node1, node2, port1=None, port2=None,
if not opts and self.lopts:
opts = self.lopts
port1, port2 = self.addPort( node1, node2, port1, port2 )
opts = dict( opts )
opts.update( node1=node1, node2=node2, port1=port1, port2=port2 )
self.g.add_edge(node1, node2, key, opts )
return key
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment