Class IndexIdMaps


  • public class IndexIdMaps
    extends Object
    Static methods class for index-id maps.
    Author:
    Barak Ugav
    • Method Detail

      • indexToIdIterator

        public static IntIterator indexToIdIterator​(IntIterator indexIter,
                                                    IndexIdMap map)
        Create an IDs iterator from an iterator of indices.
        Parameters:
        indexIter - an iterator of indices
        map - index-id mapping
        Returns:
        an iterator that iterate over the IDs matching the indices iterated by the original index-iterator
      • idToIndexIterator

        public static IntIterator idToIndexIterator​(IntIterator idIter,
                                                    IndexIdMap map)
        Create an indices iterator from an iterator of IDs.
        Parameters:
        idIter - an iterator of IDs
        map - index-id mapping
        Returns:
        an iterator that iterate over the indices matching the IDs iterated by the original ID-iterator
      • indexToIdEdgeIter

        public static EdgeIter indexToIdEdgeIter​(EdgeIter indexIter,
                                                 IndexIdMap verticesMap,
                                                 IndexIdMap edgesMap)
        Create an EdgeIter that return IDs of vertices and edges from an EdgeIter that return indices of vertices and edges.
        Parameters:
        indexIter - an EdgeIter that return indices of vertices and edges
        verticesMap - vertices index-id mapping
        edgesMap - edges index-id mapping
        Returns:
        EdgeIter that return IDs of vertices and edges matching the indices of vertices and edges returned by the original index-iterator
      • indexToIdCollection

        public static IntCollection indexToIdCollection​(IntCollection indexCollection,
                                                        IndexIdMap map)
        Create an IDs collection from a collection of indices.
        Parameters:
        indexCollection - a collection of indices
        map - index-id mapping
        Returns:
        a collection that contain IDs matching the indices contained in the original index-collection
      • idToIndexCollection

        public static IntCollection idToIndexCollection​(IntCollection idCollection,
                                                        IndexIdMap map)
        Create an indices collection from a collection of IDs.
        Parameters:
        idCollection - a collection of IDs
        map - index-id mapping
        Returns:
        a collection that contain indices matching the IDs contained in the original ID-collection
      • indexToIdList

        public static IntList indexToIdList​(IntList indexList,
                                            IndexIdMap map)
        Create an IDs list from a list of indices.
        Parameters:
        indexList - a list of indices
        map - index-id mapping
        Returns:
        a list that contain IDs matching the indices contained in the original index-list
      • idToIndexWeights

        public static <W> Weights<W> idToIndexWeights​(Weights<W> weights,
                                                      IndexIdMap 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:
        W - the weight type
        Parameters:
        weights - a weights container that is accessed by the elements IDs
        map - index-id map
        Returns:
        a weights-view that is accessed by the elements indices
      • idToIndexWeights

        public static Weights.Byte idToIndexWeights​(Weights.Byte weights,
                                                    IndexIdMap 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.

        Parameters:
        weights - a weights container that is accessed by the elements IDs
        map - index-id map
        Returns:
        a weights-view that is accessed by the elements indices
      • idToIndexWeights

        public static Weights.Short idToIndexWeights​(Weights.Short weights,
                                                     IndexIdMap 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.

        Parameters:
        weights - a weights container that is accessed by the elements IDs
        map - index-id map
        Returns:
        a weights-view that is accessed by the elements indices
      • idToIndexWeights

        public static Weights.Int idToIndexWeights​(Weights.Int weights,
                                                   IndexIdMap 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.

        Parameters:
        weights - a weights container that is accessed by the elements IDs
        map - index-id map
        Returns:
        a weights-view that is accessed by the elements indices
      • idToIndexWeights

        public static Weights.Long idToIndexWeights​(Weights.Long weights,
                                                    IndexIdMap 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.

        Parameters:
        weights - a weights container that is accessed by the elements IDs
        map - index-id map
        Returns:
        a weights-view that is accessed by the elements indices
      • idToIndexWeights

        public static Weights.Float idToIndexWeights​(Weights.Float weights,
                                                     IndexIdMap 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.

        Parameters:
        weights - a weights container that is accessed by the elements IDs
        map - index-id map
        Returns:
        a weights-view that is accessed by the elements indices
      • idToIndexWeights

        public static Weights.Double idToIndexWeights​(Weights.Double weights,
                                                      IndexIdMap 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.

        Parameters:
        weights - a weights container that is accessed by the elements IDs
        map - index-id map
        Returns:
        a weights-view that is accessed by the elements indices
      • indexWeightsFromWeights

        public static Weights.Bool indexWeightsFromWeights​(Weights.Bool weights,
                                                           IndexIdMap 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.

        Parameters:
        weights - a weights container that is accessed by the elements IDs
        map - index-id map
        Returns:
        a weights-view that is accessed by the elements indices
      • idToIndexWeights

        public static Weights.Char idToIndexWeights​(Weights.Char weights,
                                                    IndexIdMap map)
        Create a weights view that is accessed by the elements indices, given a weights container that is accessed by the elements IDs.

        The returned weights container is a view, namely modifying the original container change the new one, and vice versa.

        Parameters:
        weights - a weights container that is accessed by the elements IDs
        map - index-id map
        Returns:
        a weights-view that is accessed by the elements indices
      • idToIndexWeightFunc

        public static WeightFunction idToIndexWeightFunc​(WeightFunction w,
                                                         IndexIdMap map)
        Create a weight function that accept elements indices, given a weight function that accept elements IDs.
        Parameters:
        w - a weight function that accept by elements IDs
        map - index-id map
        Returns:
        a weight function that accept elements indices
      • idToIndexWeightFunc

        public static WeightFunction.Int idToIndexWeightFunc​(WeightFunction.Int w,
                                                             IndexIdMap map)
        Create a weight function that accept elements indices, given a weight function that accept elements IDs.
        Parameters:
        w - a weight function that accept by elements IDs
        map - index-id map
        Returns:
        a weight function that accept elements indices