public class Hypergraph
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Hypergraph.Hyperedge |
| Modifier and Type | Field and Description |
|---|---|
MathSet<Hypergraph.Hyperedge> |
m_edges
The set of hyperedges of the graph
|
protected int |
m_vertexId
A counter for vertex IDs for this graph
|
MathSet<java.lang.Integer> |
m_vertices
The set of vertices of the graph
|
| Constructor and Description |
|---|
Hypergraph()
Creates a new empty hypergraph
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEdge(Hypergraph.Hyperedge e)
Adds a hyperedge to the hypergraph
|
int |
getEdgeCount()
Gets the number of hyperedges in the graph
|
int |
getVertexCount()
Gets the number of vertices in the graph
|
int |
newVertex()
Gets the ID of the next new vertex in this graph
|
static Hypergraph |
parse(java.util.Scanner scanner)
Creates a hypergraph from a stream of characters.
|
static Hypergraph |
parse(java.lang.String s)
Creates a hypergraph from a character string.
|
java.lang.String |
toString() |
public MathSet<Hypergraph.Hyperedge> m_edges
public MathSet<java.lang.Integer> m_vertices
protected int m_vertexId
public void addEdge(Hypergraph.Hyperedge e)
e - The hyperedgepublic int newVertex()
public java.lang.String toString()
toString in class java.lang.Objectpublic int getEdgeCount()
public int getVertexCount()
public static Hypergraph parse(java.lang.String s)
s - The stringparse(Scanner)public static Hypergraph parse(java.util.Scanner scanner)
# Empty lines and lines that start with '#' are ignored # The remaining lines should contain a comma-separated list of # vertex numbers (integers) 0,1,2,3 1,2,4 2,3,6,1 ...
s - The string, formatted as specified aboveCopyright © Sylvain Hallé. All Rights Reserved.