ragraph.edge
¶
Edge class module¶
Edge
¶
|
Bases: Metadata
Edge between a source Node
and a target Node
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source |
Node
|
Source |
required |
target |
Node
|
Target |
required |
name |
Optional[str]
|
Instance name. Given a UUID if none provided. |
None
|
kind |
str
|
Kind or main category of this instance. |
'edge'
|
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/edge.py
json_dict
property
¶
JSON dictionary representation.
Returns:
Name | Type | Description |
---|---|---|
source |
Dict[str, Any]
|
Source node UUID (not Node) as str. |
target |
Dict[str, Any]
|
Target node UUID (not Node) as str. |
kind |
Dict[str, Any]
|
Kind as str. |
labels |
Dict[str, Any]
|
Labels as list of str. |
weights |
Dict[str, Any]
|
Weights as dict. |
annotations |
Dict[str, Any]
|
Annotations as a dictionary. |
as_dict
¶
Return a copy as a (serializable) dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
use_uuid |
bool
|
Whether to use UUIDs instead of names. |
False
|
Returns:
Name | Type | Description |
---|---|---|
source |
Dict[str, Any]
|
Source node name or UUID (not Node) as str. |
target |
Dict[str, Any]
|
Target node name or UUID (not Node) as str. |
kind |
Dict[str, Any]
|
Kind as str. |
labels |
Dict[str, Any]
|
Labels as list of str. |
weights |
Dict[str, Any]
|
Weights as dict. |
annotations |
Dict[str, Any]
|
Annotations as a dictionary. |
uuid |
Dict[str, Any]
|
UUID as str if toggled. |