Package com.jgalgo.graph
Class IndexIdMaps
java.lang.Object
com.jgalgo.graph.IndexIdMaps
Static methods class for index-id maps.
- Author:
- Barak Ugav
-
Method Summary
Modifier and TypeMethodDescriptionstatic <K> IntCollectionidToIndexCollection(Collection<K> idCollection, IndexIdMap<K> map) Create an indices collection from a collection of IDs.static <K> IntIteratoridToIndexIterator(Iterator<K> idIter, IndexIdMap<K> map) Create an indices iterator from an iterator of IDs.static <K> IntListidToIndexList(List<K> idList, IndexIdMap<K> map) Create an indices list from a list of IDs.static <K> IntSetidToIndexSet(Set<K> idSet, IndexIdMap<K> map) Create an indices set from a set of IDs.static <K> IWeightFunctionidToIndexWeightFunc(WeightFunction<K> w, IndexIdMap<K> map) Create a weight function that accept elements indices, given a weight function that accept elements IDs.static <K> IWeightFunctionIntidToIndexWeightFunc(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 IntCollectionindexToIdCollection(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 IEdgeIterindexToIdEdgeIter(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 IEdgeSetindexToIdEdgeSet(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 IntIteratorindexToIdIterator(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 IntListindexToIdList(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 IntSetindexToIdSet(IntSet indexSet, IndexIntIdMap map) Create an IDs set from a set of indices.
-
Method Details
-
indexToIdIterator
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
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
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
-
indexToIdEdgeIter
-
indexToIdEdgeSet
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
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
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
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
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
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
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
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
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
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 idToIndexWeightsWeightsT extends IWeights<T>> (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,WeightsDoubleect. The user should expectWeightsDoubleonly if aWeightsDoubleobject 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
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
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
-