Skip to content

fix: directedKey collision for vertex names containing arrow separator#59

Open
sauravbhattacharya001 wants to merge 1 commit intomasterfrom
fix/directed-key-collision
Open

fix: directedKey collision for vertex names containing arrow separator#59
sauravbhattacharya001 wants to merge 1 commit intomasterfrom
fix/directed-key-collision

Conversation

@sauravbhattacharya001
Copy link
Owner

Fixes #45

Problem: \directedKey(u, v)\ concatenated vertex names with ->, causing ambiguous keys when vertex names contain ->. Example: vertices \A->B\ and \C\ produce key \A->B->C, same as vertices \A\ and \B->C.

Fix: Changed all internal maps from \Map<String, ...>\ to \Map<List, ...>\ using \Arrays.asList(from, to)\ as keys. List equality is element-wise, eliminating collisions entirely.

Changes:

  • \directedKey()\ returns \List\ instead of \String\
  • All internal maps (
    esidualCapacity, \ low, \capacity, \�dgeLookup) use \List\ keys
  • Public API \getEdgeFlows()\ uses Unicode arrow for display keys

…FlowAnalyzer

directedKey() previously used string concatenation with '->' separator, causing
ambiguous keys when vertex names contain '->'. For example, vertices 'A->B' and
'C' produced key 'A->B->C', indistinguishable from vertices 'A' and 'B->C'.

Replace all internal Map<String, Double> keyed by directedKey with
Map<List<String>, Double> using Arrays.asList(from, to) as the key. This
eliminates the collision since List equality is element-wise.

Public API (getEdgeFlows) now uses Unicode arrow for display keys.

Fixes #45
@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/m labels Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m visualization Graph visualization and UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NetworkFlowAnalyzer: directedKey collision for vertex names containing arrow separator

1 participant