@graphty/algorithms / index / GraphBitSet
Class: GraphBitSet ​
Defined in: optimized/bit-packed.ts:9
Wrapper around TypedFastBitSet with graph-specific optimizations
Provides efficient bit-packed set operations optimized for graph algorithms with 8x memory reduction compared to standard JavaScript Set for boolean values.
Constructors ​
Constructor ​
new GraphBitSet(
capacity?):GraphBitSet
Defined in: optimized/bit-packed.ts:17
Creates a new GraphBitSet with optional pre-allocated capacity.
Parameters ​
capacity? ​
number
The initial capacity to pre-allocate for the bitset
Returns ​
GraphBitSet
Methods ​
[iterator]() ​
[iterator]():
Generator<number>
Defined in: optimized/bit-packed.ts:107
Efficient iteration over all elements in the set.
Returns ​
Generator<number>
Yields ​
The indices of elements in the set
add() ​
add(
index):void
Defined in: optimized/bit-packed.ts:29
Add a single element to the set.
Parameters ​
index ​
number
The element index to add
Returns ​
void
addRange() ​
addRange(
start,end):void
Defined in: optimized/bit-packed.ts:77
Optimized for graph algorithms - add a range of indices.
Parameters ​
start ​
number
The starting index (inclusive)
end ​
number
The ending index (exclusive)
Returns ​
void
clear() ​
clear():
void
Defined in: optimized/bit-packed.ts:59
Clear all elements
Returns ​
void
clone() ​
clone():
GraphBitSet
Defined in: optimized/bit-packed.ts:152
Clone the bitset.
Returns ​
GraphBitSet
A new GraphBitSet with the same elements
difference() ​
difference(
other):void
Defined in: optimized/bit-packed.ts:140
Perform difference operation with another GraphBitSet, updating this set in place.
Parameters ​
other ​
GraphBitSet
The GraphBitSet to subtract from this set
Returns ​
void
has() ​
has(
index):boolean
Defined in: optimized/bit-packed.ts:52
Check if an element exists in the set.
Parameters ​
index ​
number
The element index to check
Returns ​
boolean
True if the element exists, false otherwise
intersection() ​
intersection(
other):void
Defined in: optimized/bit-packed.ts:128
Perform intersection operation with another GraphBitSet, updating this set in place.
Parameters ​
other ​
GraphBitSet
The GraphBitSet to intersect with
Returns ​
void
isEmpty() ​
isEmpty():
boolean
Defined in: optimized/bit-packed.ts:68
Check if the set is empty.
Returns ​
boolean
True if the set contains no elements, false otherwise
remove() ​
remove(
index):void
Defined in: optimized/bit-packed.ts:40
Remove a single element from the set.
Parameters ​
index ​
number
The element index to remove
Returns ​
void
size() ​
size():
number
Defined in: optimized/bit-packed.ts:90
Fast cardinality tracking - get the number of elements in the set.
Returns ​
number
The number of elements in the set
swap() ​
swap(
other):void
Defined in: optimized/bit-packed.ts:98
Batch operations for frontier management - swap contents with another GraphBitSet.
Parameters ​
other ​
GraphBitSet
The GraphBitSet to swap contents with
Returns ​
void
union() ​
union(
other):void
Defined in: optimized/bit-packed.ts:116
Perform union operation with another GraphBitSet, updating this set in place.
Parameters ​
other ​
GraphBitSet
The GraphBitSet to union with
Returns ​
void