org.jgrapht.alg

## Class DirectedNeighborIndex<V,E>

• Type Parameters:
V - the graph vertex type
E - the graph edge type
All Implemented Interfaces:
EventListener, GraphListener<V,E>, VertexSetListener<V>

Deprecated.

@Deprecated
public class DirectedNeighborIndex<V,E>
extends Object
implements GraphListener<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.

Since:
Dec 13, 2005
Author:
Charles Fry
• ### Constructor Summary

Constructors
Constructor and Description
DirectedNeighborIndex(Graph<V,E> g)
Deprecated.
Creates a neighbor index for the specified directed graph.
• ### Method Summary

All Methods
Modifier and Type Method and Description
void edgeAdded(GraphEdgeChangeEvent<V,E> e)
Deprecated.
Notifies that an edge has been added to the graph.
void edgeRemoved(GraphEdgeChangeEvent<V,E> e)
Deprecated.
Notifies that an edge has been removed from the graph.
List<V> predecessorListOf(V v)
Deprecated.
Returns the set of vertices which are the predecessors of a specified vertex.
Set<V> predecessorsOf(V v)
Deprecated.
Returns the set of vertices which are the predecessors of a specified vertex.
List<V> successorListOf(V v)
Deprecated.
Returns the set of vertices which are the successors of a specified vertex.
Set<V> successorsOf(V v)
Deprecated.
Returns the set of vertices which are the successors of a specified vertex.
void vertexAdded(GraphVertexChangeEvent<V> e)
Deprecated.
Notifies that a vertex has been added to the graph.
void vertexRemoved(GraphVertexChangeEvent<V> e)
Deprecated.
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

• #### DirectedNeighborIndex

public DirectedNeighborIndex(Graph<V,E> g)
Deprecated.
Creates a neighbor index for the specified directed graph.
Parameters:
g - the graph for which a neighbor index is to be created.
• ### Method Detail

• #### predecessorsOf

public Set<V> predecessorsOf(V v)
Deprecated.
Returns the set of vertices which are the predecessors of a specified vertex. The returned set is backed by the index, and will be updated when the graph changes as long as the index has been added as a listener to the graph.
Parameters:
v - the vertex whose predecessors are desired
Returns:
all unique predecessors of the specified vertex
• #### predecessorListOf

public List<V> predecessorListOf(V v)
Deprecated.
Returns the set of vertices which are the predecessors of a specified vertex. If the graph is a multigraph, vertices may appear more than once in the returned list. Because a list of predecessors can not be efficiently maintained, it is reconstructed on every invocation by duplicating entries in the neighbor set. It is thus more efficient to use predecessorsOf(Object) unless duplicate neighbors are required.
Parameters:
v - the vertex whose predecessors are desired
Returns:
all predecessors of the specified vertex
• #### successorsOf

public Set<V> successorsOf(V v)
Deprecated.
Returns the set of vertices which are the successors of a specified vertex. The returned set is backed by the index, and will be updated when the graph changes as long as the index has been added as a listener to the graph.
Parameters:
v - the vertex whose successors are desired
Returns:
all unique successors of the specified vertex
• #### successorListOf

public List<V> successorListOf(V v)
Deprecated.
Returns the set of vertices which are the successors of a specified vertex. If the graph is a multigraph, vertices may appear more than once in the returned list. Because a list of successors can not be efficiently maintained, it is reconstructed on every invocation by duplicating entries in the neighbor set. It is thus more efficient to use successorsOf(Object) unless duplicate neighbors are required.
Parameters:
v - the vertex whose successors are desired
Returns:
all successors of the specified vertex
• #### edgeAdded

public void edgeAdded(GraphEdgeChangeEvent<V,E> e)
Deprecated.
Description copied from interface: GraphListener
Notifies that an edge has been added to the graph.
Specified by:
edgeAdded in interface GraphListener<V,E>
Parameters:
e - the edge event.
See Also:
GraphListener.edgeAdded(GraphEdgeChangeEvent)
• #### edgeRemoved

public void edgeRemoved(GraphEdgeChangeEvent<V,E> e)
Deprecated.
Description copied from interface: GraphListener
Notifies that an edge has been removed from the graph.
Specified by:
edgeRemoved in interface GraphListener<V,E>
Parameters:
e - the edge event.
See Also:
GraphListener.edgeRemoved(GraphEdgeChangeEvent)
• #### vertexAdded

public void vertexAdded(GraphVertexChangeEvent<V> e)
Deprecated.
Description copied from interface: VertexSetListener
Notifies that a vertex has been added to the graph.
Specified by:
vertexAdded in interface VertexSetListener<V>
Parameters:
e - the vertex event.
See Also:
VertexSetListener.vertexAdded(GraphVertexChangeEvent)
• #### vertexRemoved

public void vertexRemoved(GraphVertexChangeEvent<V> e)
Deprecated.
Description copied from interface: VertexSetListener
Notifies that a vertex has been removed from the graph.
Specified by:
vertexRemoved in interface VertexSetListener<V>
Parameters:
e - the vertex event.
See Also:
VertexSetListener.vertexRemoved(GraphVertexChangeEvent)

Copyright © 2017. All rights reserved.