Skip to content

Conversation

@networmix
Copy link
Owner

This pull request introduces enhancements to the calc_max_flow function. These changes enable sensitivity analysis and bottleneck edge identification.

Enhancements to calc_max_flow and related utilities:

  • Optional detailed outputs: Added return_summary and return_graph flags to calc_max_flow, enabling the function to return a FlowSummary object with detailed analytics and/or the mutated flow graph. The return type now supports multiple formats based on these flags.
  • New helper functions: Added saturated_edges to identify bottleneck edges and run_sensitivity to perform sensitivity analysis on edge capacities. These utilities provide deeper insights into capacity bottlenecks.
  • FlowSummary data structure: Introduced an immutable FlowSummary class to encapsulate edge flows, residual capacities, reachable nodes, and min-cut edges.

Updates to documentation and examples:

  • Advanced analysis section: Added a new section in docs/examples/basic.md demonstrating sensitivity analysis and bottleneck edge identification.
  • API documentation: Re-generated docs/reference/api-full.md to pick up new functionality.
  • Low-level analysis examples: Enhanced examples in docs/reference/api.md to include saturated_edges and run_sensitivity usage.

These changes make ngraph library more suitable for advanced network flow analysis. Close #16

networmix added 2 commits June 9, 2025 00:27
- Fixed incorrect network.to_graph() method call in basic.md
- Replaced basic Clos fabric test with proper hierarchical blueprint tests
- Renamed test_api_docs.py to test_doc_generation.py for clarity
- All documentation tests now correspond exactly to actual examples
- All 421 tests passing with 93.53% coverage
@networmix networmix self-assigned this Jun 9, 2025
Copilot AI review requested due to automatic review settings June 9, 2025 00:39
@networmix networmix added the enhancement New feature or request label Jun 9, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request enhances the max flow analysis capability in the ngraph library by introducing detailed analytics via the FlowSummary, additional helper functions for sensitivity analysis and bottleneck identification, and updated documentation and examples.

  • Enhanced calc_max_flow to optionally return elaborate flow analytics and the flow graph.
  • Added new helper functions (saturated_edges, run_sensitivity) for sensitivity and bottleneck analysis.
  • Updated test coverage and documentation examples to demonstrate the new analysis capabilities.

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/test_tutorial_docs.py Added tests for tutorial examples and network configuration
tests/test_reference_docs.py Updated tests for API/docs examples with new max flow features
tests/lib/algorithms/test_max_flow.py Extended unit tests for calc_max_flow and helper functions
ngraph/lib/algorithms/types.py Introduced immutable FlowSummary data structure
ngraph/lib/algorithms/max_flow.py Updated max flow implementation to support detailed analytics
docs/reference/api.md Updated API docs to include new flags and helper functions
docs/reference/api-full.md Updated full API reference including FlowSummary details
docs/examples/basic.md Added advanced analysis section with sensitivity analysis examples
Comments suppressed due to low confidence (1)

tests/lib/algorithms/test_max_flow.py:183

  • [nitpick] Consider renaming the fixture 'line1' to a more descriptive name (e.g., 'simple_graph') to improve readability and clarity in the tests.
def test_max_flow_return_summary_basic(self, line1):

cursor[bot]

This comment was marked as outdated.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
cursor[bot]

This comment was marked as outdated.

@networmix networmix merged commit fb38bb7 into main Jun 9, 2025
6 checks passed
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ BugBot reviewed your changes and found no bugs!


Was this report helpful? Give feedback by reacting with 👍 or 👎

@networmix networmix deleted the max_flow_impr branch June 9, 2025 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

Add bottleneck finding capability

2 participants