-
Notifications
You must be signed in to change notification settings - Fork 0
Add network statistics workflow step #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add network statistics workflow step #80
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds a new NetworkStats workflow step that computes basic capacity and degree statistics for network links and nodes, along with tests and documentation updates.
- Implemented and registered the
NetworkStatsstep in the workflow package. - Added a unit test to verify link and per-node statistics.
- Updated DSL, CLI, and API reference docs to include the new step.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| ngraph/workflow/network_stats.py | Implements the NetworkStats step and registers it. |
| ngraph/workflow/init.py | Exports NetworkStats in the workflow package. |
| tests/workflow/test_network_stats.py | Adds unit test for the new workflow step. |
| docs/reference/dsl.md | Documents NetworkStats in the DSL reference. |
| docs/reference/cli.md | Adds NetworkStats to CLI output documentation. |
| docs/reference/api.md | Includes NetworkStats in the API reference list. |
| docs/reference/api-full.md | Provides full API docs for NetworkStats. |
Comments suppressed due to low confidence (2)
tests/workflow/test_network_stats.py:52
- This test validates link and per-node stats but does not assert on
node_capacityandnode_degreedistributions. Consider adding assertions for those keys to ensure full coverage of the new workflow step.
assert set(per_node.keys()) == {"A", "B", "C"}
docs/reference/api.md:201
- The
NetworkStatsentry appears to be commented out; remove the leading#so it renders properly in the list of available workflow steps.
# - NetworkStats: Computes basic capacity and degree statistics
| link_caps_sorted = sorted(link_caps) | ||
| link_stats = { | ||
| "values": link_caps_sorted, | ||
| "min": min(link_caps_sorted) if link_caps_sorted else 0.0, | ||
| "max": max(link_caps_sorted) if link_caps_sorted else 0.0, | ||
| "mean": mean(link_caps_sorted) if link_caps_sorted else 0.0, | ||
| "median": median(link_caps_sorted) if link_caps_sorted else 0.0, | ||
| } |
Copilot
AI
Jul 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic for building distribution stats is duplicated for links, node capacities, and node degrees. Consider extracting this into a helper function to reduce repetition and improve readability.
| link_caps_sorted = sorted(link_caps) | |
| link_stats = { | |
| "values": link_caps_sorted, | |
| "min": min(link_caps_sorted) if link_caps_sorted else 0.0, | |
| "max": max(link_caps_sorted) if link_caps_sorted else 0.0, | |
| "mean": mean(link_caps_sorted) if link_caps_sorted else 0.0, | |
| "median": median(link_caps_sorted) if link_caps_sorted else 0.0, | |
| } | |
| link_stats = self.compute_distribution_stats(link_caps) |
… of disabled nodes and links in statistics. Update related logic and tests to ensure backward compatibility and correct behavior.
Summary
NetworkStatsworkflow step to compute base capacity and degree statsNetworkStatsfrom workflow packageTesting
make formatmake check