|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectAbstractDirectedGraph
HashDirectedGraph
public class HashDirectedGraph
An implementation of a dirrected graph which stores the nodes and edges in a hash table to allow O(1) testing for inclusion, insertion, removal etc.
Field Summary | |
---|---|
static PrintStream |
STREAM_DEBUG
|
Constructor Summary | |
---|---|
HashDirectedGraph()
Creates new HashDirectedGraph |
|
HashDirectedGraph(DirectedGraph g)
|
|
HashDirectedGraph(int size)
|
Method Summary | |
---|---|
boolean |
addEdge(Object vertex1,
Object vertex2)
Adds the directed edge to the graph(Optional operation). |
boolean |
addVertex(Object vertex)
Adds vertex to the graph(Optional operation). |
void |
clear()
|
Object |
clone()
interface DirectedGraph |
Map |
cloneAdjacencyMap(Map map)
|
boolean |
contains(Object vertex)
Returns whether or not a particular Object is a vertex in the graph. |
boolean |
containsEdge(Object vertex1,
Object vertex2)
Returns whether or not a particular edge is in the graph. |
int |
degree(Object vertex)
Returns the degree of the vertex. |
boolean |
equals(Object p)
|
int |
hashCode()
|
Set |
inComing(Object vertex)
Constructs an Iterator over the vertices adjacent to edges entering the specified vertex. |
int |
inDegree(Object vertex)
Returns the number of edges entering the vertex. |
int |
numEdges()
|
int |
outDegree(Object vertex)
Returns the number of edges leaving the vertex. |
Set |
outGoing(Object vertex)
Constructs an Iterator over the vertices adjacent to edges leaving the specified vertex. |
boolean |
removeEdge(Object vertex1,
Object vertex2)
Removes the directed edge from the graph(Optional operation). |
boolean |
removeVertex(Object vertex)
Removes vertex from the graph(Optional operation). |
void |
replaceVertex(Object oldVertex,
Object newVertex)
|
void |
replaceVertices(Map verticesOldToNew,
NodeLinearTask task)
|
String |
toString()
|
Methods inherited from class AbstractDirectedGraph |
---|
add, addAll, containsAll, depthFirstIterator, hasPath, isAcyclic, isEmpty, isSinglyConnected, isWeaklyConnected, isWeaklyConnected, iterator, maintainsAcyclicity, remove, removeAll, retainAll, size, toArray, toArray, topologicalOrder, vertices |
Methods inherited from class Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface DirectedGraph |
---|
hasPath, isAcyclic, isSinglyConnected, isWeaklyConnected, isWeaklyConnected, maintainsAcyclicity, size, topologicalOrder, vertices |
Methods inherited from interface Collection |
---|
add, addAll, containsAll, isEmpty, iterator, remove, removeAll, retainAll, toArray, toArray |
Field Detail |
---|
public static final PrintStream STREAM_DEBUG
Constructor Detail |
---|
public HashDirectedGraph()
public HashDirectedGraph(int size)
public HashDirectedGraph(DirectedGraph g)
Method Detail |
---|
public Object clone()
AbstractDirectedGraph
clone
in interface DirectedGraph
clone
in class AbstractDirectedGraph
public Map cloneAdjacencyMap(Map map)
public void replaceVertices(Map verticesOldToNew, NodeLinearTask task)
replaceVertices
in interface DirectedGraph
replaceVertices
in class AbstractDirectedGraph
public void replaceVertex(Object oldVertex, Object newVertex)
replaceVertex
in interface DirectedGraph
replaceVertex
in class AbstractDirectedGraph
public String toString()
toString
in class Object
public Set inComing(Object vertex)
inComing
in interface DirectedGraph
vertex-
- An Object which is in the graph.
public Set outGoing(Object vertex)
outGoing
in interface DirectedGraph
vertex-
- An Object which is in the graph.
public int degree(Object vertex)
degree
in interface DirectedGraph
degree
in class AbstractDirectedGraph
vertex-
- An Object which is in the graph.
public int inDegree(Object vertex)
inDegree
in interface DirectedGraph
inDegree
in class AbstractDirectedGraph
vertex-
- An Object which is in the graph.
public int outDegree(Object vertex)
outDegree
in interface DirectedGraph
outDegree
in class AbstractDirectedGraph
vertex-
- An Object which is in the graph.
public boolean containsEdge(Object vertex1, Object vertex2)
containsEdge
in interface DirectedGraph
containsEdge
in class AbstractDirectedGraph
vertex1-
- An Object which is in the graph.vertex2-
- An Object which is in the graph.
public boolean contains(Object vertex)
contains
in interface DirectedGraph
contains
in interface Collection
vertex-
- Any Object.
public int numEdges()
numEdges
in interface DirectedGraph
numEdges
in class AbstractDirectedGraph
public boolean addVertex(Object vertex)
addVertex
in interface DirectedGraph
addVertex
in class AbstractDirectedGraph
vertex-
- An Object to be added as a vertex.
public boolean removeVertex(Object vertex)
removeVertex
in interface DirectedGraph
removeVertex
in class AbstractDirectedGraph
vertex-
- An Object which is currently in the graph.public boolean addEdge(Object vertex1, Object vertex2)
addEdge
in interface DirectedGraph
addEdge
in class AbstractDirectedGraph
public boolean removeEdge(Object vertex1, Object vertex2)
removeEdge
in interface DirectedGraph
removeEdge
in class AbstractDirectedGraph
public void clear()
clear
in interface Collection
public int hashCode()
hashCode
in interface Collection
hashCode
in class Object
public boolean equals(Object p)
equals
in interface Collection
equals
in class Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |