def __init__(self, id=None, tokens=None, root=None): # blocked init by conversion from data for the time being ODiGraph.__init__(self) self.id = id self.tokens = tokens # root is an optional property fro rooted graphs self.root = root
def add_node(self, n, label, tokens=None, attr_dict=None, **attr): ODiGraph.add_node(self, n, label=label, tokens=tokens or [], attr_dict=attr_dict, **attr)
def test_order(self): """ test if edges are indeed returned in insertion order """ g = ODiGraph() daughters = range(10) for d in daughters: g.add_edge("mother", d) self.assertEqual(g.successors("mother"), daughters)