|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectAbstractDirectedGraph
public abstract class AbstractDirectedGraph
Convenience class for implementing DirectedGraph. You must implement only 5 methods, but you probably want to override others for performance reasons.
Field Summary | |
---|---|
static PrintStream |
STREAM_DEBUG
|
Constructor Summary | |
---|---|
AbstractDirectedGraph()
|
Method Summary | |
---|---|
boolean |
add(Object obj)
|
boolean |
addAll(Collection p)
|
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). |
abstract Object |
clone()
interface DirectedGraph |
boolean |
containsAll(Collection p)
|
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. |
Iterator |
depthFirstIterator()
|
boolean |
hasPath(Object vertex1,
Object vertex2)
Determines if there is a directed path from vertex1 to vertex2. |
int |
inDegree(Object vertex)
Returns the number of edges entering the vertex. |
boolean |
isAcyclic()
Determines whether or not the graph is acyclic. |
boolean |
isEmpty()
|
boolean |
isSinglyConnected()
Determines whether or not the graph is a singly connected. |
boolean |
isWeaklyConnected()
Determines whether or not the graph is weakly connected. |
boolean |
isWeaklyConnected(Object vertex1,
Object vertex2)
Determines if there is an undirected path from vertex1 to vertex2. |
Iterator |
iterator()
|
boolean |
maintainsAcyclicity(Object vertex1,
Object vertex2)
Check whether adding the proposed edge would keep the graph acyclic. |
int |
numEdges()
|
int |
outDegree(Object vertex)
Returns the number of edges leaving the vertex. |
boolean |
remove(Object obj)
|
boolean |
removeAll(Collection p)
|
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)
|
boolean |
retainAll(Collection p1)
|
int |
size()
Returns the number of vertices in the graph. |
Object[] |
toArray()
|
Object[] |
toArray(Object[] p)
|
List |
topologicalOrder()
|
Set |
vertices()
Constructs an Iterator over all vertices. |
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface DirectedGraph |
---|
contains, inComing, outGoing |
Methods inherited from interface Collection |
---|
clear, equals, hashCode |
Field Detail |
---|
public static final PrintStream STREAM_DEBUG
Constructor Detail |
---|
public AbstractDirectedGraph()
Method Detail |
---|
public abstract Object clone()
clone
in interface DirectedGraph
clone
in class Object
public int degree(Object vertex)
DirectedGraph
degree
in interface DirectedGraph
public int inDegree(Object vertex)
DirectedGraph
inDegree
in interface DirectedGraph
public int outDegree(Object vertex)
DirectedGraph
outDegree
in interface DirectedGraph
public boolean containsEdge(Object vertex1, Object vertex2)
DirectedGraph
containsEdge
in interface DirectedGraph
public int numEdges()
numEdges
in interface DirectedGraph
public Iterator depthFirstIterator()
public boolean maintainsAcyclicity(Object vertex1, Object vertex2)
Check whether adding the proposed edge would keep the graph acyclic.
Precondition: the graph is acyclic.
maintainsAcyclicity
in interface DirectedGraph
public Set vertices()
DirectedGraph
vertices
in interface DirectedGraph
public int size()
DirectedGraph
size
in interface DirectedGraph
size
in interface Collection
public boolean isAcyclic()
isAcyclic
in interface DirectedGraph
public void replaceVertex(Object oldVertex, Object newVertex)
replaceVertex
in interface DirectedGraph
public void replaceVertices(Map verticesOldToNew, NodeLinearTask task)
replaceVertices
in interface DirectedGraph
public boolean isWeaklyConnected()
isWeaklyConnected
in interface DirectedGraph
public boolean isWeaklyConnected(Object vertex1, Object vertex2)
isWeaklyConnected
in interface DirectedGraph
vertex1-
- An Object which is in the graph.vertex2-
- An Object which is in the graph.
public boolean hasPath(Object vertex1, Object vertex2)
hasPath
in interface DirectedGraph
vertex1-
- An Object which is in the graph.vertex2-
- An Object which is in the graph.
public boolean isSinglyConnected()
isSinglyConnected
in interface DirectedGraph
public boolean addVertex(Object vertex)
DirectedGraph
addVertex
in interface DirectedGraph
public boolean removeVertex(Object vertex)
DirectedGraph
removeVertex
in interface DirectedGraph
public boolean addEdge(Object vertex1, Object vertex2)
DirectedGraph
addEdge
in interface DirectedGraph
public boolean removeEdge(Object vertex1, Object vertex2)
DirectedGraph
removeEdge
in interface DirectedGraph
public List topologicalOrder()
topologicalOrder
in interface DirectedGraph
public final boolean add(Object obj)
add
in interface Collection
public final boolean remove(Object obj)
remove
in interface Collection
public boolean retainAll(Collection p1)
retainAll
in interface Collection
public Object[] toArray(Object[] p)
toArray
in interface Collection
public Object[] toArray()
toArray
in interface Collection
public boolean removeAll(Collection p)
removeAll
in interface Collection
public Iterator iterator()
iterator
in interface Iterable
iterator
in interface Collection
public boolean addAll(Collection p)
addAll
in interface Collection
public boolean containsAll(Collection p)
containsAll
in interface Collection
public boolean isEmpty()
isEmpty
in interface Collection
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |