|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.graph.DirectedMultiGraph<V,E>
V
- Type of verticesE
- Type of edges.public class DirectedMultiGraph<V,E>
Simple graph library; this is directed for now. This class focuses on time efficiency rather than memory efficiency.
Constructor Summary | |
---|---|
DirectedMultiGraph()
|
Method Summary | |
---|---|
void |
add(V source,
V dest,
E data)
adds vertices (if not already in the graph) and the edge between them |
boolean |
addVertex(V v)
For adding a zero degree vertex |
boolean |
containsVertex(V v)
|
java.util.List<E> |
convertPath(java.util.List<V> nodes,
boolean directionSensitive)
|
java.lang.Iterable<E> |
edgeIterable()
|
java.util.Iterator<E> |
edgeIterator()
|
boolean |
equals(java.lang.Object that)
|
java.util.Set<V> |
getAllVertices()
|
java.util.List<java.util.Set<V>> |
getConnectedComponents()
|
java.util.List<E> |
getEdges(V source,
V dest)
|
int |
getInDegree(V vertex)
|
int |
getNumVertices()
|
int |
getOutDegree(V vertex)
|
java.util.List<V> |
getShortestPath(V node1,
V node2)
direction insensitive (the paths can go "up" or through the parents) |
java.util.List<V> |
getShortestPath(V node1,
V node2,
boolean directionSensitive)
can specify the direction sensitivity |
java.util.List<E> |
getShortestPathEdges(V node1,
V node2)
|
java.util.List<E> |
getShortestPathEdges(V node1,
V node2,
boolean directionSensitive)
|
int |
getTotalNumEdges()
|
int |
hashCode()
Be careful hashing these. |
java.lang.Iterable<E> |
incomingEdgeIterable(V vertex)
|
java.util.Iterator<E> |
incomingEdgeIterator(V vertex)
|
boolean |
isEdge(V source,
V dest)
only checks if there is an edge from source to dest. |
boolean |
isEmpty()
False if there are any vertices in the graph, true otherwise. |
java.lang.Iterable<E> |
outgoingEdgeIterable(V vertex)
|
java.util.Iterator<E> |
outgoingEdgeIterator(V vertex)
|
boolean |
removeEdge(V source,
V dest,
E data)
|
boolean |
removeEdges(V source,
V dest)
|
boolean |
removeVertex(V vertex)
remove a vertex (and its edges) from the graph. |
boolean |
removeVertices(java.util.Collection<V> vertices)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DirectedMultiGraph()
Method Detail |
---|
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object that)
equals
in class java.lang.Object
public boolean addVertex(V v)
v
- public void add(V source, V dest, E data)
source
- dest
- data
- public boolean removeEdges(V source, V dest)
public boolean removeEdge(V source, V dest, E data)
public boolean removeVertex(V vertex)
vertex
-
public boolean removeVertices(java.util.Collection<V> vertices)
public int getNumVertices()
public int getTotalNumEdges()
public boolean containsVertex(V v)
public boolean isEdge(V source, V dest)
source
- dest
-
public java.util.Set<V> getAllVertices()
public boolean isEmpty()
public java.util.List<E> getEdges(V source, V dest)
public java.util.List<V> getShortestPath(V node1, V node2)
public java.util.List<E> getShortestPathEdges(V node1, V node2)
public java.util.List<V> getShortestPath(V node1, V node2, boolean directionSensitive)
node1
- node2
- directionSensitive
- - whether the path can go through the parents
public java.util.List<E> getShortestPathEdges(V node1, V node2, boolean directionSensitive)
public java.util.List<E> convertPath(java.util.List<V> nodes, boolean directionSensitive)
public int getInDegree(V vertex)
public int getOutDegree(V vertex)
public java.util.List<java.util.Set<V>> getConnectedComponents()
public java.util.Iterator<E> incomingEdgeIterator(V vertex)
public java.lang.Iterable<E> incomingEdgeIterable(V vertex)
public java.util.Iterator<E> outgoingEdgeIterator(V vertex)
public java.lang.Iterable<E> outgoingEdgeIterable(V vertex)
public java.util.Iterator<E> edgeIterator()
public java.lang.Iterable<E> edgeIterable()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |