|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgrapht.alg.DirectedNeighborIndex<V,E>
public class DirectedNeighborIndex<V,E>
Maintains a cache of each vertex's neighbors. While lists of neighbors can be
obtained from Graphs
, they are re-calculated at each invocation by
walking a vertex's incident edges, which becomes inordinately expensive when
performed often.
A vertex's neighbors are cached the first time they are asked for (i.e. the index is built on demand). The index will only be updated automatically if it is added to the associated graph as a listener. If it is added as a listener to a graph other than the one it indexes, results are undefined.
Constructor Summary | |
---|---|
DirectedNeighborIndex(DirectedGraph<V,E> g)
Creates a neighbor index for the specified directed graph. |
Method Summary | |
---|---|
void |
edgeAdded(GraphEdgeChangeEvent<V,E> e)
Notifies that an edge has been added to the graph. |
void |
edgeRemoved(GraphEdgeChangeEvent<V,E> e)
Notifies that an edge has been removed from the graph. |
java.util.List<V> |
predecessorListOf(V v)
Returns the set of vertices which are the predecessors of a specified vertex. |
java.util.Set<V> |
predecessorsOf(V v)
Returns the set of vertices which are the predecessors of a specified vertex. |
java.util.List<V> |
successorListOf(V v)
Returns the set of vertices which are the successors of a specified vertex. |
java.util.Set<V> |
successorsOf(V v)
Returns the set of vertices which are the successors of a specified vertex. |
void |
vertexAdded(GraphVertexChangeEvent<V> e)
Notifies that a vertex has been added to the graph. |
void |
vertexRemoved(GraphVertexChangeEvent<V> e)
Notifies that a vertex has been removed from the graph. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DirectedNeighborIndex(DirectedGraph<V,E> g)
g
- the graph for which a neighbor index is to be created.Method Detail |
---|
public java.util.Set<V> predecessorsOf(V v)
v
- the vertex whose predecessors are desired
public java.util.List<V> predecessorListOf(V v)
predecessorsOf(Object)
unless duplicate neighbors are required.
v
- the vertex whose predecessors are desired
public java.util.Set<V> successorsOf(V v)
v
- the vertex whose successors are desired
public java.util.List<V> successorListOf(V v)
successorsOf(Object)
unless dupliate neighbors are required.
v
- the vertex whose successors are desired
public void edgeAdded(GraphEdgeChangeEvent<V,E> e)
GraphListener
edgeAdded
in interface GraphListener<V,E>
e
- the edge event.GraphListener.edgeAdded(GraphEdgeChangeEvent)
public void edgeRemoved(GraphEdgeChangeEvent<V,E> e)
GraphListener
edgeRemoved
in interface GraphListener<V,E>
e
- the edge event.GraphListener.edgeRemoved(GraphEdgeChangeEvent)
public void vertexAdded(GraphVertexChangeEvent<V> e)
VertexSetListener
vertexAdded
in interface VertexSetListener<V>
e
- the vertex event.VertexSetListener.vertexAdded(GraphVertexChangeEvent)
public void vertexRemoved(GraphVertexChangeEvent<V> e)
VertexSetListener
vertexRemoved
in interface VertexSetListener<V>
e
- the vertex event.VertexSetListener.vertexRemoved(GraphVertexChangeEvent)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |