ragraph.node
¶
Node class module¶
Node
¶
|
Bases: Metadata
Generic node class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
Optional[str]
|
Instance name. Given a UUID if none provided. |
None
|
parent
|
Optional[Node]
|
Parent node. |
None
|
children
|
Optional[Iterable[Node]]
|
List of child nodes. |
None
|
kind
|
str
|
Kind or main category of this instance. |
'node'
|
labels
|
Optional[List[str]]
|
Labels categorizing this instance. |
None
|
weights
|
Optional[Dict[str, Union[int, float]]]
|
Dictionary of weights attached to this instance. |
None
|
annotations
|
Union[Annotations, Dict[str, Any], None]
|
Miscellaneous properties of this instance. |
None
|
uuid
|
Optional[Union[str, UUID]]
|
Fixed UUID if desired, generated when left set to None. |
None
|
Source code in ragraph/node.py
ancestor_gen
property
¶
Yield all ancestors of this node.
descendant_gen
property
¶
Yield all descendants of this node.
json_dict
property
¶
JSON dictionary representation.
Returns:
Name | Type | Description |
---|---|---|
name |
Dict[str, Any]
|
Name as str. |
parent |
Dict[str, Any]
|
Parent name (not Node) as str. |
children |
Dict[str, Any]
|
Children names (not Nodes) as str. |
is_bus |
Dict[str, Any]
|
is_bus as bool. |
kind |
Dict[str, Any]
|
Kind as str. |
labels |
Dict[str, Any]
|
Labels as a list of strings. |
weights |
Dict[str, Any]
|
Weights as dict. |
annotations |
Dict[str, Any]
|
Annotations as per
|
as_dict
¶
Return a copy as a (serializable) dictionary.
Returns:
Name | Type | Description |
---|---|---|
name |
Dict[str, Any]
|
Name as str. |
parent |
Dict[str, Any]
|
Parent name or UUID (not Node) as str. |
children |
Dict[str, Any]
|
Children names (not Nodes) as str. |
is_bus |
Dict[str, Any]
|
is_bus as bool. |
kind |
Dict[str, Any]
|
Kind as str. |
labels |
Dict[str, Any]
|
Labels as a list of strings. |
weights |
Dict[str, Any]
|
Weights as dict. |
annotations |
Dict[str, Any]
|
Annotations as per
|
uuid |
Dict[str, Any]
|
UUID as str if toggled. |