Skip to content

Commit

Permalink
Add traverse_graph / AGE engine for visualization
Browse files Browse the repository at this point in the history
The graph visualization feature now uses the traverse_graph function
(with AGE as the main engine) to collect the requested nodes to be
visualized. This was implemented in the methods of the graph class:
previously, `recurse_descendants` and `recurse_ancestors` used to
work by calling `add_incoming` and `add_outgoing` many times, which
in turn have to load nodes during the procedure. Now these are all
independent and they all call the traverse_graph function, so the
information is obtained directly from the query projections and no
nodes are loaded. So these changes are not only important as a first
step to homogenize graph traversal throughout the whole code: an
improvement in the visualization procedure is expected as well.
  • Loading branch information
zooks97 authored and ramirezfranciscof committed Dec 18, 2019
1 parent 93afc88 commit 2334972
Show file tree
Hide file tree
Showing 2 changed files with 217 additions and 86 deletions.
17 changes: 17 additions & 0 deletions aiida/common/links.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,23 @@ class GraphTraversalRules(Enum):
'call_work_backward': GraphTraversalRule(LinkType.CALL_WORK, 'backward', True, True)
}

# For vizualization, everything should be allowed, but the graph should be minimal by default
# It's also unknown whether this will be used for ancestors or descendants
VISUALIZE = {
'input_calc_forward': GraphTraversalRule(LinkType.INPUT_CALC, 'forward', True, False),
'input_calc_backward': GraphTraversalRule(LinkType.INPUT_CALC, 'backward', False, False),
'create_forward': GraphTraversalRule(LinkType.CREATE, 'forward', True, False),
'create_backward': GraphTraversalRule(LinkType.CREATE, 'backward', True, False),
'return_forward': GraphTraversalRule(LinkType.RETURN, 'forward', True, False),
'return_backward': GraphTraversalRule(LinkType.RETURN, 'backward', True, False),
'input_work_forward': GraphTraversalRule(LinkType.INPUT_WORK, 'forward', True, False),
'input_work_backward': GraphTraversalRule(LinkType.INPUT_WORK, 'backward', True, False),
'call_calc_forward': GraphTraversalRule(LinkType.CALL_CALC, 'forward', True, False),
'call_calc_backward': GraphTraversalRule(LinkType.CALL_CALC, 'backward', True, False),
'call_work_forward': GraphTraversalRule(LinkType.CALL_WORK, 'forward', True, False),
'call_work_backward': GraphTraversalRule(LinkType.CALL_WORK, 'backward', True, False)
}


def validate_link_label(link_label):
"""Validate the given link label.
Expand Down
Loading

0 comments on commit 2334972

Please sign in to comment.