ragraph.utils
¶
Graph handling utilities¶
get_up_to_depth
¶
Get nodes up to a certain depth with bus nodes at the start of child lists.
Source code in ragraph/utils.py
is_dependent
¶
Check if a node is dependent on the lead node kind.
E.g. an edge of the allowed kinds exists to or from the lead nodes.
Source code in ragraph/utils.py
select_nodes
¶
Select specific nodes from this graph in a structured order.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
graph |
Graph
|
Graph to fetch data from. |
required |
node_kinds |
List[str]
|
The kind of nodes to be selected. |
required |
edge_kinds |
List[str]
|
The kind of edges to be selected. |
required |
depth |
int
|
The maximum depth of node to be selected. |
required |
selection_mode |
str
|
The selection mode. Either 'dependent' or 'independent'. |
required |
Note
The selection mode argument determines how nodes of different kinds are
selected. If the selection mode is set to 'dependent', the first node kind
in the node_kinds
list is considered to be the 'lead node kind'.
Nodes of different kind than the lead node kind, are only selected if they
have a dependency with at least one of the selected nodes of the lead node
kind. If the selection mode is set to 'independent' this dependency
condition is dropped.