Package com.jgalgo.graph
Class IndexIdMaps
- java.lang.Object
-
- com.jgalgo.graph.IndexIdMaps
-
public class IndexIdMaps extends Object
Static methods class for index-id maps.- Author:
- Barak Ugav
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <K> IntCollection
idToIndexCollection(Collection<K> idCollection, IndexIdMap<K> map)
Create an indices collection from a collection of IDs.static <K> IntIterator
idToIndexIterator(Iterator<K> idIter, IndexIdMap<K> map)
Create an indices iterator from an iterator of IDs.static <K> IntList
idToIndexList(List<K> idList, IndexIdMap<K> map)
Create an indices list from a list of IDs.static <K> IntSet
idToIndexSet(Set<K> idSet, IndexIdMap<K> map)
Create an indices set from a set of IDs.static <K> IWeightFunction
idToIndexWeightFunc(WeightFunction<K> w, IndexIdMap<K> map)
Create a weight function that accept elements indices, given a weight function that accept elements IDs.static <K> IWeightFunctionInt
idToIndexWeightFunc(WeightFunctionInt<K> w, IndexIdMap<K> map)
Create an integer weight function that accept elements indices, given a weight function that accept elements IDs.static <K,T,WeightsT extends IWeights<T>>
WeightsTidToIndexWeights(Weights<K,T> weights, IndexIdMap<K> map)
Create a weights view that is accessed by the elements indices, given a weights container that is accessed by the element IDs.static <K> Collection<K>
indexToIdCollection(IntCollection indexCollection, IndexIdMap<K> map)
Create an IDs collection from a collection of indices.static IntCollection
indexToIdCollection(IntCollection indexCollection, IndexIntIdMap map)
Create an int IDs collection from a collection of indices.static <V,E>
EdgeIter<V,E>indexToIdEdgeIter(Graph<V,E> g, IEdgeIter indexIter)
static IEdgeIter
indexToIdEdgeIter(IntGraph g, IEdgeIter indexIter)
static <V,E>
EdgeSet<V,E>indexToIdEdgeSet(IEdgeSet indexSet, Graph<V,E> g)
Create an edge set of IDs from an edge set of indices.static IEdgeSet
indexToIdEdgeSet(IEdgeSet indexSet, IntGraph g)
Create an edge set of IDs from an edge set of indices in anIntGraph
.static <K> Iterator<K>
indexToIdIterator(IntIterator indexIter, IndexIdMap<K> map)
Create an IDs iterator from an iterator of indices.static IntIterator
indexToIdIterator(IntIterator indexIter, IndexIntIdMap map)
Create an IDs iterator from an iterator of indices.static <K> List<K>
indexToIdList(IntList indexList, IndexIdMap<K> map)
Create an IDs list from a list of indices.static IntList
indexToIdList(IntList indexList, IndexIntIdMap map)
Create an IDs list from a list of indices.static <K> Set<K>
indexToIdSet(IntSet indexSet, IndexIdMap<K> map)
Create an IDs set from a set of indices.static IntSet
indexToIdSet(IntSet indexSet, IndexIntIdMap map)
Create an IDs set from a set of indices.
-
-
-
Method Detail
-
indexToIdIterator
public static <K> Iterator<K> indexToIdIterator(IntIterator indexIter, IndexIdMap<K> map)
Create an IDs iterator from an iterator of indices.- Type Parameters:
K
- the type of IDs- Parameters:
indexIter
- an iterator of indicesmap
- index-id mapping- Returns:
- an iterator that iterate over the IDs matching the indices iterated by the original index-iterator
-
indexToIdIterator
public static IntIterator indexToIdIterator(IntIterator indexIter, IndexIntIdMap map)
Create an IDs iterator from an iterator of indices.- Parameters:
indexIter
- an iterator of indicesmap
- index-id mapping- Returns:
- an iterator that iterate over the IDs matching the indices iterated by the original index-iterator
-
idToIndexIterator
public static <K> IntIterator idToIndexIterator(Iterator<K> idIter, IndexIdMap<K> map)
Create an indices iterator from an iterator of IDs.- Type Parameters:
K
- the type of IDs- Parameters:
idIter
- an iterator of IDsmap
- index-id mapping- Returns:
- an iterator that iterate over the indices matching the IDs iterated by the original ID-iterator
-
indexToIdEdgeIter
public static <V,E> EdgeIter<V,E> indexToIdEdgeIter(Graph<V,E> g, IEdgeIter indexIter)
-
indexToIdEdgeSet
public static <V,E> EdgeSet<V,E> indexToIdEdgeSet(IEdgeSet indexSet, Graph<V,E> g)
Create an edge set of IDs from an edge set of indices.- Type Parameters:
V
- the vertices typeE
- the edges type- Parameters:
indexSet
- an indices edge setg
- the graph- Returns:
- an edge set of IDs matching the indices contained in the original index-set
-
indexToIdEdgeSet
public static IEdgeSet indexToIdEdgeSet(IEdgeSet indexSet, IntGraph g)
Create an edge set of IDs from an edge set of indices in anIntGraph
.- Parameters:
indexSet
- an indices edge setg
- the graph- Returns:
- an edge set of IDs matching the indices contained in the original index-set
-
indexToIdCollection
public static <K> Collection<K> indexToIdCollection(IntCollection indexCollection, IndexIdMap<K> map)
Create an IDs collection from a collection of indices.- Type Parameters:
K
- the type of IDs- Parameters:
indexCollection
- a collection of indicesmap
- index-id mapping- Returns:
- a collection that contain IDs matching the indices contained in the original index-collection
-
indexToIdCollection
public static IntCollection indexToIdCollection(IntCollection indexCollection, IndexIntIdMap map)
Create an int IDs collection from a collection of indices.- Parameters:
indexCollection
- a collection of indicesmap
- index-id mapping- Returns:
- a collection that contain IDs matching the indices contained in the original index-collection
-
indexToIdSet
public static <K> Set<K> indexToIdSet(IntSet indexSet, IndexIdMap<K> map)
Create an IDs set from a set of indices.- Type Parameters:
K
- the type of IDs- Parameters:
indexSet
- a set of indicesmap
- index-id mapping- Returns:
- a set that contain IDs matching the indices contained in the original index-set
-
indexToIdSet
public static IntSet indexToIdSet(IntSet indexSet, IndexIntIdMap map)
Create an IDs set from a set of indices.- Parameters:
indexSet
- a set of indicesmap
- index-id mapping- Returns:
- a set that contain IDs matching the indices contained in the original index-set
-
idToIndexCollection
public static <K> IntCollection idToIndexCollection(Collection<K> idCollection, IndexIdMap<K> map)
Create an indices collection from a collection of IDs.- Type Parameters:
K
- the type of IDs- Parameters:
idCollection
- a collection of IDsmap
- index-id mapping- Returns:
- a collection that contain indices matching the IDs contained in the original ID-collection
-
idToIndexSet
public static <K> IntSet idToIndexSet(Set<K> idSet, IndexIdMap<K> map)
Create an indices set from a set of IDs.- Type Parameters:
K
- the type of IDs- Parameters:
idSet
- a set of IDsmap
- index-id mapping- Returns:
- a set that contain indices matching the IDs contained in the original ID-set
-
idToIndexList
public static <K> IntList idToIndexList(List<K> idList, IndexIdMap<K> map)
Create an indices list from a list of IDs.- Type Parameters:
K
- the type of IDs- Parameters:
idList
- a list of IDsmap
- index-id mapping- Returns:
- a list that contain indices matching the IDs contained in the original ID-list
-
indexToIdList
public static <K> List<K> indexToIdList(IntList indexList, IndexIdMap<K> map)
Create an IDs list from a list of indices.- Type Parameters:
K
- the type of IDs- Parameters:
indexList
- a list of indicesmap
- index-id mapping- Returns:
- a list that contain IDs matching the indices contained in the original index-list
-
indexToIdList
public static IntList indexToIdList(IntList indexList, IndexIntIdMap map)
Create an IDs list from a list of indices.- Parameters:
indexList
- a list of indicesmap
- index-id mapping- Returns:
- a list that contain IDs matching the indices contained in the original index-list
-
idToIndexWeights
public static <K,T,WeightsT extends IWeights<T>> WeightsT idToIndexWeights(Weights<K,T> weights, IndexIdMap<K> map)
Create a weights view that is accessed by the elements indices, given a weights container that is accessed by the element IDs.The returned weights container is a view, namely modifying the original container change the new one, and vice versa.
- Type Parameters:
K
- the element (vertex or edge) identifiers typeT
- the weight typeWeightsT
- the weights container, used to avoid casts of containers of primitive types such asWeightsInt
,WeightsDouble
ect. The user should expectWeightsDouble
only if aWeightsDouble
object was passed as an argument.- Parameters:
weights
- a weights container that is accessed by the elements IDsmap
- index-id map- Returns:
- a weights-view that is accessed by the elements indices
-
idToIndexWeightFunc
public static <K> IWeightFunction idToIndexWeightFunc(WeightFunction<K> w, IndexIdMap<K> map)
Create a weight function that accept elements indices, given a weight function that accept elements IDs.- Type Parameters:
K
- the type of elements IDs- Parameters:
w
- a weight function that accept by elements IDsmap
- index-id map- Returns:
- a weight function that accept elements indices
-
idToIndexWeightFunc
public static <K> IWeightFunctionInt idToIndexWeightFunc(WeightFunctionInt<K> w, IndexIdMap<K> map)
Create an integer weight function that accept elements indices, given a weight function that accept elements IDs.- Type Parameters:
K
- the type of elements IDs- Parameters:
w
- an integer weight function that accept by elements IDsmap
- index-id map- Returns:
- an integer weight function that accept elements indices
-
-