concepts.benchmark.algorithm_env.graph.Graph#
- class Graph[source]#
Bases:
object
Store a graph using adjacency matrix.
Methods
get_connectivity
([k, exclude_self])Return the k-connectivity for each pair of nodes.
Get the coordinates of the nodes.
Get the adjacency matrix of the graph.
Return the out degree of each node.
Return edges and identity matrix.
Return the length of shortest path between nodes.
has_edge
(x, y)Return whether there is an edge from node x to node y.
- __new__(**kwargs)#
- get_connectivity(k=None, exclude_self=True)[source]#
Return the k-connectivity for each pair of nodes. It will return the full connectivity matrix if k is None or k < 0. When exclude_self is True, the diagonal elements will be 0.