AbstractThe number of groups.
Time: O(1).
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 indices in group groupId, in ascending order.
The result is a view of this partition's own array, not a copy.
Time: O(1).
group ID in 0..groupCount-1
indices in the group
Returns one value per group, combined from the values of its indices. The result is a typed
array of the type of values (Java: the int[] and double[] forms; here any typed array of
numbers).
For each group, starts from identity and combines the result so far with the value of each
index in the group, in ascending order of the indices. A group without indices gets
identity, and the values of indices in no group are left out. Each step is stored in the
element type, so an Int32Array wraps at 32 bits like Java's int, and a Float64Array
computes in double like Java. Here, byPackageCall groups the calls between the methods of a
program by the call between packages that each belongs to (see EdgePartition), and the
call sites in siteCount are summed per call between packages:
const packageSiteCount = byPackageCall.reduce(
siteCount,
0,
(sum, count) => sum + count,
);
// 2 for app -> ui, app -> service, service -> model and service -> storage,
// 1 for app -> cli and ui -> model
Time: O(indexCount + groupCount).
Memory: one element per group for the result: 4 x groupCount bytes for an Int32Array,
8 x groupCount bytes for a Float64Array.
the value of each index; length IndexMapping.indexCount
the start value of each group
called with the result so far and the value of the next index, returns the two combined
one value per group, by group ID
Returns one value per group, combined from the values of its indices, as the Int32Array form
does. Each step is stored in a BigInt64Array, so it wraps at 64 bits like Java's long.
Time: O(indexCount + groupCount). Memory: 8 x groupCount bytes for the result.
the value of each index; length IndexMapping.indexCount
the start value of each group
called with the result so far and the value of the next index, returns the two combined
one value per group, by group ID
Returns one value per group, combined from the values of its indices, as the BigInt64Array
form does. This is the form for unsigned 64-bit values. It is not in Java, which has no
unsigned long.
Time: O(indexCount + groupCount). Memory: 8 x groupCount bytes for the result.
Writes one value per group into groupValues, combined from the values of the indices of that
group. This is the form of reduce 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.
For each group, starts from the value of its first index and combines the result so far with
the value of each further index, in ascending order of the indices. A group without indices
keeps its entry in groupValues, and the values of indices in no group are left out.
Time: O(indexCount + groupCount).
the value of each index; length IndexMapping.indexCount
receives one value per group, by group ID; length
IndexPartition.groupCount, and not the same array as values
called with the result so far and the value of the next index, returns the two combined
A partition of indices into groups: the common base of NodePartition and EdgePartition.
The indices are node IDs or edge indices. Each index is in at most one group, and the groups are numbered by group ID
0..groupCount-1.get(i)returns the group of indexi, or-1if it is in no group, and IndexPartition.indicesOf the indices of a group in ascending order. IndexPartition.reduce combines data on the indices into one value per group. The data is an array indexed by node ID or edge index.A partition is a mapping from indices to groups that maps several indices to the same group, so unlike a NodeMapping or an EdgeMapping, it cannot be inverted.
Instances are immutable.
Memory: 4 x (indexCount + mappedCount + groupCount) bytes, where mappedCount is the number of indices that belong to a group.