

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object edu.uci.ics.jung.graph.AbstractGraph<V,E> edu.uci.ics.jung.graph.AbstractTypedGraph<V,E> edu.uci.ics.jung.graph.OrderedKAryTree<V,E>
public class OrderedKAryTree<V,E>
An implementation of Tree
in which each vertex has
<= k children. The value of 'k' is specified by the constructor
parameter. A specific child (edge) can be retrieved directly by specifying the
index at which the child is located. By default, new (child) vertices
are added at the lowest index available, if no index is specified.
Nested Class Summary  

protected class 
OrderedKAryTree.VertexData

Field Summary  

protected Map<E,Pair<V>> 
edge_vpairs

protected int 
height

protected int 
order

protected V 
root

protected Map<V,OrderedKAryTree.VertexData> 
vertex_data

Fields inherited from class edu.uci.ics.jung.graph.AbstractTypedGraph 

edge_type 
Constructor Summary  

OrderedKAryTree(int order)
Creates a new instance with the specified order (maximum number of children). 
Method Summary  

boolean 
addEdge(E edge,
Collection<? extends V> vertices,
EdgeType edge_type)
Adds edge to this graph with type edge_type . 

boolean 
addEdge(E edge,
Pair<? extends V> endpoints,
EdgeType edgeType)
Adds edge to this graph with the specified endpoints
and EdgeType . 

boolean 
addEdge(E e,
V parent,
V child)
Adds edge e to this graph such that it connects
vertex v1 to v2 . 

boolean 
addEdge(E e,
V v1,
V v2,
EdgeType edge_type)
Adds edge e to this graph such that it connects
vertex v1 to v2 . 

boolean 
addEdge(E e,
V parent,
V child,
int index)
Adds the specified child vertex and edge e to the graph
with the specified parent vertex parent . 

boolean 
addVertex(V vertex)
Adds vertex to this graph. 

boolean 
containsEdge(E edge)
Returns true if this graph's edge collection contains edge . 

boolean 
containsVertex(V vertex)
Returns true if this graph's vertex collection contains vertex . 

E 
findEdge(V v1,
V v2)
Returns an edge that connects this vertex to v . 

Collection<E> 
findEdgeSet(V v1,
V v2)
Returns all edges that connects this vertex to v . 

V 
getChild(V vertex,
int index)
Returns the child of vertex at position index
in this tree, or null if it has no child at that position. 

int 
getChildCount(V vertex)
Returns the number of children that vertex has in this tree. 

E 
getChildEdge(V vertex,
int index)
Returns the child edge of the vertex at index index . 

Collection<E> 
getChildEdges(V vertex)
Returns the edges connecting vertex to its children
in this tree. 

Collection<V> 
getChildren(V vertex)
Returns the children of vertex in this tree. 

int 
getDepth(V vertex)
Returns the (unweighted) distance of vertex
from the root of this tree. 

V 
getDest(E directed_edge)
If directed_edge is a directed edge in this graph, returns the destination;
otherwise returns null . 

int 
getEdgeCount()
Returns the number of edges in this graph. 

Collection<E> 
getEdges()
Returns a view of all edges in this graph. 

Pair<V> 
getEndpoints(E edge)
Returns the endpoints of edge as a Pair . 

static

getFactory(int order)
Returns a Factory that creates an instance of this graph type. 

int 
getHeight()
Returns the height of the tree, or 1 if the tree is empty. 

int 
getIncidentCount(E edge)
Returns the number of vertices that are incident to edge . 

Collection<E> 
getIncidentEdges(V vertex)
Returns the collection of edges in this graph which are connected to vertex . 

Collection<V> 
getIncidentVertices(E edge)
Returns the collection of vertices in this graph which are connected to edge . 

Collection<E> 
getInEdges(V vertex)
Returns a Collection view of the incoming edges incident to vertex
in this graph. 

int 
getNeighborCount(V vertex)
Returns the number of vertices that are adjacent to vertex
(that is, the number of vertices that are incident to edges in vertex 's
incident edge set). 

Collection<V> 
getNeighbors(V vertex)
Returns the collection of vertices which are connected to vertex
via any edges in this graph. 

V 
getOpposite(V vertex,
E edge)
Returns the vertex at the other end of edge from vertex . 

Collection<E> 
getOutEdges(V vertex)
Returns a Collection view of the outgoing edges incident to vertex
in this graph. 

V 
getParent(V vertex)
Returns the parent of vertex in this tree. 

E 
getParentEdge(V vertex)
Returns the edge connecting vertex to its parent in
this tree. 

int 
getPredecessorCount(V vertex)
Returns the number of predecessors that vertex has in this graph. 

Collection<V> 
getPredecessors(V vertex)
Returns a Collection view of the predecessors of vertex
in this graph. 

V 
getRoot()
Returns the root of this tree. 

V 
getSource(E directed_edge)
If directed_edge is a directed edge in this graph, returns the source;
otherwise returns null . 

int 
getSuccessorCount(V vertex)
Returns the number of successors that vertex has in this graph. 

Collection<V> 
getSuccessors(V vertex)
Returns a Collection view of the successors of vertex
in this graph. 

Collection<Tree<V,E>> 
getTrees()
Returns a view of this graph as a collection of Tree instances. 

int 
getVertexCount()
Returns the number of vertices in this graph. 

Collection<V> 
getVertices()
Returns a view of all vertices in this graph. 

int 
inDegree(V vertex)
Returns the number of incoming edges incident to vertex . 

boolean 
isDest(V vertex,
E edge)
Returns true if vertex is the destination of edge . 

boolean 
isIncident(V vertex,
E edge)
Returns true if vertex and edge
are incident to each other. 

boolean 
isLeaf(V vertex)
Returns true if vertex is a leaf of this tree,
i.e., if it has no children. 

boolean 
isNeighbor(V v1,
V v2)
Returns true if v1 and v2 share an incident edge. 

boolean 
isPredecessor(V v1,
V v2)
Returns true iff v1 is the parent of v2 . 

boolean 
isRoot(V vertex)
Returns true if vertex is a leaf of this tree,
i.e., if it has no children. 

boolean 
isSource(V vertex,
E edge)
Returns true if vertex is the source of edge . 

boolean 
isSuccessor(V v1,
V v2)
Returns true if v1 is a successor of v2 in this graph. 

int 
outDegree(V vertex)
Returns the number of outgoing edges incident to vertex . 

boolean 
removeEdge(E edge)
Removes edge from this graph. 

boolean 
removeVertex(V vertex)
Removes vertex from this graph. 
Methods inherited from class edu.uci.ics.jung.graph.AbstractTypedGraph 

getDefaultEdgeType, getEdgeCount, getEdges, getEdgeType, hasEqualEdgeType, validateEdgeType 
Methods inherited from class edu.uci.ics.jung.graph.AbstractGraph 

addEdge, addEdge, degree, getValidatedEndpoints, toString 
Methods inherited from class java.lang.Object 

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 
Methods inherited from interface edu.uci.ics.jung.graph.Hypergraph 

addEdge, degree, getDefaultEdgeType, getEdgeCount, getEdges, getEdgeType 
Field Detail 

protected Map<E,Pair<V>> edge_vpairs
protected Map<V,OrderedKAryTree.VertexData> vertex_data
protected int height
protected V root
protected int order
Constructor Detail 

public OrderedKAryTree(int order)
Method Detail 

public static <V,E> org.apache.commons.collections15.Factory<DirectedGraph<V,E>> getFactory(int order)
Factory
that creates an instance of this graph type.
V
 the vertex type for the graph factoryE
 the edge type for the graph factorypublic int getChildCount(V vertex)
Forest
vertex
has in this tree.
The children of a vertex are defined as being the successors of
that vertex on the respective (unique) shortest paths from the root to
those vertices.
This is syntactic (maple) sugar for getSuccessorCount(vertex)
.
getChildCount
in interface Forest<V,E>
vertex
 the vertex whose child edges are to be returned
Collection
of edges connecting
vertex
to its children in this treeForest.getChildCount(java.lang.Object)
public E getChildEdge(V vertex, int index)
index
.
vertex
 index

index
public Collection<E> getChildEdges(V vertex)
Forest
vertex
to its children
in this tree.
The children of a vertex are defined as being the successors of
that vertex on the respective (unique) shortest paths from the root to
those vertices.
This is syntactic (maple) sugar for getOutEdges(vertex)
.
getChildEdges
in interface Forest<V,E>
vertex
 the vertex whose child edges are to be returned
Collection
of edges connecting
vertex
to its children in this treeForest.getChildEdges(java.lang.Object)
public Collection<V> getChildren(V vertex)
Forest
vertex
in this tree.
The children of a vertex are defined as being the successors of
that vertex on the respective (unique) shortest paths from the root to
those vertices.
This is syntactic (maple) sugar for getSuccessors(vertex)
.
getChildren
in interface Forest<V,E>
vertex
 the vertex whose children are to be returned
Collection
of children of vertex
in this treeForest.getChildren(java.lang.Object)
public int getDepth(V vertex)
Tree
vertex
from the root of this tree.
getDepth
in interface Tree<V,E>
vertex
 the vertex whose depth is to be returned.
Tree.getDepth(java.lang.Object)
public int getHeight()
getHeight
in interface Tree<V,E>
Tree.getHeight()
public V getParent(V vertex)
Forest
vertex
in this tree.
(If vertex
is the root, returns null
.)
The parent of a vertex is defined as being its predecessor in the
(unique) shortest path from the root to this vertex.
This is a convenience method which is equivalent to
Graph.getPredecessors(vertex).iterator().next()
.
getParent
in interface Forest<V,E>
vertex
in this treeForest.getParent(java.lang.Object)
public E getParentEdge(V vertex)
Forest
vertex
to its parent in
this tree.
(If vertex
is the root, returns null
.)
The parent of a vertex is defined as being its predecessor in the
(unique) shortest path from the root to this vertex.
This is a convenience method which is equivalent to
Graph.getInEdges(vertex).iterator().next()
,
and also to Graph.findEdge(vertex, getParent(vertex))
.
getParentEdge
in interface Forest<V,E>
vertex
to its parent, or
null
if vertex
is the rootForest.getParentEdge(java.lang.Object)
public V getRoot()
Tree
getRoot
in interface Tree<V,E>
Tree.getRoot()
public Collection<Tree<V,E>> getTrees()
Forest
Tree
instances.
getTrees
in interface Forest<V,E>
Tree
sForest.getTrees()
public boolean addEdge(E e, V parent, V child, int index)
child
vertex and edge e
to the graph
with the specified parent vertex parent
. If index
is
greater than or equal to 0, then the child is placed at position
index
; if it is less than 0, the child is placed at the lowest
available position; if it is greater than or equal to the order of this
tree, an exception is thrown.
Graph.addEdge(java.lang.Object, java.lang.Object, java.lang.Object)
public boolean addEdge(E e, V parent, V child)
Graph
e
to this graph such that it connects
vertex v1
to v2
.
Equivalent to addEdge(e, new Pair(v1, v2))
.
If this graph does not contain v1
, v2
,
or both, implementations may choose to either silently add
the vertices to the graph or throw an IllegalArgumentException
.
If this graph assigns edge types to its edges, the edge type of
e
will be the default for this graph.
See Hypergraph.addEdge()
for a listing of possible reasons
for failure.
addEdge
in interface Graph<V,E>
addEdge
in class AbstractGraph<V,E>
e
 the edge to be addedparent
 the first vertex to be connectedchild
 the second vertex to be connected
true
if the add is successful, false
otherwiseGraph.addEdge(java.lang.Object, java.lang.Object, java.lang.Object)
public boolean addEdge(E e, V v1, V v2, EdgeType edge_type)
Graph
e
to this graph such that it connects
vertex v1
to v2
.
Equivalent to addEdge(e, new Pair(v1, v2))
.
If this graph does not contain v1
, v2
,
or both, implementations may choose to either silently add
the vertices to the graph or throw an IllegalArgumentException
.
If edgeType
is not legal for this graph, this method will
throw IllegalArgumentException
.
See Hypergraph.addEdge()
for a listing of possible reasons
for failure.
addEdge
in interface Graph<V,E>
addEdge
in class AbstractGraph<V,E>
e
 the edge to be addedv1
 the first vertex to be connectedv2
 the second vertex to be connectededge_type
 the type to be assigned to the edge
true
if the add is successful, false
otherwiseGraph.addEdge(java.lang.Object, java.lang.Object, java.lang.Object, edu.uci.ics.jung.graph.util.EdgeType)
public V getDest(E directed_edge)
Graph
directed_edge
is a directed edge in this graph, returns the destination;
otherwise returns null
.
The destination of a directed edge d
is defined to be the vertex
incident to d
for which
d
is an incoming edge.
directed_edge
is guaranteed to be a directed edge if
its EdgeType
is DIRECTED
.
getDest
in interface Graph<V,E>
getDest
in interface Hypergraph<V,E>
directed_edge
if it is a directed edge in this graph, or null
otherwiseGraph.getDest(java.lang.Object)
public Pair<V> getEndpoints(E edge)
Graph
edge
as a Pair
.
getEndpoints
in interface Graph<V,E>
edge
 the edge whose endpoints are to be returned
edge
Graph.getEndpoints(java.lang.Object)
public Collection<E> getInEdges(V vertex)
Graph
Collection
view of the incoming edges incident to vertex
in this graph.
getInEdges
in interface Graph<V,E>
getInEdges
in interface Hypergraph<V,E>
vertex
 the vertex whose incoming edges are to be returned
Collection
view of the incoming edges incident
to vertex
in this graphGraph.getInEdges(java.lang.Object)
public V getOpposite(V vertex, E edge)
Graph
edge
from vertex
.
(That is, returns the vertex incident to edge
which is not vertex
.)
getOpposite
in interface Graph<V,E>
getOpposite
in class AbstractGraph<V,E>
vertex
 the vertex to be queriededge
 the edge to be queried
edge
from vertex
Graph.getOpposite(java.lang.Object, java.lang.Object)
public Collection<E> getOutEdges(V vertex)
Graph
Collection
view of the outgoing edges incident to vertex
in this graph.
getOutEdges
in interface Graph<V,E>
getOutEdges
in interface Hypergraph<V,E>
vertex
 the vertex whose outgoing edges are to be returned
Collection
view of the outgoing edges incident
to vertex
in this graphGraph.getOutEdges(java.lang.Object)
public int getPredecessorCount(V vertex)
Graph
vertex
has in this graph.
Equivalent to vertex.getPredecessors().size()
.
getPredecessorCount
in interface Graph<V,E>
getPredecessorCount
in class AbstractGraph<V,E>
vertex
 the vertex whose predecessor count is to be returned
vertex
is the root, 1 if the vertex is
not an element of this tree, and 1 otherwiseGraph.getPredecessorCount(java.lang.Object)
public Collection<V> getPredecessors(V vertex)
Graph
Collection
view of the predecessors of vertex
in this graph. A predecessor of vertex
is defined as a vertex v
which is connected to
vertex
by an edge e
, where e
is an outgoing edge of
v
and an incoming edge of vertex
.
getPredecessors
in interface Graph<V,E>
getPredecessors
in interface Hypergraph<V,E>
vertex
 the vertex whose predecessors are to be returned
Collection
view of the predecessors of
vertex
in this graphGraph.getPredecessors(java.lang.Object)
public V getSource(E directed_edge)
Graph
directed_edge
is a directed edge in this graph, returns the source;
otherwise returns null
.
The source of a directed edge d
is defined to be the vertex for which
d
is an outgoing edge.
directed_edge
is guaranteed to be a directed edge if
its EdgeType
is DIRECTED
.
getSource
in interface Graph<V,E>
getSource
in interface Hypergraph<V,E>
directed_edge
if it is a directed edge in this graph, or null
otherwiseGraph.getSource(java.lang.Object)
public int getSuccessorCount(V vertex)
Graph
vertex
has in this graph.
Equivalent to vertex.getSuccessors().size()
.
getSuccessorCount
in interface Graph<V,E>
getSuccessorCount
in class AbstractGraph<V,E>
vertex
 the vertex whose successor count is to be returned
vertex
has in this graphGraph.getSuccessorCount(java.lang.Object)
public Collection<V> getSuccessors(V vertex)
Graph
Collection
view of the successors of vertex
in this graph. A successor of vertex
is defined as a vertex v
which is connected to
vertex
by an edge e
, where e
is an incoming edge of
v
and an outgoing edge of vertex
.
getSuccessors
in interface Graph<V,E>
getSuccessors
in interface Hypergraph<V,E>
vertex
 the vertex whose predecessors are to be returned
Collection
view of the successors of
vertex
in this graphGraph.getSuccessors(java.lang.Object)
public int inDegree(V vertex)
Graph
vertex
.
Equivalent to getInEdges(vertex).size()
.
inDegree
in interface Graph<V,E>
inDegree
in interface Hypergraph<V,E>
inDegree
in class AbstractGraph<V,E>
vertex
 the vertex whose indegree is to be calculated
vertex
Graph.inDegree(java.lang.Object)
public boolean isDest(V vertex, E edge)
Graph
true
if vertex
is the destination of edge
.
Equivalent to getDest(edge).equals(vertex)
.
isDest
in interface Graph<V,E>
vertex
 the vertex to be queriededge
 the edge to be queried
true
iff vertex
is the destination of edge
Graph.isDest(java.lang.Object, java.lang.Object)
public boolean isLeaf(V vertex)
true
if vertex
is a leaf of this tree,
i.e., if it has no children.
vertex
 the vertex to be queried
true
if outDegree(vertex)==0
public boolean isPredecessor(V v1, V v2)
v1
is the parent of v2
.
Note that if v2
is the root and v1
is null
,
this method returns true
.
isPredecessor
in interface Graph<V,E>
isPredecessor
in class AbstractGraph<V,E>
v1
 the first vertex to be queriedv2
 the second vertex to be queried
true
if v1
is a predecessor of v2
, and false otherwise.Graph.isPredecessor(java.lang.Object, java.lang.Object)
public boolean isRoot(V vertex)
true
if vertex
is a leaf of this tree,
i.e., if it has no children.
vertex
 the vertex to be queried
true
if outDegree(vertex)==0
public boolean isSource(V vertex, E edge)
Graph
true
if vertex
is the source of edge
.
Equivalent to getSource(edge).equals(vertex)
.
isSource
in interface Graph<V,E>
vertex
 the vertex to be queriededge
 the edge to be queried
true
iff vertex
is the source of edge
Graph.isSource(java.lang.Object, java.lang.Object)
public boolean isSuccessor(V v1, V v2)
Graph
true
if v1
is a successor of v2
in this graph.
Equivalent to v1.getSuccessors().contains(v2)
.
isSuccessor
in interface Graph<V,E>
isSuccessor
in class AbstractGraph<V,E>
v1
 the first vertex to be queriedv2
 the second vertex to be queried
true
if v1
is a successor of v2
, and false otherwise.Graph.isSuccessor(java.lang.Object, java.lang.Object)
public int outDegree(V vertex)
Graph
vertex
.
Equivalent to getOutEdges(vertex).size()
.
outDegree
in interface Graph<V,E>
outDegree
in interface Hypergraph<V,E>
outDegree
in class AbstractGraph<V,E>
vertex
 the vertex whose outdegree is to be calculated
vertex
Graph.outDegree(java.lang.Object)
public boolean addEdge(E edge, Collection<? extends V> vertices, EdgeType edge_type)
Hypergraph
edge
to this graph with type edge_type
.
Fails under the following circumstances:
edge
is already an element of the graph
edge
or vertices
is null
vertices
has the wrong number of vertices for the graph type
vertices
are already connected by another edge in this graph,
and this graph does not accept parallel edges
edge_type
is not legal for this graph
addEdge
in interface Hypergraph<V,E>
addEdge
in class AbstractGraph<V,E>
true
if the add is successful, and false
otherwiseHypergraph.addEdge(java.lang.Object, java.util.Collection)
public boolean addVertex(V vertex)
Hypergraph
vertex
to this graph.
Fails if vertex
is null or already in the graph.
addVertex
in interface Hypergraph<V,E>
vertex
 the vertex to add
true
if the add is successful, and false
otherwiseHypergraph.addVertex(java.lang.Object)
public boolean isIncident(V vertex, E edge)
Hypergraph
true
if vertex
and edge
are incident to each other.
Equivalent to getIncidentEdges(vertex).contains(edge)
and to
getIncidentVertices(edge).contains(vertex)
.
isIncident
in interface Hypergraph<V,E>
isIncident
in class AbstractGraph<V,E>
true
if vertex
and edge
are incident to each otherHypergraph.isIncident(java.lang.Object, java.lang.Object)
public boolean isNeighbor(V v1, V v2)
Hypergraph
true
if v1
and v2
share an incident edge.
Equivalent to getNeighbors(v1).contains(v2)
.
isNeighbor
in interface Hypergraph<V,E>
isNeighbor
in class AbstractGraph<V,E>
v1
 the first vertex to testv2
 the second vertex to test
true
if v1
and v2
share an incident edgeHypergraph.isNeighbor(java.lang.Object, java.lang.Object)
public boolean containsEdge(E edge)
Hypergraph
edge
.
Equivalent to getEdges().contains(edge)
.
containsEdge
in interface Hypergraph<V,E>
edge
 the edge whose presence is being queried
edge
Hypergraph.containsEdge(java.lang.Object)
public boolean containsVertex(V vertex)
Hypergraph
vertex
.
Equivalent to getVertices().contains(vertex)
.
containsVertex
in interface Hypergraph<V,E>
vertex
 the vertex whose presence is being queried
vertex
Hypergraph.containsVertex(java.lang.Object)
public E findEdge(V v1, V v2)
Hypergraph
v
.
If this edge is not uniquely
defined (that is, if the graph contains more than one edge connecting
v1
to v2
), any of these edges
may be returned. findEdgeSet(v1, v2)
may be
used to return all such edges.
Returns null if either of the following is true:
v2
is not connected to v1
v1
or v2
are not present in this graph
Note: for purposes of this method, v1
is only considered to be connected to
v2
via a given directed edge e
if
v1 == e.getSource() && v2 == e.getDest()
evaluates to true
.
(v1
and v2
are connected by an undirected edge u
if
u
is incident to both v1
and v2
.)
findEdge
in interface Hypergraph<V,E>
findEdge
in class AbstractGraph<V,E>
v1
to v2
,
or null
if no such edge exists (or either vertex is not present)Hypergraph.findEdge(java.lang.Object, java.lang.Object)
public Collection<E> findEdgeSet(V v1, V v2)
Hypergraph
v
.
If this edge is not uniquely
defined (that is, if the graph contains more than one edge connecting
v1
to v2
), any of these edges
may be returned. findEdgeSet(v1, v2)
may be
used to return all such edges.
Returns null if v2
is not connected to v1
.
v1
or v2
are not present in this graph.
Note: for purposes of this method, v1
is only considered to be connected to
v2
via a given directed edge d
if
v1 == d.getSource() && v2 == d.getDest()
evaluates to true
.
(v1
and v2
are connected by an undirected edge u
if
u
is incident to both v1
and v2
.)
findEdgeSet
in interface Hypergraph<V,E>
findEdgeSet
in class AbstractGraph<V,E>
v1
to v2
,
or null
if either vertex is not presentHypergraph.findEdgeSet(java.lang.Object, java.lang.Object)
public V getChild(V vertex, int index)
vertex
at position index
in this tree, or null
if it has no child at that position.
vertex
 the vertex to query
vertex
at position index
in this tree, or null
if it has no child at that position
ArrayIndexOutOfBoundsException
 if index
is not in
the range [0, order1]
public int getEdgeCount()
Hypergraph
getEdgeCount
in interface Hypergraph<V,E>
Hypergraph.getEdgeCount()
public Collection<E> getEdges()
Hypergraph
Collection
contract, and therefore makes no guarantees
about the ordering of the vertices within the set.
getEdges
in interface Hypergraph<V,E>
Collection
view of all edges in this graphHypergraph.getEdges()
public int getIncidentCount(E edge)
Hypergraph
edge
.
For hyperedges, this can be any nonnegative integer; for edges this
must be 2 (or 1 if selfloops are permitted).
Equivalent to getIncidentVertices(edge).size()
.
getIncidentCount
in interface Hypergraph<V,E>
getIncidentCount
in class AbstractGraph<V,E>
edge
 the edge whose incident vertex count is to be returned
edge
.Hypergraph.getIncidentCount(java.lang.Object)
public Collection<E> getIncidentEdges(V vertex)
Hypergraph
vertex
.
getIncidentEdges
in interface Hypergraph<V,E>
vertex
 the vertex whose incident edges are to be returned
vertex
,
or null
if vertex
is not presentHypergraph.getIncidentEdges(java.lang.Object)
public Collection<V> getIncidentVertices(E edge)
Hypergraph
edge
.
Note that for some graph types there are guarantees about the size of this collection
(i.e., some graphs contain edges that have exactly two endpoints, which may or may
not be distinct). Implementations for those graph types may provide alternate methods
that provide more convenient access to the vertices.
getIncidentVertices
in interface Hypergraph<V,E>
getIncidentVertices
in class AbstractGraph<V,E>
edge
 the edge whose incident vertices are to be returned
edge
,
or null
if edge
is not presentHypergraph.getIncidentVertices(java.lang.Object)
public int getNeighborCount(V vertex)
Hypergraph
vertex
(that is, the number of vertices that are incident to edges in vertex
's
incident edge set).
Equivalent to getNeighbors(vertex).size()
.
getNeighborCount
in interface Hypergraph<V,E>
getNeighborCount
in class AbstractGraph<V,E>
vertex
 the vertex whose neighbor count is to be returned
Hypergraph.getNeighborCount(java.lang.Object)
public Collection<V> getNeighbors(V vertex)
Hypergraph
vertex
via any edges in this graph.
If vertex
is connected to itself with a selfloop, then
it will be included in the collection returned.
getNeighbors
in interface Hypergraph<V,E>
vertex
 the vertex whose neighbors are to be returned
vertex
,
or null
if vertex
is not presentHypergraph.getNeighbors(java.lang.Object)
public int getVertexCount()
Hypergraph
getVertexCount
in interface Hypergraph<V,E>
Hypergraph.getVertexCount()
public Collection<V> getVertices()
Hypergraph
Collection
contract, and therefore makes no guarantees
about the ordering of the vertices within the set.
getVertices
in interface Hypergraph<V,E>
Collection
view of all vertices in this graphHypergraph.getVertices()
public boolean removeEdge(E edge)
Hypergraph
edge
from this graph.
Fails if edge
is null, or is otherwise not an element of this graph.
removeEdge
in interface Hypergraph<V,E>
edge
 the edge to remove
true
if the removal is successful, false
otherwiseHypergraph.removeEdge(java.lang.Object)
public boolean removeVertex(V vertex)
Hypergraph
vertex
from this graph.
As a side effect, removes any edges e
incident to vertex
if the
removal of vertex
would cause e
to be incident to an illegal
number of vertices. (Thus, for example, incident hyperedges are not removed, but
incident edgeswhich must be connected to a vertex at both endpointsare removed.)
Fails under the following circumstances:
vertex
is not an element of this graph
vertex
is null
removeVertex
in interface Hypergraph<V,E>
vertex
 the vertex to remove
true
if the removal is successful, false
otherwiseHypergraph.removeVertex(java.lang.Object)
public boolean addEdge(E edge, Pair<? extends V> endpoints, EdgeType edgeType)
AbstractGraph
edge
to this graph with the specified endpoints
and EdgeType
.
addEdge
in class AbstractGraph<V,E>
true iff the graph was modified as a result of this call


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 