Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
https://github.com/JuliaGraphs/LightGraphs.jl/pull/541#discussion_r11…
Browse files Browse the repository at this point in the history
…0540312
  • Loading branch information
sbromberger committed Apr 9, 2017
1 parent ff49e0c commit 2d997e1
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/flow/ext_multiroute_flow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ function auxiliaryPoints end
if expectedflow f # approximatively not equal (enforced by floating precision)
# if the slope difference between (middle) and left is at least 2
# push (left),(middle)
if s1 > s + 1 && (r2, f2) (r, f)
if s1 > s + 1 && !approximately_equal((r2, f2), (r, f))
q = (f1, s1, r1), (f, s, r)
push!(queue, q)
end
# if the slope difference between (middle) and right is at least 2
# push (middle),(right)
if s > s2 + 1 && (r1, f1) (r, f)
if s > s2 + 1 && !approximately_equal((r1, f1), (r, f))
q = (f, s, r), (f2, s2, r2)
push!(queue, q)
end
Expand Down Expand Up @@ -232,7 +232,7 @@ function intersection(
# Loop over the segments (pair of breaking points)
for (id, p) in enumerate(points[1:(end - 1)])
if id == 1
(k λ) && return points[2]
k λ && return points[2]
else
x, y = intersection(p[1], p[2], p[3], 0., 0., k)
(p[1] x points[id + 1][1]) && return x, y
Expand All @@ -243,9 +243,12 @@ function intersection(
end

"""
(a, b)
approximately_equal(a, b)
Redefinition of ≈ (isapprox) for a pair of points `a` and `b`.
Return true if each element in the tuple is approximately equal to its counterpart.
### Implementation Notes:
This is a separate function because we don't want to hijack isapprox for tuples.
"""
(a::Tuple{T, T}, b::Tuple{T, T}) where T <: AbstractFloat =
approximately_equal(a::Tuple{T, T}, b::Tuple{T, T}) where T <: AbstractFloat =
a[1] b[1] && a[2] b[2]

0 comments on commit 2d997e1

Please sign in to comment.