[core] Adds a .copy() method to graph structure.

This commit is contained in:
Romain Dorgueil
2017-07-06 11:29:55 +02:00
parent 8d23232a0d
commit 5d59a72310
2 changed files with 31 additions and 0 deletions

View File

@ -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.