public class SetHypergraph<V,H> extends Object implements Hypergraph<V,H>, MultiGraph<V,H>, Serializable
Hypergraph that is suitable for sparse graphs and
permits parallel edges.| Modifier and Type | Field and Description |
|---|---|
protected Map<H,Set<V>> |
edges |
protected Map<V,Set<H>> |
vertices |
| Constructor and Description |
|---|
SetHypergraph()
Creates a
SetHypergraph and initializes the internal data structures. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addEdge(H hyperedge,
Collection<? extends V> to_attach)
Adds
hyperedge to this graph and connects them to the vertex collection to_attach. |
boolean |
addEdge(H hyperedge,
Collection<? extends V> to_attach,
EdgeType edge_type) |
boolean |
addVertex(V vertex) |
boolean |
containsEdge(H edge) |
boolean |
containsVertex(V vertex) |
int |
degree(V vertex) |
H |
findEdge(V v1,
V v2) |
Collection<H> |
findEdgeSet(V v1,
V v2) |
EdgeType |
getDefaultEdgeType() |
V |
getDest(H directed_edge) |
int |
getEdgeCount() |
int |
getEdgeCount(EdgeType edge_type) |
Collection<H> |
getEdges() |
Collection<H> |
getEdges(EdgeType edge_type) |
EdgeType |
getEdgeType(H edge) |
static <V,H> com.google.common.base.Supplier<Hypergraph<V,H>> |
getFactory()
Returns a
Factory which creates instances of this class. |
int |
getIncidentCount(H edge) |
Collection<H> |
getIncidentEdges(V vertex) |
Collection<V> |
getIncidentVertices(H edge) |
Collection<H> |
getInEdges(V vertex) |
int |
getNeighborCount(V vertex) |
Collection<V> |
getNeighbors(V vertex) |
Collection<H> |
getOutEdges(V vertex) |
Collection<V> |
getPredecessors(V vertex) |
V |
getSource(H directed_edge) |
Collection<V> |
getSuccessors(V vertex) |
int |
getVertexCount() |
Collection<V> |
getVertices() |
int |
inDegree(V vertex) |
boolean |
isIncident(V vertex,
H edge) |
boolean |
isNeighbor(V v1,
V v2) |
int |
outDegree(V vertex) |
boolean |
removeEdge(H hyperedge) |
boolean |
removeVertex(V vertex) |
public SetHypergraph()
SetHypergraph and initializes the internal data structures.public static <V,H> com.google.common.base.Supplier<Hypergraph<V,H>> getFactory()
Factory which creates instances of this class.V - vertex type of the hypergraph to be createdH - edge type of the hypergraph to be createdFactory which creates instances of this classpublic boolean addEdge(H hyperedge, Collection<? extends V> to_attach)
hyperedge to this graph and connects them to the vertex collection to_attach.
Any vertices in to_attach that appear more than once will only appear once in the
incident vertex collection for hyperedge, that is, duplicates will be ignored.addEdge in interface Hypergraph<V,H>Hypergraph.addEdge(Object, Collection)public boolean addEdge(H hyperedge, Collection<? extends V> to_attach, EdgeType edge_type)
addEdge in interface Hypergraph<V,H>Hypergraph.addEdge(Object, Collection, EdgeType)public EdgeType getEdgeType(H edge)
getEdgeType in interface Hypergraph<V,H>Hypergraph.getEdgeType(Object)public boolean containsVertex(V vertex)
containsVertex in interface Hypergraph<V,H>public boolean containsEdge(H edge)
containsEdge in interface Hypergraph<V,H>public Collection<H> getEdges()
getEdges in interface Hypergraph<V,H>public Collection<V> getVertices()
getVertices in interface Hypergraph<V,H>public int getEdgeCount()
getEdgeCount in interface Hypergraph<V,H>public int getVertexCount()
getVertexCount in interface Hypergraph<V,H>public Collection<V> getNeighbors(V vertex)
getNeighbors in interface Hypergraph<V,H>public Collection<H> getIncidentEdges(V vertex)
getIncidentEdges in interface Hypergraph<V,H>public Collection<V> getIncidentVertices(H edge)
getIncidentVertices in interface Hypergraph<V,H>public Collection<H> findEdgeSet(V v1, V v2)
findEdgeSet in interface Hypergraph<V,H>public boolean addVertex(V vertex)
addVertex in interface Hypergraph<V,H>public boolean removeVertex(V vertex)
removeVertex in interface Hypergraph<V,H>public boolean removeEdge(H hyperedge)
removeEdge in interface Hypergraph<V,H>public boolean isNeighbor(V v1, V v2)
isNeighbor in interface Hypergraph<V,H>public boolean isIncident(V vertex, H edge)
isIncident in interface Hypergraph<V,H>public int degree(V vertex)
degree in interface Hypergraph<V,H>public int getNeighborCount(V vertex)
getNeighborCount in interface Hypergraph<V,H>public int getIncidentCount(H edge)
getIncidentCount in interface Hypergraph<V,H>public int getEdgeCount(EdgeType edge_type)
getEdgeCount in interface Hypergraph<V,H>public Collection<H> getEdges(EdgeType edge_type)
getEdges in interface Hypergraph<V,H>public EdgeType getDefaultEdgeType()
getDefaultEdgeType in interface Hypergraph<V,H>public Collection<H> getInEdges(V vertex)
getInEdges in interface Hypergraph<V,H>public Collection<H> getOutEdges(V vertex)
getOutEdges in interface Hypergraph<V,H>public int inDegree(V vertex)
inDegree in interface Hypergraph<V,H>public int outDegree(V vertex)
outDegree in interface Hypergraph<V,H>public Collection<V> getPredecessors(V vertex)
getPredecessors in interface Hypergraph<V,H>public Collection<V> getSuccessors(V vertex)
getSuccessors in interface Hypergraph<V,H>Copyright © 2016. All rights reserved.