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 Details Link icon

    • indexToIdIterator Link icon

      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 indices
      map - index-id mapping
      Returns:
      an iterator that iterate over the IDs matching the indices iterated by the original index-iterator
    • indexToIdIterator Link icon

      public static IntIterator indexToIdIterator(IntIterator indexIter, IndexIntIdMap 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 Link icon

      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 IDs
      map - index-id mapping
      Returns:
      an iterator that iterate over the indices matching the IDs iterated by the original ID-iterator
    • indexToIdEdgeIter Link icon

      public static <V, E> EdgeIter<V,E> indexToIdEdgeIter(Graph<V,E> g, IEdgeIter indexIter)
      Create an IEdgeIter that return IDs of vertices and edges from an IEdgeIter that return indices of vertices and edges.
      Type Parameters:
      V - the vertices type
      E - the edges type
      Parameters:
      g - the graph
      indexIter - an IEdgeIter that return indices of vertices and edges
      Returns:
      IEdgeIter that return IDs of vertices and edges matching the indices of vertices and edges returned by the original index-iterator
    • indexToIdEdgeIter Link icon

      public static IEdgeIter indexToIdEdgeIter(IntGraph g, IEdgeIter indexIter)
      Create an IEdgeIter that return IDs of vertices and edges from an IEdgeIter that return indices of vertices and edges.
      Parameters:
      g - the graph
      indexIter - an IEdgeIter that return indices of vertices and edges
      Returns:
      IEdgeIter that return IDs of vertices and edges matching the indices of vertices and edges returned by the original index-iterator
    • indexToIdEdgeSet Link icon

      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 type
      E - the edges type
      Parameters:
      indexSet - an indices edge set
      g - the graph
      Returns:
      an edge set of IDs matching the indices contained in the original index-set
    • indexToIdEdgeSet Link icon

      public static IEdgeSet indexToIdEdgeSet(IEdgeSet indexSet, IntGraph g)
      Create an edge set of IDs from an edge set of indices in an IntGraph.
      Parameters:
      indexSet - an indices edge set
      g - the graph
      Returns:
      an edge set of IDs matching the indices contained in the original index-set
    • indexToIdCollection Link icon

      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 indices
      map - index-id mapping
      Returns:
      a collection that contain IDs matching the indices contained in the original index-collection
    • indexToIdCollection Link icon

      public static IntCollection indexToIdCollection(IntCollection indexCollection, IndexIntIdMap map)
      Create an int 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
    • indexToIdSet Link icon

      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 indices
      map - index-id mapping
      Returns:
      a set that contain IDs matching the indices contained in the original index-set
    • indexToIdSet Link icon

      public static IntSet indexToIdSet(IntSet indexSet, IndexIntIdMap map)
      Create an IDs set from a set of indices.
      Parameters:
      indexSet - a set of indices
      map - index-id mapping
      Returns:
      a set that contain IDs matching the indices contained in the original index-set
    • idToIndexCollection Link icon

      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 IDs
      map - index-id mapping
      Returns:
      a collection that contain indices matching the IDs contained in the original ID-collection
    • idToIndexSet Link icon

      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 IDs
      map - index-id mapping
      Returns:
      a set that contain indices matching the IDs contained in the original ID-set
    • idToIndexList Link icon

      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 IDs
      map - index-id mapping
      Returns:
      a list that contain indices matching the IDs contained in the original ID-list
    • indexToIdList Link icon

      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 indices
      map - index-id mapping
      Returns:
      a list that contain IDs matching the indices contained in the original index-list
    • indexToIdList Link icon

      public static IntList indexToIdList(IntList indexList, IndexIntIdMap 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 Link icon

      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 type
      T - the weight type
      WeightsT - the weights container, used to avoid casts of containers of primitive types such as WeightsInt, WeightsDouble ect. The user should expect WeightsDouble only if a WeightsDouble object was passed as an argument.
      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 Link icon

      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 IDs
      map - index-id map
      Returns:
      a weight function that accept elements indices
    • idToIndexWeightFunc Link icon

      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 IDs
      map - index-id map
      Returns:
      an integer weight function that accept elements indices