Skip to content

perf: use double instead of float for edge weights#87

Open
sauravbhattacharya001 wants to merge 1 commit intomasterfrom
perf/edge-double-weight
Open

perf: use double instead of float for edge weights#87
sauravbhattacharya001 wants to merge 1 commit intomasterfrom
perf/edge-double-weight

Conversation

@sauravbhattacharya001
Copy link
Owner

Edge weight was stored as float but every algorithm operates on double internally, causing implicit widening on every getWeight() call in hot loops. Changes weight field to double and parser to Double.parseDouble.

The edge weight field was stored as float but every algorithm
(Dijkstra, Louvain, ForceDirected, PageRank, etc.) operates on
doubles internally. This caused implicit float-to-double widening
on every getWeight() call in hot loops.

Changes:
- edge.java: weight field float -> double, getter/setter updated
- GraphFileParser: Float.parseFloat -> Double.parseDouble for
  precision and to avoid widening on store
- All existing float literal callers auto-widen safely (no source
  changes needed)
@chatgpt-codex-connector
Copy link

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 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s visualization Graph visualization and UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant