[core] Adds a .copy() method to graph structure.
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
from copy import copy
|
||||
|
||||
from bonobo.constants import BEGIN
|
||||
|
||||
|
||||
@ -62,6 +64,15 @@ class Graph:
|
||||
|
||||
return self
|
||||
|
||||
def copy(self):
|
||||
g = Graph()
|
||||
|
||||
g.edges = copy(self.edges)
|
||||
g.named = copy(self.named)
|
||||
g.nodes = copy(self.nodes)
|
||||
|
||||
return g
|
||||
|
||||
@property
|
||||
def topologically_sorted_indexes(self):
|
||||
"""Iterate in topological order, based on networkx's topological_sort() function.
|
||||
|
||||
Reference in New Issue
Block a user