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).
Whether some index is not mapped. Equivalent to mappedCount < indexCount.
Time: O(1).
The number of indices that are mapped; in a partition, the number of indices that belong to a group.
Time: O(1).
Returns the mapping that applies inner first and then this mapping.
If inner maps the edges of a graph A to those of B, and this mapping maps B to C, the result
maps A to C. An edge is not mapped in the result if inner does not map it, or if this mapping
does not map the edge that inner maps it to.
Time: O(inner.indexCount). Memory: 4 x inner.indexCount bytes for the result.
the mapping to apply first
the composed mapping
Returns values renumbered by this mapping: the value at position i of the result is
values[get(i)], or 0 if edge i is not mapped. The result is a typed array of the type of
values (Java: the int[], long[] and double[] forms; here any typed array).
For a mapping from new to old edge indices, as the factories return it, this carries data on
the edges of the old graph over to the new graph. The form with newValues does the same for
values of any kind.
Time: O(indexCount).
Memory: one element per index for the result: 4 x indexCount bytes for an Int32Array,
8 x indexCount bytes for a Float64Array or a BigInt64Array.
the value of each edge of the graph that this mapping maps to
the renumbered values, of length IndexMapping.indexCount
Writes values renumbered by this mapping into newValues, for values of any kind (Java: the
T[] form). The second argument selects this form, as in Java's overload resolution: the
values may be in any array-like, also in a typed array.
newValues[i] becomes values[get(i)], and stays as it is if edge i is not mapped.
References are copied, not the objects. If an error is thrown, newValues may be partly
written.
Time: O(indexCount).
the value of each edge of the graph that this mapping maps to
receives the renumbered values; length IndexMapping.indexCount, and
not the same array as values
Returns the inverse mapping, which maps get(e) back to e.
The inverse maps the targetCount edges of the graph that this mapping maps to; an edge that
no edge maps to is not mapped, and the inverse is then partial. For a mapping from new to old
edge indices, as the factories return it, targetCount is the edge count of the old graph, and
the inverse gives the new edge index of an old edge:
newToOld.inverted(oldGraph.edgeCount).get(oldEdge).
Time: O(indexCount + targetCount). Memory: 4 x targetCount bytes for the result.
the edge count of the graph that this mapping maps to
the inverse mapping, with an index count of targetCount
A mapping from the edge indices of one graph to those of another, to carry data on edges over to a subgraph, a renumbered graph or the transposed graph.
get(e)is the edge index that edgeemaps to, or-1if edgeeis not mapped. The factories return mappings from a new graph to an old one. These map each new edge to the edge it comes from. Graphs.edgeMapping derives one from the NodeMapping of a subgraph or a renumbering, and leaves a new edge without a counterpart in the old graph unmapped. Graphs.transposedEdgeMapping maps each edge of the transposed graph to the edge it reverses.EdgeMapping.gather carries data on the old edges over to the new ones. Here,
siteCountholds the number of call sites of each call by edge index ofcalls, and the subgraphloadingfrom the example at NodeMapping takes these counts along:EdgeMapping.inverted returns the mapping from old to new, and EdgeMapping.compose chains two mappings.
Instances are immutable.
Memory: 4 x indexCount bytes.