Module fr.univartois.cril.jkahypar
Interface HypergraphBuilder
- All Known Implementing Classes:
AbstractHypergraphBuilder
public interface HypergraphBuilder
The HypergraphBuilder defines an easy and natural interface for building hypergraphs.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Creates the hypergraph built by this builder.static HypergraphBuilderCreates a new HypergraphBuilder for a hypergraph for which the size is unknown.static HypergraphBuildercreateHypergraph(int nbVertices, int nbHyperedges) Creates a new HypergraphBuilder for a hypergraph for which the size is known.long[]Gives the indices at which the vertices of each hyperedge start in the array returned bygetHyperedgeVertices().int[]Gives the vertices of the hyperedges in the hypergraph.intGives the number of hyperedges in the hypergraph.intGives the number of vertices in the hypergraph.withHyperedge(UnweightedHyperedge hyperedge) Adds anUnweightedHyperedgeto the hypergraph.withHyperedge(WeightedHyperedge hyperedge) Adds aWeightedHyperedgeto the hypergraph.withVertexWeight(int vertex, int weight) Sets the weight of a vertex in the hypergraph.
-
Method Details
-
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 usingcreateHypergraph(int, int)for better efficiency.- Returns:
- The created HypergraphBuilder.
- Since:
- 0.2.0
- See Also:
-
createHypergraph
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 usingcreateHypergraph().- 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
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 bygetHyperedgeVertices().- 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
Adds anUnweightedHyperedgeto the hypergraph.- Parameters:
hyperedge- The hyperedge to add.- Returns:
- This builder.
-
withHyperedge
Adds aWeightedHyperedgeto 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.
-