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

Method copy

pattern/graph/__init__.py:563–573  ·  view source on GitHub ↗

Returns a copy of the graph with the given list of nodes (and connecting edges). The layout will be reset.

(self, nodes=ALL)

Source from the content-addressed store, hash-verified

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).
565 The layout will be reset.
566 """
567 g = Graph(layout=None, distance=self.distance)
568 g.layout = self.layout.copy(graph=g)
569 for n in (nodes==ALL and self.nodes or (isinstance(n, Node) and n or self[n] for n in nodes)):
570 g._add_node_copy(n, root=self.root==n)
571 for e in self.edges:
572 g._add_edge_copy(e)
573 return g
574
575#--- GRAPH LAYOUT ----------------------------------------------------------------------------------
576# Graph drawing or graph layout, as a branch of graph theory,

Callers 1

test_copyMethod · 0.95

Calls 4

_add_node_copyMethod · 0.95
_add_edge_copyMethod · 0.95
GraphClass · 0.85
copyMethod · 0.45

Tested by 1

test_copyMethod · 0.76