java.lang.Object
com.here.platform.location.inmemory.graph.GraphTile

public class GraphTile extends Object
Contains the routing graph data for a single tile.

The graph topology is stored in compressed sparse row graph format. It also contains information on how the graph partitions are interconnected, i.e. graph edges from this tile to another.

Vertex indices 0 through firstEdgeIndices.length - 2 refer to internal vertices (vertices in this partition).

The last entry of firstEdgeIndices is always edges.length.

Thus, each entry in firstEdgeIndices is the index of the edge after the last edge of the previous vertex.

That means, the edges starting at a given internal vertex with index idx, are determined by the index range from firstEdgeIndices(idx) (inclusive) to firstEdgeIndices(idx + 1) (exclusive).

Vertex indices firstEdgeIndices.length - 1 through firstEdgeIndices.length + externalVertexIndices.length - 2 refer to external vertices (vertices outside this partition that are referred to from inside this partition).

Therefore, the number of external vertices is externalVertexIndices.length.

When looking up a vertex v with index idx: - If idx < firstEdgeIndices.length - 1, v is in the current graph partition. - Otherwise, v belongs to the tile with ID externalVertexTileIds(idx - firstEdgeIndices.length + 1) and its index in that partition is externalVertexIndices(idx - firstEdgeIndices.length + 1).

See also

  • TiledGraph
  • The section on "The Compressed Sparse Row Format" in the Location Library developer guide

param: firstEdgeIndices For every vertex, the index of its first edge. The value at a given index v corresponds to the index of the first edge that starts at the vertex in this partition with vertex index v param: edges For every edge, the index of its target vertex. The value at a given index e corresponds to the index of the target vertex of the edge with index e in this partition param: externalVertexTileIds The tile ID of each vertex in another tile that is the target of at least one edge starting at a vertex in this tile param: externalVertexIndices The vertex index of each vertex in another tile that is the target of at least one edge starting at a vertex in this tile

Note:
Although this object contains Arrays, you should treat it as immutable.
  • Constructor Details

    • GraphTile

      public GraphTile(TileId tileId, int[] firstEdgeIndices, int[] edges, long[] externalVertexTileIds, int[] externalVertexIndices)
  • Method Details

    • requireMonotonical

      public static void requireMonotonical(TileId tileId, scala.Option<Object> until, int[] array, String arrayName)
    • requireSameLength

      public static void requireSameLength(TileId tileId, int sizeA, int sizeB, String nameA, String nameB)
    • tileId

      public TileId tileId()
    • firstEdgeIndices

      public int[] firstEdgeIndices()
    • edges

      public int[] edges()
    • externalVertexTileIds

      public long[] externalVertexTileIds()
    • externalVertexIndices

      public int[] externalVertexIndices()
    • internalVertexCount

      public int internalVertexCount()
      The number of vertices that belong to this GraphTile.
    • externalVertexCount

      public int externalVertexCount()
      The number of external vertices referenced by this GraphTile.

      An external vertex is a vertex that belongs to another GraphTile but is the target of at least one edge originating at a vertex belonging to this tile.

    • vertexCount

      public int vertexCount()
      The total number of internal and external Vertices in this GraphTile.
    • internalEdgeCount

      public int internalEdgeCount()
      The number of edges whose source vertex belong to this GraphTile.