Skip to content

fix edge weights does not reflect edges added after construction - #438

Merged
sgrava merged 16 commits into
mainfrom
sg/431-edge_weights-does-not-reflect-edges-added-after-construction
Aug 13, 2026
Merged

sgrava merged 16 commits into
mainfrom
sg/431-edge_weights-does-not-reflect-edges-added-after-construction

Conversation

@sgrava

@sgrava sgrava commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Fix bug #431, where graph's weights were going out of sync when added after the creation of a graph.
Main fix is computing node coordinates and node/edge weights on the fly.

Changes

  1. removing _rested_dict() method and all its calls
  2. removing internal private dicts _coords, _node_weights, _edge_weights``
  3. DataGraph methods coords, node_weights and edge_weights now extract the attributes directly from the graph rather then relying on the internal dicts of point 2.

Additional Changes

  • removing redundant default constructors in BaseGraph and DataGraph.

@sgrava sgrava linked an issue Aug 7, 2026 that may be closed by this pull request
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-08-13 11:44 UTC

@sgrava sgrava added the bug Something isn't working label Aug 11, 2026
@sgrava
sgrava marked this pull request as ready for review August 12, 2026 15:21
@sgrava sgrava added this to the v1.4 milestone Aug 13, 2026
@sgrava
sgrava requested a review from abussy-pasqal August 13, 2026 07:10

@abussy-pasqal abussy-pasqal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand, data was duplicated between the inherited nx.Graph and internal dicts. And both were not syncronized correctly. So this PR removes the latter ?

@sgrava

sgrava commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator Author

If I understand, data was duplicated between the inherited nx.Graph and internal dicts. And both were not syncronized correctly. So this PR removes the latter ?

Correct! It removes the internal duplicated (but not updated) dicts.

@sgrava
sgrava merged commit 52dfc78 into main Aug 13, 2026
16 checks passed
@sgrava
sgrava deleted the sg/431-edge_weights-does-not-reflect-edges-added-after-construction branch August 13, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

edge_weights does not reflect edges added after construction

2 participants