Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjacency list optimizations (#9444)
* Parameterize AdjacencyList * perf: reduce memory overhead in AdjacencyList Previously, we were allocating extra space for 'buckets' to accommodate hash collisions, but this turns out to waste a lot of space in large graphs. Additionally, we are no longer allocating space for nodes ahead of time; now, the nodes array will grow on demand, as edges are added. * refactor: extract edge linking behavior from addEdges method This unlocks the ability to resize without creating a new intermediary AdjacencyList. * fix: improve map capacity overflow detection * fix: resizing computations * Remove loadFactor * fix: node resizing * fix: avg collisions calculation * Rename capacity to initialCapacity * fix tests * fix: remove erroneous assertion The (incorrect) assumption was that there should be the same node record count after a resize of edges, but this is not necessarily the case; if there were deleted edges before the resize, then there may be node records that will also be deleted (by virtue of no longer having any edges connected to them) as part of the resize. * Enforce assumption that linked edge types must match * Add docs * Update AdjacencyList.md * Update AdjacencyList.md * Update AdjacencyList.md * Refactor link results to an enum * Update AdjacencyList.md
- Loading branch information