Interface HypergraphBuilder

All Known Implementing Classes:
AbstractHypergraphBuilder

public interface HypergraphBuilder
The HypergraphBuilder defines an easy and natural interface for building hypergraphs.
  • Method Details

    • createHypergraph

      static HypergraphBuilder createHypergraph()
      Creates a new HypergraphBuilder for a hypergraph for which the size is unknown. If you know the size of the hypergraph in advance, prefer using createHypergraph(int, int) for better efficiency.
      Returns:
      The created HypergraphBuilder.
      Since:
      0.2.0
      See Also:
    • createHypergraph

      static HypergraphBuilder createHypergraph(int nbVertices, int nbHyperedges)
      Creates a new HypergraphBuilder for a hypergraph for which the size is known. This method should always be used when the size is known, as it allows to manage internal data structures more efficiently than when using createHypergraph().
      Parameters:
      nbVertices - The number of vertices in the hypergraph.
      nbHyperedges - The number of hyperedges in the hypergraph.
      Returns:
      The created HypergraphBuilder.
    • getNumberOfVertices

      int getNumberOfVertices()
      Gives the number of vertices in the hypergraph.
      Returns:
      The number of vertices.
    • withVertexWeight

      HypergraphBuilder withVertexWeight(int vertex, int weight)
      Sets the weight of a vertex in the hypergraph.
      Parameters:
      vertex - The vertex to set the weight of.
      weight - The weight of the vertex.
      Returns:
      This builder.
    • getNumberOfHyperedges

      int getNumberOfHyperedges()
      Gives the number of hyperedges in the hypergraph.
      Returns:
      The number of hyperedges.
    • getHyperedgeIndices

      long[] getHyperedgeIndices()
      Gives the indices at which the vertices of each hyperedge start in the array returned by getHyperedgeVertices().
      Returns:
      The indices of the vertices for each hyperedge.
      See Also:
    • getHyperedgeVertices

      int[] getHyperedgeVertices()
      Gives the vertices of the hyperedges in the hypergraph.
      Returns:
      The vertices of the different hyperedges.
      See Also:
    • withHyperedge

      HypergraphBuilder withHyperedge(UnweightedHyperedge hyperedge)
      Adds an UnweightedHyperedge to the hypergraph.
      Parameters:
      hyperedge - The hyperedge to add.
      Returns:
      This builder.
    • withHyperedge

      HypergraphBuilder withHyperedge(WeightedHyperedge hyperedge)
      Adds a WeightedHyperedge to the hypergraph.
      Parameters:
      hyperedge - The hyperedge to add.
      Returns:
      This builder.
    • build

      Hypergraph build()
      Creates the hypergraph built by this builder.
      Returns:
      The built hypergraph.