-
Notifications
You must be signed in to change notification settings - Fork 4
Connectivity
Ed Scheinerman edited this page May 8, 2022
·
10 revisions
-
is_connected(G): determine if the graph is connected. -
is_tree(G): determine if the graph is a tree. -
num_components(G): number of connected components. -
components(G): partition the vertex set ofGinto its connected components. Returns aPartition(see theSimplePartitionsmodule). -
max_component(G): returns the vertex set of a largest (most vertices) component ofG. -
spanning_forest(G): returns a maximal spanning forest of the graph. -
random_spanning_forest(G): also returns a maximal spanning forest, but may be different each time called. -
is_cut_vertex(G,v): determine ifvis a cut vertex ofG. -
is_cut_edge(G,v,w): determine if{v,w}is a cut edge ofG. Alsois_cut_edge(G,e).
Note: Distance functions give Int values and return -1 (instead of infinity) in case vertices are in different components. So diam(G) returns -1 if the graph is not connected.
-
find_path(G,v,w): find a path between two vertices. -
dist(G,v,w): distance from betweenvandw. -
dist(G,v): list of distances fromvto other vertices. -
dist(G): dictionarydwithd[v,w]giving the distance between the vertices. -
dist_matrix(G): matrix of vertex-vertex distances. -
diam(G): diameter ofG. -
eccentricity(G,v): maximum distance fromvto another vertex. -
radius(G): minimum eccentricity. -
weiner_index(G): Weiner index. -
center(G): set of vertices with minimum eccentricities.
-
bisect(G,...)partitions the vertex set using the eigenvector associated with the second smallest eigenvalue of the graph's Laplacian matrix. Various options are available. -
cross_edges(G,A,B)returns the set of edges with one end inAand the other inB.
The functions connectivity and edge_connectivity are available in the
SimpleGraphAlgorithms
module.