This repository was archived by the owner on Jun 18, 2026. It is now read-only.
Commit 7d99ed3
committed
perf(motif): use HashSet lookups in getLocalClustering instead of graph.isNeighbor
Replace JUNG's graph.isNeighbor() calls in the local clustering
coefficient computation with O(1) HashSet lookups. JUNG's isNeighbor
can be O(degree) per call, making the per-vertex cost O(k^3) for
high-degree nodes. The new approach builds neighbour sets on demand
(or reuses them if called during analyze()), reducing per-vertex cost
to O(k^2). This matches the pattern already used in findOpenPaths
and findSquares.1 parent 56c7bd1 commit 7d99ed3
1 file changed
Lines changed: 23 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
268 | 273 | | |
269 | 274 | | |
270 | 275 | | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
271 | 287 | | |
272 | 288 | | |
273 | | - | |
274 | | - | |
| 289 | + | |
| 290 | + | |
275 | 291 | | |
276 | 292 | | |
277 | 293 | | |
278 | 294 | | |
| 295 | + | |
279 | 296 | | |
280 | 297 | | |
| 298 | + | |
281 | 299 | | |
282 | | - | |
| 300 | + | |
283 | 301 | | |
284 | 302 | | |
285 | 303 | | |
286 | 304 | | |
287 | 305 | | |
288 | 306 | | |
289 | 307 | | |
| 308 | + | |
| 309 | + | |
290 | 310 | | |
291 | 311 | | |
292 | 312 | | |
| |||
0 commit comments