Class IndexGraphBuilder.ReIndexingMap
- Enclosing interface:
IndexGraphBuilder
Re-indexing is the operation of assigning new indices to the vertices/edges. By re-indexing the vertices/edges, the performance of accessing/iterating over the graph vertices/edges may increase, for example if a more cache friendly indexing exists.
A 're-indexed' index is the index assigned to vertex/edge after a re-indexing operation on a graph. This interface is used to represent the mapping of both vertices and edges (a single instance map either vertices or edges), and it should be understood from the context which one is it. In the documentation we use the term element to refer to either vertex or edge.
An map (this object) is usually obtained when an IndexGraphBuilder
builds a graph a re-index the indices
of the vertices/edges, and the returned map maps from original indices to the new indices. The inverse map, from
the new indices to the original indices may be obtained by inverse()
. Note that the
direction of mapping, namely whether the map is from original to new indices or the other way around, can not be
determine from the re-indexing along, and should be concluded from the context of which the map was obtained.
Re-indexing of the vertices (or edges) is a mapping from [0,1,2,...,verticesNum-1]
to
[0,1,2,...,verticesNum-1]
, namely its bijection function.
- Author:
- Barak Ugav
- See Also:
-
Method Details
-
map
public int map(int element) Map an element's index to its re-indexed index.Whether this methods maps original to new indices or the other way around should be determine by the context. The re-indexing maps returned by
IndexGraphBuilder.reIndexAndBuild(boolean, boolean)
are from original to new indices. Maps returned byinverse()
of such maps are the other way around.- Parameters:
element
- an element's index- Returns:
- the element's re-index index
-
inverse
Get the inverse map of this map.If this map maps original to new indices, the inverse map maps new to original indices, and visa verse.
- Returns:
- the inverse map of this map
-