public abstract class AbstractGraph<EdgeType extends AbstractEdge<EdgeType,VertexType>,VertexType extends AbstractVertex<EdgeType,VertexType>> extends java.lang.Object implements Graph<EdgeType,VertexType>
The abstract allocateEdge() method must be implemented.
Graph
,
AbstractEdge
,
AbstractVertex
Constructor and Description |
---|
AbstractGraph() |
Modifier and Type | Method and Description |
---|---|
void |
addVertex(VertexType v)
Add given vertex to the graph.
|
protected abstract EdgeType |
allocateEdge(VertexType source,
VertexType target) |
boolean |
containsVertex(VertexType v)
Determine if the graph contains the given vertex.
|
EdgeType |
createEdge(VertexType source,
VertexType target)
Add a new edge to the graph.
|
java.util.Iterator<EdgeType> |
edgeIterator()
Get Iterator over all edges in the graph.
|
int |
getNumEdgeLabels()
Get the number of numeric labels that have been assigned to edges.
|
int |
getNumEdges()
Get number of edges in the graph.
|
int |
getNumIncomingEdges(VertexType vertex)
Get number of edges going into given vertex.
|
int |
getNumOutgoingEdges(VertexType vertex)
Get number of edges going out of given vertex.
|
int |
getNumVertexLabels()
Get the number of numeric (integer) labels that have been assigned to
vertices in the graph.
|
int |
getNumVertices()
Get number of vertices in the graph.
|
java.util.Iterator<EdgeType> |
incomingEdgeIterator(VertexType target)
Get an Iterator over incoming edges to a given vertex.
|
EdgeType |
lookupEdge(VertexType source,
VertexType target)
Look up an edge by source and target vertex.
|
java.util.Iterator<EdgeType> |
outgoingEdgeIterator(VertexType source)
Get an Iterator over outgoing edges from given vertex.
|
java.util.Iterator<VertexType> |
predecessorIterator(VertexType target)
Get an iterator over the predecessors of this vertex; i.e., the sources
of the vertex's incoming edges.
|
void |
removeEdge(EdgeType edge)
Remove given edge from the graph.
|
void |
removeVertex(VertexType v)
Remove given vertex from the graph.
|
void |
setNumEdgeLabels(int numLabels)
Reset the number of edge labels.
|
void |
setNumVertexLabels(int numLabels)
Reset number of (integer) labels.
|
java.util.Iterator<VertexType> |
successorIterator(VertexType source)
Get an iterator over the successors of this vertex; i.e., the targets of
the vertex's outgoing edges.
|
java.util.Iterator<VertexType> |
vertexIterator()
Get Iterator over all vertices in the graph.
|
java.lang.Iterable<VertexType> |
vertices() |
public int getNumEdges()
Graph
getNumEdges
in interface Graph<EdgeType extends AbstractEdge<EdgeType,VertexType>,VertexType extends AbstractVertex<EdgeType,VertexType>>
public int getNumVertices()
Graph
getNumVertices
in interface Graph<EdgeType extends AbstractEdge<EdgeType,VertexType>,VertexType extends AbstractVertex<EdgeType,VertexType>>
public java.util.Iterator<EdgeType> edgeIterator()
Graph
edgeIterator
in interface Graph<EdgeType extends AbstractEdge<EdgeType,VertexType>,VertexType extends AbstractVertex<EdgeType,VertexType>>
public java.util.Iterator<VertexType> vertexIterator()
Graph
vertexIterator
in interface Graph<EdgeType extends AbstractEdge<EdgeType,VertexType>,VertexType extends AbstractVertex<EdgeType,VertexType>>
public java.lang.Iterable<VertexType> vertices()
public void addVertex(VertexType v)
Graph
addVertex
in interface Graph<EdgeType extends AbstractEdge<EdgeType,VertexType>,VertexType extends AbstractVertex<EdgeType,VertexType>>
v
- the vertex to addpublic boolean containsVertex(VertexType v)
Graph
containsVertex
in interface Graph<EdgeType extends AbstractEdge<EdgeType,VertexType>,VertexType extends AbstractVertex<EdgeType,VertexType>>
v
- the vertexpublic EdgeType createEdge(VertexType source, VertexType target)
Graph
createEdge
in interface Graph<EdgeType extends AbstractEdge<EdgeType,VertexType>,VertexType extends AbstractVertex<EdgeType,VertexType>>
source
- the source vertextarget
- the target vertexpublic EdgeType lookupEdge(VertexType source, VertexType target)
Graph
lookupEdge
in interface Graph<EdgeType extends AbstractEdge<EdgeType,VertexType>,VertexType extends AbstractVertex<EdgeType,VertexType>>
source
- the source vertextarget
- the target vertexpublic int getNumVertexLabels()
Graph
getNumVertexLabels
in interface Graph<EdgeType extends AbstractEdge<EdgeType,VertexType>,VertexType extends AbstractVertex<EdgeType,VertexType>>
public void setNumVertexLabels(int numLabels)
Graph
setNumVertexLabels
in interface Graph<EdgeType extends AbstractEdge<EdgeType,VertexType>,VertexType extends AbstractVertex<EdgeType,VertexType>>
public int getNumEdgeLabels()
Graph
getNumEdgeLabels
in interface Graph<EdgeType extends AbstractEdge<EdgeType,VertexType>,VertexType extends AbstractVertex<EdgeType,VertexType>>
public void setNumEdgeLabels(int numLabels)
Graph
setNumEdgeLabels
in interface Graph<EdgeType extends AbstractEdge<EdgeType,VertexType>,VertexType extends AbstractVertex<EdgeType,VertexType>>
public void removeEdge(EdgeType edge)
Graph
removeEdge
in interface Graph<EdgeType extends AbstractEdge<EdgeType,VertexType>,VertexType extends AbstractVertex<EdgeType,VertexType>>
public void removeVertex(VertexType v)
Graph
removeVertex
in interface Graph<EdgeType extends AbstractEdge<EdgeType,VertexType>,VertexType extends AbstractVertex<EdgeType,VertexType>>
public java.util.Iterator<EdgeType> outgoingEdgeIterator(VertexType source)
Graph
outgoingEdgeIterator
in interface Graph<EdgeType extends AbstractEdge<EdgeType,VertexType>,VertexType extends AbstractVertex<EdgeType,VertexType>>
source
- the source vertexpublic java.util.Iterator<EdgeType> incomingEdgeIterator(VertexType target)
Graph
incomingEdgeIterator
in interface Graph<EdgeType extends AbstractEdge<EdgeType,VertexType>,VertexType extends AbstractVertex<EdgeType,VertexType>>
target
- the target vertexpublic int getNumIncomingEdges(VertexType vertex)
Graph
getNumIncomingEdges
in interface Graph<EdgeType extends AbstractEdge<EdgeType,VertexType>,VertexType extends AbstractVertex<EdgeType,VertexType>>
vertex
- the vertexpublic int getNumOutgoingEdges(VertexType vertex)
Graph
getNumOutgoingEdges
in interface Graph<EdgeType extends AbstractEdge<EdgeType,VertexType>,VertexType extends AbstractVertex<EdgeType,VertexType>>
vertex
- the vertexpublic java.util.Iterator<VertexType> successorIterator(VertexType source)
Graph
successorIterator
in interface Graph<EdgeType extends AbstractEdge<EdgeType,VertexType>,VertexType extends AbstractVertex<EdgeType,VertexType>>
source
- the source vertexpublic java.util.Iterator<VertexType> predecessorIterator(VertexType target)
Graph
predecessorIterator
in interface Graph<EdgeType extends AbstractEdge<EdgeType,VertexType>,VertexType extends AbstractVertex<EdgeType,VertexType>>
target
- the target vertexprotected abstract EdgeType allocateEdge(VertexType source, VertexType target)
FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.