Package edu.uci.ics.jung.graph.util
Class IncidentEdgeIndexFunction<V,E>
- java.lang.Object
-
- edu.uci.ics.jung.graph.util.IncidentEdgeIndexFunction<V,E>
-
- All Implemented Interfaces:
EdgeIndexFunction<V,E>
public class IncidentEdgeIndexFunction<V,E> extends java.lang.Object implements EdgeIndexFunction<V,E>
A class which creates and maintains indices for incident edges.- Author:
- Tom Nelson
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<E,java.lang.Integer>
edge_index
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getIndex(Graph<V,E> graph, E e)
Returns the index for the specified edge.protected int
getIndex(Graph<V,E> graph, E e, V v)
protected int
getIndex(Graph<V,E> graph, E e, V u, V v)
static <V,E>
IncidentEdgeIndexFunction<V,E>getInstance()
void
reset()
Clears all edge indices for all edges in all graphs.void
reset(Graph<V,E> graph, E e)
Resets the indices for this edge and its parallel edges.
-
-
-
Field Detail
-
edge_index
protected java.util.Map<E,java.lang.Integer> edge_index
-
-
Method Detail
-
getInstance
public static <V,E> IncidentEdgeIndexFunction<V,E> getInstance()
- Type Parameters:
V
- the vertex typeE
- the edge type- Returns:
- an instance of this type.
-
getIndex
public int getIndex(Graph<V,E> graph, E e)
Returns the index for the specified edge. Calculates the indices fore
and for all edges parallel toe
.- Specified by:
getIndex
in interfaceEdgeIndexFunction<V,E>
- Parameters:
graph
- the graph with respect to which the index is calculatede
- the edge whose index is to be queried- Returns:
e
's index ingraph
-
reset
public void reset(Graph<V,E> graph, E e)
Resets the indices for this edge and its parallel edges. Should be invoked when an edge parallel toe
has been added or removed.- Specified by:
reset
in interfaceEdgeIndexFunction<V,E>
- Parameters:
graph
- the graph whose indices are to be resete
- the edge whose associated indices are to be reset
-
reset
public void reset()
Clears all edge indices for all edges in all graphs. Does not recalculate the indices.- Specified by:
reset
in interfaceEdgeIndexFunction<V,E>
-
-