Graph¶
cluster.graph
provides interfaces for Graph
, Node
and Edge
.
-
class
Graph
(nodes: List[cluster.graph.Node.Node], edges: List[cluster.graph.Edge.Edge], directed: bool = True, attributes: Optional[Dict[AnyStr, Any]] = None)¶ Graph object consisting of nodes and edges
- Parameters
nodes – list of nodes
edges – list of edges
directed – whether the given graph is directed
attributes – attributes of any kind added to this graph
-
add_edge
(edge: cluster.graph.Edge.Edge) → None¶ add an edge to the graph
- Parameters
edge – the edge to be added
- Returns
None
-
add_node
(node: cluster.graph.Node.Node) → None¶ add a node to the graph
- Parameters
node – the node to be added
- Returns
None
-
get_D
() → numpy.array¶ get the degree matrix D
- Returns
degree matrix D
- Return type
np.array
-
get_L
() → numpy.array¶ get the graph Laplacian L
- Returns
graph Laplacian L
- Return type
np.array
-
get_W
() → numpy.array¶ get the weighted adjacency matrix W
- Returns
weighted adjacency matrix W
- Return type
np.array
-
get_edge_list
() → List[cluster.graph.Edge.Edge]¶ get all edges of the graph
- Returns
list of edges
- Return type
list(Edge)