Package org.graph4j.connectivity
Class EdgeCut
java.lang.Object
org.graph4j.connectivity.EdgeCut
Utility class for representing an edge cut. An edge cut is a set of
edges that, if removed, would disconnect the graph.
- Author:
- Cristian Frăsinaru
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionedges()Returns the edges of the cut, whose removal disconnects the graph.booleanisValid()Checks if the cut is valid.int[]leftSide()Returns the vertices in the left side of the cut.int[]Returns the vertices in the right side of the cut.intsize()Returns the number of edges in the cut.toString()doubleweight()Returns the weight of the cut.
-
Constructor Details
-
EdgeCut
Creates an empty edge cut.- Parameters:
graph- the graph the cut belongs to.
-
EdgeCut
Creates a new edge cut.- Parameters:
graph- the graph the cut belongs to.leftSide- the vertices in one side of the cut.weight- the precomputed weight of the cut, ornull.
-
EdgeCut
Creates a new edge cut.- Parameters:
graph- the graph the cut belongs to.edges- the edges in the cut.weight- the precomputed weight of the cut, ornull.
-
-
Method Details
-
leftSide
public int[] leftSide()Returns the vertices in the left side of the cut.- Returns:
- the vertices in the left side of the cut.
-
rightSide
public int[] rightSide()Returns the vertices in the right side of the cut.- Returns:
- the vertices in the right side of the cut.
-
weight
public double weight()Returns the weight of the cut.- Returns:
- the weight of the cut, that is the sum of the weights of the edges in the cut.
-
size
public int size()Returns the number of edges in the cut.- Returns:
- the number of edges in the cut.
-
edges
Returns the edges of the cut, whose removal disconnects the graph.- Returns:
- the edges of the cut.
-
isValid
public boolean isValid()Checks if the cut is valid.- Returns:
trueif the cut is valid,falseotherwise.
-
toString
-