Skip to content
This repository was archived by the owner on Jun 18, 2026. It is now read-only.

refactor: consolidate adjacency/neighbor cache to GraphUtils (3 analyzers) - #73

Merged
sauravbhattacharya001 merged 1 commit into
masterfrom
refactor/consolidate-adjacency-utils
Mar 14, 2026
Merged

sauravbhattacharya001 merged 1 commit into
masterfrom
refactor/consolidate-adjacency-utils

Conversation

@sauravbhattacharya001

Copy link
Copy Markdown
Owner

Summary

Consolidates duplicated adjacency-building code in 3 analyzers to use the shared \GraphUtils.buildAdjacencyMap()\ method.

Changes

  • StructuralHoleAnalyzer: Replaced private \�uildNeighborCache()\ (10 lines) with single \GraphUtils.buildAdjacencyMap()\ call. Field is now \ inal.
  • NodeSimilarityAnalyzer: Replaced lazy per-node cache population with eager \GraphUtils.buildAdjacencyMap()\ initialization.
  • GrowthRateAnalyzer: \computeAvgClustering()\ now uses adjacency map + O(1) set lookups instead of \graph.isNeighbor()\ calls for triangle counting.

Impact

  • ~10 lines of duplicated code removed
  • Consistent adjacency construction across all analyzers
  • Performance improvement in GrowthRateAnalyzer triangle counting (set contains vs isNeighbor)

Part of #43

…encyMap

- StructuralHoleAnalyzer: replace private buildNeighborCache() with
  GraphUtils.buildAdjacencyMap(), eliminating 10 lines of duplicate code.
  Field is now final for thread safety.

- NodeSimilarityAnalyzer: eager-initialize neighborCache via
  GraphUtils.buildAdjacencyMap() instead of lazy per-node population.
  Simpler, consistent, and avoids redundant graph.getNeighbors() calls.

- GrowthRateAnalyzer: computeAvgClustering now uses
  GraphUtils.buildAdjacencyMap() + set lookup instead of
  graph.getNeighbors() + graph.isNeighbor(). This replaces O(degree)
  isNeighbor checks with O(1) set contains, improving triangle counting
  performance on dense graphs.

Part of #43
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions github-actions Bot added visualization Graph visualization and UI size/s labels Mar 14, 2026
@sauravbhattacharya001
sauravbhattacharya001 merged commit 93b3a16 into master Mar 14, 2026
3 of 7 checks passed
@sauravbhattacharya001
sauravbhattacharya001 deleted the refactor/consolidate-adjacency-utils branch March 14, 2026 08:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size/s visualization Graph visualization and UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant