Skip to content

Commit

Permalink
use subgraph in node pages (instead of separate implementation)
Browse files Browse the repository at this point in the history
  • Loading branch information
thvitt committed Oct 9, 2019
1 parent 48b20b5 commit 86f3b90
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/macrogen/report.py
Expand Up @@ -422,14 +422,9 @@ def _last_ref_subpage(self, ref):
wit = ref.reference
else:
start_node, end_node, wit = ref, ref, ref

basename = target / wit.filename
relevant_nodes = {start_node, end_node} | set(self.base.predecessors(start_node)) | set(self.base.successors(end_node))
if start_node.earliest not in {EARLIEST, None}:
relevant_nodes |= set(nx.shortest_path(self.base, start_node.earliest - DAY, ref))
if end_node.latest not in {LATEST, None}:
relevant_nodes |= set(nx.shortest_path(self.base, end_node, end_node.latest + DAY))
ref_subgraph = self.base.subgraph(relevant_nodes)

ref_subgraph = self.graphs.subgraph(ref, context=True, abs_dates=True, direct_assertions=True)
write_dot(ref_subgraph, basename.with_name(basename.stem + '-graph.dot'), highlight=ref)
report = f"<!-- {repr(ref)} -->\n"
report += self.format_table(self.rows[-1:])
Expand Down

0 comments on commit 86f3b90

Please sign in to comment.