This repository was archived by the owner on Jun 18, 2026. It is now read-only.
Commit 0dcba1c
committed
perf: replace O(V*d) edge counting with O(E) single-pass
countEdgesInSubgraph previously iterated each vertex's incident edges
and used a HashSet<edge> to deduplicate, resulting in O(Σdeg) time
plus O(E_sub) memory for the seen set and getEndpoints() overhead.
New implementation iterates graph.getEdges() once and checks endpoint
membership in the vertex set (O(1) HashSet lookups), eliminating the
deduplication set entirely. This is both faster and allocates less.1 parent 4b0731e commit 0dcba1c
1 file changed
Lines changed: 9 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
273 | 277 | | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
| |||
0 commit comments