Edge¶
cluster.graph
provides interfaces for Graph
, Node
and Edge
.
-
class
Edge
(connection: List, directed: bool = True, weight: float = 1.0)¶ Edge between two nodes in a graph
- Parameters
connection – list of two nodes where the ordering indicates the direction of the edge (if directed=True)
directed – indicating whether this edge is directed (from_node -> to_node)
weight – the weight of the edge
-
get_from_node
() → cluster.graph.Node.Node¶ get the from-node (where the edge starts from)
- Returns
from-node
- Return type
-
get_to_node
() → cluster.graph.Node.Node¶ get the to-node (where the edge is directed to)
- Returns
to-node
- Return type
-
get_weight
() → float¶ get the weight of the edge
- Returns
weight of the edge
- Return type
float
-
set_weight
(weight: float) → None¶ set the weight of the edge
- Parameters
weight – weight of the edge
- Returns
None