Skip to content

Commit

Permalink
When loading graphs, initialize order from graph not json
Browse files Browse the repository at this point in the history
Fixes #25
  • Loading branch information
thvitt committed May 31, 2019
1 parent ec8d04e commit 6aefa4b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/macrogen/graph.py
Expand Up @@ -312,11 +312,11 @@ def _load_from(self, load_from: Path):
self.base = nx.read_gpickle(base_entry)
with zip.open('simple_cycles.pickle', 'r') as sc_entry:
self.simple_cycles = pickle.load(sc_entry)
with zip.open('order.json', 'r') as order_entry:
text = TextIOWrapper(order_entry, encoding='utf-8')
uris = json.load(text)
self.order = [Witness.get(uri) for uri in uris]
self._build_index()
# with zip.open('order.json', 'r') as order_entry:
# text = TextIOWrapper(order_entry, encoding='utf-8')
# uris = json.load(text)
# self.order = [Witness.get(uri) for uri in uris]
# self._build_index()

# Now reconstruct the other data:
self.working: nx.MultiDiGraph = self.base.copy()
Expand All @@ -338,6 +338,7 @@ def _load_from(self, load_from: Path):
logger.info('Could not remove %s→%s (%d): %s', u, v, k, e)
check_acyclic(self.dag,
f'Base graph from {load_from} is not acyclic after removing conflicting and ignored edges.')
self.order_refs()
self.closure = nx.transitive_closure(self.dag)
self._augment_details()

Expand Down

0 comments on commit 6aefa4b

Please sign in to comment.