Skip to content

DOC: Add float examples to minimum_cut and minimum_cut_value - #8414

Closed
Ashtam01 wants to merge 1 commit into
networkx:mainfrom
Ashtam01:doc/float-mincut-examples
Closed

Ashtam01 wants to merge 1 commit into
networkx:mainfrom
Ashtam01:doc/float-mincut-examples

Conversation

@Ashtam01

Copy link
Copy Markdown

Description

This PR adds examples to minimum_cut and minimum_cut_value docstrings to demonstrate how to handle floating-point capacities using math.isclose.

This addresses part of issue #8389.
(Note: maximum_flow examples are being handled in PR #8402).

Motivation

When using floating-point numbers for capacities, direct comparison (e.g. == 0.8) can lead to machine-dependent failures due to precision errors. The new examples guide users to use math.isclose for robust comparisons.

Tests

  • Ran pytest --doctest-modules networkx/algorithms/flow/maxflow.py locally and confirmed all tests passed.

@rossbar rossbar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is already a PR open (#8402) addressing this issue so I will close this to avoid fragmenting discussion. Generally it's a good idea to check if there are existing PRs for an issue and contribute to those discussions rather than opening new ones!

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants