Repository navigation
52 float cutoff - #152
Open
eriknw wants to merge 1 commit into
Open
52 float cutoff#152eriknw wants to merge 1 commit into
eriknw wants to merge 1 commit into
Conversation
NetworkX's breadth-first walks step on while `cutoff > level`, so a cutoff of 2.5 reaches nodes three edges out, and NaN, 0 or a negative cutoff the source alone. The backend passed the bound to `range`, which raised TypeError for any float cutoff of single_source_shortest_path_length, single_target_shortest_path_length and all_pairs_shortest_path_length, for a float radius of ego_graph, and for a NaN or -inf depth_limit of bfs_edges and bfs_successors. descendants_at_distance gives the layer whose index equals `distance`, so none for 2.5, NaN, inf or a negative distance. The backend raised TypeError for a float and gave the source for a negative int. ego_graph with `distance` follows NetworkX's Dijkstra, which drops a length greater than the radius. A NaN radius drops none, where the backend could keep the center alone. Where the edges do not carry `distance`, each counts 1, so 2.5 reaches nodes two edges out. An int radius past every float no longer raises OverflowError. A bound of another type, such as a str, Decimal, Fraction or numpy bool, is left to NetworkX, which compares it by its own rules. A numpy float is read as a Python float, so no comparison casts a node count or the largest float down to its type, which numpy would warn of.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 34-nan-weights #152 +/- ##
==================================================
+ Coverage 93.28% 93.52% +0.23%
==================================================
Files 183 184 +1
Lines 11795 11953 +158
Branches 1339 1351 +12
==================================================
+ Hits 11003 11179 +176
+ Misses 544 523 -21
- Partials 248 251 +3 🚀 New features to boost your workflow:
|
eriknw
force-pushed
the
34-nan-weights
branch
from
December 3, 2026 07:06
87bc219 to
abba0dc
Compare
eriknw
force-pushed
the
52-float-cutoff
branch
from
December 3, 2026 07:06
a176044 to
dd47e90
Compare
eriknw
force-pushed
the
34-nan-weights
branch
from
December 3, 2026 08:01
abba0dc to
f4faf1b
Compare
eriknw
force-pushed
the
52-float-cutoff
branch
from
December 3, 2026 08:01
dd47e90 to
fdd41d2
Compare
eriknw
force-pushed
the
34-nan-weights
branch
from
December 3, 2026 08:59
f4faf1b to
f9c1c17
Compare
eriknw
force-pushed
the
52-float-cutoff
branch
from
December 3, 2026 08:59
fdd41d2 to
82ad51f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This reads a bound on the levels of a breadth-first walk as NetworkX reads it. NetworkX steps on while
cutoff > level, so a cutoff of 2.5 reaches nodes three edges out, and NaN, 0 or a negative cutoff reaches the source alone. The backend passed the bound torange, so a float cutoff raised TypeError where NetworkX answers. On the path 0-1-2-3-4-5, NetworkX'ssingle_source_shortest_path_lengthfrom 0 withcutoff=2.5gives{0: 0, 1: 1, 2: 2, 3: 3}, where the backend raised "'float' object cannot be interpreted as an integer".single_source_shortest_path_length,single_target_shortest_path_lengthandall_pairs_shortest_path_lengthtake a float, NaN, infinite or negativecutoff, in every batch width of the last.bfs_edgesandbfs_successorstake a NaN or -infdepth_limitand yield no edges, as NetworkX does. Before, NaN raised TypeError and -inf raised OverflowError. A float limit already rounded up as NetworkX's does.descendants_at_distancegives the layer whose index equalsdistance, as NetworkX does, so an empty set for 2.5, NaN, inf or a negative distance. Before, a float raised TypeError, and a negative int gave the source.ego_graphfollows NetworkX on a float or NaN radius. Withoutdistance, the radius is a cutoff as above, so 2.5 reaches nodes three edges out and NaN reaches only the center; the backend raised TypeError for any float radius. Withdistance, NetworkX's Dijkstra drops a length greater than the radius, so a NaN radius drops none, where the backend could keep the center alone. Where the edges do not carrydistance, each counts 1, so 2.5 reaches nodes two edges out. An int radius past every float no longer raises OverflowError.Decimal,Fractionor numpy bool, is left to NetworkX, which compares it by its own rules. Before, a str raised TypeError with another message, and aDecimalorFractionradius withdistanceraised where NetworkX answers.descendants_at_distancestill serves any type, since it compares as NetworkX does.-W errorwould turn into an exception NetworkX does not raise.Stacked on #132.