Skip to content

Fix #553: Handle visualization of empty graphs#562

Open
matulni wants to merge 2 commits into
TeamGraphix:masterfrom
matulni:fix553-empty_graphs
Open

Fix #553: Handle visualization of empty graphs#562
matulni wants to merge 2 commits into
TeamGraphix:masterfrom
matulni:fix553-empty_graphs

Conversation

@matulni

@matulni matulni commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Visualization methods yield an empty canvas instead of raising a ValueError when called on an empty graph.

@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.62%. Comparing base (2351197) to head (9daa53a).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #562      +/-   ##
==========================================
+ Coverage   90.58%   90.62%   +0.04%     
==========================================
  Files          49       49              
  Lines        7481     7481              
==========================================
+ Hits         6777     6780       +3     
+ Misses        704      701       -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread graphix/visualization.py Outdated
Comment on lines +219 to +226
if not og.graph.nodes:
return GraphVisualizer(
og=og,
pos={},
edge_paths={},
options=options,
_source=_Source.OG,
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would add the following lines at the beginning of _compute_positions for OpenGraph:

    if not obj.graph.nodes:
        return {}

The idea is that we don't need a special execution path here and to re‑specify all of the arguments for GraphVisualizer.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You are right, much cleaner this way. Done in 9daa53a

Comment thread graphix/visualization.py Outdated
Comment on lines +257 to +264
if not flow.og.graph.nodes:
return GraphVisualizer(
og=flow.og,
pos={},
edge_paths={},
options=options,
_source=_Source.Flow,
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we need this? I think the default behavior should be sufficient.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, indeed, removed in 9daa53a

Comment thread graphix/visualization.py Outdated
Comment on lines +300 to +307
if not xz_corr.og.graph.nodes:
return GraphVisualizer(
og=xz_corr.og,
pos={},
edge_paths={},
options=options,
_source=_Source.XZCorr,
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we need this? I think the default behavior should be sufficient.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed in 9daa53a

@thierry-martinez thierry-martinez left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants