Skip to content

Commit

Permalink
graphviewer: inscription clusters
Browse files Browse the repository at this point in the history
  • Loading branch information
thvitt committed Jul 25, 2020
1 parent 0df71e7 commit 05bb205
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/graphviewer/graphviewer.py
Expand Up @@ -51,6 +51,7 @@ def prepare_agraph():
tred = request.values.get('tred', False)
nohl = request.values.get('nohl', False)
syn = request.values.get('syn', False)
inscriptions = request.values.get('inscriptions', False)
order = request.values.get('order', False)
collapse = request.values.get('collapse', False)
direction = request.values.get('dir', 'LR').upper()
Expand All @@ -61,7 +62,8 @@ def prepare_agraph():
g = info.subgraph(*nodes, context=context, abs_dates=abs_dates, paths=extra, keep_timeline=True,
paths_between_nodes=central_paths,
paths_without_timeline=paths_wo_timeline,
direct_assertions=direct_assertions, include_syn_clusters=syn)
direct_assertions=direct_assertions, include_syn_clusters=syn,
include_inscription_clusters=inscriptions)
if induced_edges:
g = info.base.subgraph(g.nodes).copy()
if not ignored_edges or tred:
Expand Down
4 changes: 4 additions & 0 deletions src/macrogen/graph.py
Expand Up @@ -699,6 +699,10 @@ def subgraph(self, *nodes: Node, context: bool = True, path_to: Iterable[Node] =
if isinstance(node, SynAnchor):
relevant_nodes |= set(self.dag.pred[node]).union(self.dag.succ[node]).union(node.syn_group)

if include_inscription_clusters:
for node in set(central_nodes):
relevant_nodes |= find_reachable_by_edge(self.base, node, 'kind', 'inscription', symmetric=True)

subgraph: nx.MultiDiGraph = nx.subgraph(self.base, relevant_nodes).copy()
sources = set(path_from).union(paths)
targets = set(path_from).union(paths)
Expand Down

0 comments on commit 05bb205

Please sign in to comment.