Graphity for TypeScript 3.0.0
    Preparing search index...

    Class IndexMappingAbstract

    A mapping from the indices 0..indexCount-1 to the indices of another numbering. It is the common base of the node and edge mappings and of the partitions.

    The indices are node IDs or edge indices. get(i) is the index that i maps to, or -1 if i is not mapped; a mapping with unmapped indices is partial. A NodeMapping maps the node IDs of one graph to those of another, and an EdgeMapping does the same for edge indices. Neither maps two indices to the same index, so both can be inverted. An IndexPartition maps indices to groups and lists the indices of each group. Several indices can map to the same group.

    That a node or edge mapping maps no two indices to the same index is a contract, not a check: NodeMapping.of accepts an array that breaks it, and only inverted and Graphs.remapped reject such a mapping.

    Instances are immutable.

    Memory: 4 x indexCount bytes; a partition holds more.

    Hierarchy (View Summary)

    Index
    • get indexCount(): number

      The number of indices this mapping maps from, mapped or not.

      It is the length of the arrays that gather returns and that reduce takes.

      Time: O(1).

      Returns number

    • get isPartial(): boolean

      Whether some index is not mapped. Equivalent to mappedCount < indexCount.

      Time: O(1).

      Returns boolean

    • get mappedCount(): number

      The number of indices that are mapped; in a partition, the number of indices that belong to a group.

      Time: O(1).

      Returns number

    • Returns the index that id maps to, or -1 if id is not mapped.

      In a partition, it is the group of id.

      Time: O(1).

      Parameters

      • id: number

        index in 0..indexCount-1

      Returns number

      index that id maps to, or -1

      RangeError if id is out of range

    • Returns whether id is mapped. Equivalent to get(id) !== -1.

      Time: O(1).

      Parameters

      • id: number

        index in 0..indexCount-1

      Returns boolean

      true if id is mapped

      RangeError if id is out of range