MCPcopy Index your code
hub / github.com/clips/pattern / _add_edge_copy

Method _add_edge_copy

pattern/graph/__init__.py:552–561  ·  view source on GitHub ↗
(self, e, **kwargs)

Source from the content-addressed store, hash-verified

550 if k not in ("graph", "links", "_x", "_y", "force", "_weight", "_centrality"))
551
552 def _add_edge_copy(self, e, **kwargs):
553 if kwargs.get("node1", e.node1).id not in self \
554 or kwargs.get("node2", e.node2).id not in self:
555 return
556 new = self.add_edge(
557 kwargs.get("node1", self[e.node1.id]),
558 kwargs.get("node2", self[e.node2.id]))
559 new.__class__ = e.__class__
560 new.__dict__.update((k, deepcopy(v)) for k,v in e.__dict__.iteritems()
561 if k not in ("node1", "node2"))
562
563 def copy(self, nodes=ALL):
564 """ Returns a copy of the graph with the given list of nodes (and connecting edges).

Callers 4

copyMethod · 0.95
redirectFunction · 0.80
cutFunction · 0.80
insertFunction · 0.80

Calls 5

add_edgeMethod · 0.95
deepcopyFunction · 0.85
iteritemsMethod · 0.80
getMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected