Commit 6e4dae58 authored by Wout De Nolf's avatar Wout De Nolf
Browse files


parent 18f969c0
......@@ -241,10 +241,12 @@ class TaskGraph:
raise TypeError(graph, type(graph))
graph = flatten_multigraph(graph)
subgraphs = get_subgraphs(graph)
if subgraphs:
# Extract
edges, update_attrs = extract_subgraphs(graph, subgraphs)
# Merged
self.graph = graph
graphs = [self] + list(subgraphs.values())
......@@ -252,17 +254,19 @@ class TaskGraph:
graph = merge_graphs(
graphs, name=graph.graph["name"], rename_nodes=rename_nodes
# Re-link
add_subgraph_links(graph, edges, update_attrs)
self.graph = graph
def dump(
self, destination=None, representation=GraphRepresentation.json_dict, **kw
def dump(self, destination=None, representation=None, **kw):
"""From runtime to persistent representation"""
if isinstance(destination, str):
if destination.endswith(".json"):
if representation is None:
if isinstance(destination, str) and destination.endswith(".json"):
representation = self.GraphRepresentation.json_file
representation = self.GraphRepresentation.json_dict
if representation == self.GraphRepresentation.json_dict:
return networkx.readwrite.json_graph.node_link_data(self.graph)
elif representation == self.GraphRepresentation.json_file:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment