org.jgrapht.experimental.dag
Class DirectedAcyclicGraph.TopoVertexMap

java.lang.Object
  extended by org.jgrapht.experimental.dag.DirectedAcyclicGraph.TopoVertexMap
All Implemented Interfaces:
Serializable, DirectedAcyclicGraph.TopoOrderMapping<V>, DirectedAcyclicGraph.TopoOrderMappingFactory<V>
Enclosing class:
DirectedAcyclicGraph<V,E>

public class DirectedAcyclicGraph.TopoVertexMap
extends Object
implements DirectedAcyclicGraph.TopoOrderMapping<V>, DirectedAcyclicGraph.TopoOrderMappingFactory<V>

For performance and flexibility uses an ArrayList for topological index to vertex mapping, and a HashMap for vertex to topological index mapping.

Author:
gilesp
See Also:
Serialized Form

Constructor Summary
DirectedAcyclicGraph.TopoVertexMap()
           
 
Method Summary
 Integer getTopologicalIndex(V vertex)
          get the topological index of the given vertex.
 DirectedAcyclicGraph.TopoOrderMapping<V> getTopoOrderMapping()
           
 V getVertex(Integer index)
          get the vertex at the given topological index.
 void putVertex(Integer index, V vertex)
          add a vertex at the given topological index.
 void removeAllVertices()
          remove all vertices from the topological ordering
 Integer removeVertex(V vertex)
          remove the given vertex from the topological ordering
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectedAcyclicGraph.TopoVertexMap

public DirectedAcyclicGraph.TopoVertexMap()
Method Detail

putVertex

public void putVertex(Integer index,
                      V vertex)
Description copied from interface: DirectedAcyclicGraph.TopoOrderMapping
add a vertex at the given topological index.

Specified by:
putVertex in interface DirectedAcyclicGraph.TopoOrderMapping<V>

getVertex

public V getVertex(Integer index)
Description copied from interface: DirectedAcyclicGraph.TopoOrderMapping
get the vertex at the given topological index.

Specified by:
getVertex in interface DirectedAcyclicGraph.TopoOrderMapping<V>
Returns:
vertex

getTopologicalIndex

public Integer getTopologicalIndex(V vertex)
Description copied from interface: DirectedAcyclicGraph.TopoOrderMapping
get the topological index of the given vertex.

Specified by:
getTopologicalIndex in interface DirectedAcyclicGraph.TopoOrderMapping<V>
Returns:
the index that the vertex is at, or null if the vertex isn't in the topological ordering

removeVertex

public Integer removeVertex(V vertex)
Description copied from interface: DirectedAcyclicGraph.TopoOrderMapping
remove the given vertex from the topological ordering

Specified by:
removeVertex in interface DirectedAcyclicGraph.TopoOrderMapping<V>
Returns:
the index that the vertex was at, or null if the vertex wasn't in the topological ordering

removeAllVertices

public void removeAllVertices()
Description copied from interface: DirectedAcyclicGraph.TopoOrderMapping
remove all vertices from the topological ordering

Specified by:
removeAllVertices in interface DirectedAcyclicGraph.TopoOrderMapping<V>

getTopoOrderMapping

public DirectedAcyclicGraph.TopoOrderMapping<V> getTopoOrderMapping()
Specified by:
getTopoOrderMapping in interface DirectedAcyclicGraph.TopoOrderMappingFactory<V>


Copyright © 2013. All rights reserved.