Class EdgeCut

java.lang.Object
org.graph4j.connectivity.EdgeCut

public class EdgeCut extends Object
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 Details

    • EdgeCut

      public EdgeCut(Graph graph)
      Creates an empty edge cut.
      Parameters:
      graph - the graph the cut belongs to.
    • EdgeCut

      public EdgeCut(Graph graph, int[] leftSide, Double weight)
      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, or null.
    • EdgeCut

      public EdgeCut(Graph graph, EdgeSet edges, Double weight)
      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, or null.
  • 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

      public EdgeSet 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:
      true if the cut is valid, false otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object