Class ConnectivityMeasure
java.lang.Object
org.graphstream.algorithm.measure.ConnectivityMeasure
public class ConnectivityMeasure extends Object
Get the vertex-connectivity of a graph.
A graph is said to be k-vertex-connected (or k-connected) if the graph
remains connected when you delete fewer than k vertices from the graph (from
Wikipedia).
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ConnectivityMeasure.EdgeConnectivityMeasure
static class
ConnectivityMeasure.VertexConnectivityMeasure
-
Constructor Summary
Constructors Constructor Description ConnectivityMeasure()
-
Method Summary
Modifier and Type Method Description static int
getEdgeConnectivity(org.graphstream.graph.Graph g)
Get the edge-connectivity k of a graph such that there is a k-tuple of edges whose removal disconnects the graph.static org.graphstream.graph.Edge[]
getKDisconnectingEdgeTuple(org.graphstream.graph.Graph g, int k)
Get a k-tuple of edges whose removal causes the disconnection of the graph.static org.graphstream.graph.Node[]
getKDisconnectingNodeTuple(org.graphstream.graph.Graph g, int k)
Get a k-tuple of nodes whose removal causes the disconnection of the graph.static int
getVertexConnectivity(org.graphstream.graph.Graph g)
Get the vertex-connectivity k of a graph such that there is a k-tuple of nodes whose removal disconnects the graph.static boolean
isKEdgeConnected(org.graphstream.graph.Graph g, int k)
Check if a graph is k-edge-connected, ie. there is no (k-1)-edge-tuple such that the removal of these edges leads to disconnect the graph.static boolean
isKVertexConnected(org.graphstream.graph.Graph g, int k)
Check if a graph is k-vertex-connected, ie. there is no (k-1)-node-tuple such that the removal of these nodes leads to disconnect the graph.
-
Constructor Details
-
ConnectivityMeasure
public ConnectivityMeasure()
-
-
Method Details
-
getVertexConnectivity
public static int getVertexConnectivity(org.graphstream.graph.Graph g)Get the vertex-connectivity k of a graph such that there is a k-tuple of nodes whose removal disconnects the graph.- Parameters:
g
- the graph- Returns:
- vertex connectivity
-
getEdgeConnectivity
public static int getEdgeConnectivity(org.graphstream.graph.Graph g)Get the edge-connectivity k of a graph such that there is a k-tuple of edges whose removal disconnects the graph. This uses the Ford-Fulkerson algorithm to compute maximum flows in the graph. A simple algorithm would, for every pair (u,v), determine the maximum flow from u to v with the capacity of all edges in G set to 1 for both directions. A graph is k-edge-connected if and only if the maximum flow from u to v is at least k for any pair (u,v), so k is the least u-v-flow among all (u,v). Source Wikipedia.- Parameters:
g
- the graph- Returns:
- edge connectivity
-
isKVertexConnected
public static boolean isKVertexConnected(org.graphstream.graph.Graph g, int k)Check if a graph is k-vertex-connected, ie. there is no (k-1)-node-tuple such that the removal of these nodes leads to disconnect the graph.- Parameters:
g
- the graphk
- connectivity being checked- Returns:
- true if g is k-vertex-connected
-
isKEdgeConnected
public static boolean isKEdgeConnected(org.graphstream.graph.Graph g, int k)Check if a graph is k-edge-connected, ie. there is no (k-1)-edge-tuple such that the removal of these edges leads to disconnect the graph.- Parameters:
g
- the graphk
- connectivity being checked- Returns:
- true if g is k-edge-connected
-
getKDisconnectingNodeTuple
public static org.graphstream.graph.Node[] getKDisconnectingNodeTuple(org.graphstream.graph.Graph g, int k)Get a k-tuple of nodes whose removal causes the disconnection of the graph.- Parameters:
g
- the graphk
- max size of the required tuple- Returns:
- a k-tuple of nodes or null if graph is (k+1)-vertex-connected
-
getKDisconnectingEdgeTuple
public static org.graphstream.graph.Edge[] getKDisconnectingEdgeTuple(org.graphstream.graph.Graph g, int k)Get a k-tuple of edges whose removal causes the disconnection of the graph.- Parameters:
g
- the graphk
- max size of the required tuple- Returns:
- a k-tuple of edges or null if graph is (k+1)-edge-connected
-