Package org.jgrapht.graph
Class DirectedAcyclicGraph.TopoVertexMap
- java.lang.Object
-
- org.jgrapht.graph.DirectedAcyclicGraph.TopoVertexMap
-
- All Implemented Interfaces:
java.io.Serializable
,DirectedAcyclicGraph.TopoOrderMap<V>
- Enclosing class:
- DirectedAcyclicGraph<V,E>
protected class DirectedAcyclicGraph.TopoVertexMap extends java.lang.Object implements DirectedAcyclicGraph.TopoOrderMap<V>
An implementation of the topological order map which for performance and flexibility uses an ArrayList for topological index to vertex mapping, and a HashMap for vertex to topological index mapping.- Author:
- Peter Giles
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TopoVertexMap()
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Integer
getTopologicalIndex(V vertex)
Get the topological index of the given vertex.V
getVertex(java.lang.Integer index)
Get the vertex at the given topological index.void
putVertex(java.lang.Integer index, V vertex)
Add a vertex at the given topological index.void
removeAllVertices()
Remove all vertices from the topological ordering.java.lang.Integer
removeVertex(V vertex)
Remove the given vertex from the topological ordering.
-
-
-
Method Detail
-
putVertex
public void putVertex(java.lang.Integer index, V vertex)
Description copied from interface:DirectedAcyclicGraph.TopoOrderMap
Add a vertex at the given topological index.- Specified by:
putVertex
in interfaceDirectedAcyclicGraph.TopoOrderMap<V>
- Parameters:
index
- the topological indexvertex
- the vertex
-
getVertex
public V getVertex(java.lang.Integer index)
Description copied from interface:DirectedAcyclicGraph.TopoOrderMap
Get the vertex at the given topological index.- Specified by:
getVertex
in interfaceDirectedAcyclicGraph.TopoOrderMap<V>
- Parameters:
index
- the topological index- Returns:
- vertex the vertex
-
getTopologicalIndex
public java.lang.Integer getTopologicalIndex(V vertex)
Description copied from interface:DirectedAcyclicGraph.TopoOrderMap
Get the topological index of the given vertex.- Specified by:
getTopologicalIndex
in interfaceDirectedAcyclicGraph.TopoOrderMap<V>
- Parameters:
vertex
- the vertex- Returns:
- the index that the vertex is at, or null if the vertex isn't in the topological ordering
-
removeVertex
public java.lang.Integer removeVertex(V vertex)
Description copied from interface:DirectedAcyclicGraph.TopoOrderMap
Remove the given vertex from the topological ordering.- Specified by:
removeVertex
in interfaceDirectedAcyclicGraph.TopoOrderMap<V>
- Parameters:
vertex
- the vertex- 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.TopoOrderMap
Remove all vertices from the topological ordering.- Specified by:
removeAllVertices
in interfaceDirectedAcyclicGraph.TopoOrderMap<V>
-
-