Merges one graph with another. All vertices will be convertex to VertexType. Takes union of edge lists. >>> g1, g2 = Graph(VertexType=Vertex), Graph(VertexType=WVertex) >>> g1.add(1, [1, 2]) >>> g2.add(3, [2, 3]); g2.add(1, 2, 3); g2.add(1, 4, 2) >>> g1.update(g2)
(self, other, default=USE_DEFAULT, collision=MERGE_VERTEX)
| 380 | super(Graph, self).__init__(init, {}, MERGE_VERTEX) |
| 381 | |
| 382 | def update(self, other, default=USE_DEFAULT, collision=MERGE_VERTEX): #XXX could remove this if collision was attribute of defdict |
| 383 | """Merges one graph with another. All vertices will be convertex to VertexType. Takes union of edge lists. |
| 384 | >>> g1, g2 = Graph(VertexType=Vertex), Graph(VertexType=WVertex) |
| 385 | >>> g1.add(1, [1, 2]) |
| 386 | >>> g2.add(3, [2, 3]); g2.add(1, 2, 3); g2.add(1, 4, 2) |
| 387 | >>> g1.update(g2) #XXX weight values get set on plain Vertex. |
| 388 | >>> print g1 |
| 389 | {1: {1, 2, 4}, 2: {}, 3: {2, 3}, 4: {}} |
| 390 | >>> g2.add(3, 5) #changes to g2 should not affect g1 |
| 391 | >>> g1._validate() |
| 392 | """ |
| 393 | super(Graph, self).update(other, default, collision) |
| 394 | |
| 395 | def add(self, head, tail=[], edge_value=VertexCommon.EDGEVALUE): |
| 396 | """Add the vertices and/or edges. |
no outgoing calls
no test coverage detected