ragraph.edge
#
Edge module. Contains Edge class definitions.
Module Contents#
Classes#
Edge between a source |
- class ragraph.edge.Edge(source: ragraph.node.Node, target: ragraph.node.Node, name: Optional[str] = None, kind: str = 'edge', labels: Optional[List[str]] = None, weights: Optional[Dict[str, Union[int, float]]] = None, annotations: Union[ragraph.generic.Annotations, Dict[str, Any], None] = None, uuid: Optional[Union[str, uuid.UUID]] = None)#
Bases:
ragraph.generic.Metadata
Edge between a source
Node
and a targetNode
.- Parameters:
source – Source
Node
of this edge.target – Target
Node
of this edge.name – Instance name. Given a UUID if none provided.
kind – Kind or main category of this instance.
labels – Labels categorizing this instance.
weights – Dictionary of weights attached to this instance.
annotations – Miscellaneous properties of this instance.
uuid – Fixed UUID if desired, generated when left set to None.
- property source: ragraph.node.Node#
Edge source node.
- property target: ragraph.node.Node#
Edge target node.
- property json_dict: Dict[str, Any]#
JSON dictionary representation.
- Returns:
Source node UUID (not Node) as str. target: Target node UUID (not Node) as str. kind: Kind as str. labels: Labels as list of str. weights: Weights as dict. annotations: Annotations as a dictionary.
- Return type:
source
- __str__()#
Return str(self).
- __repr__()#
Return repr(self).
- as_dict(use_uuid: bool = False) Dict[str, Any] #
Return a copy as a (serializable) dictionary.
- Parameters:
use_uuid – Whether to use UUIDs instead of names.
- Returns:
Source node name or UUID (not Node) as str. target: Target node name or UUID (not Node) as str. kind: Kind as str. labels: Labels as list of str. weights: Weights as dict. annotations: Annotations as a dictionary. uuid: UUID as str if toggled.
- Return type:
source