Skip to content

Commit 8788527

Browse files
committed
Clarify undefined behavior
1 parent 344b7ee commit 8788527

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/simpleweighteddigraph.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ SimpleWeightedDiGraph(adjmx; permute) # from adjacency matrix, possibly transpo
1818
SimpleWeightedDiGraph(sources, destinations, weights) # from list of edges
1919
```
2020
Use `methods(SimpleWeightedDiGraph)` for the full list of constructors.
21-
When building a new graph from a list of edges, you must avoid repeating `(src, dst)` pairs in the list: this can lead to undefined behavior.
21+
When building a new graph from a list of edges, be aware that repeating `(src, dst)` pairs may lead to undefined behavior (e.g. due to floating point errors during weight addition).
2222
"""
2323
mutable struct SimpleWeightedDiGraph{T<:Integer,U<:Real} <: AbstractSimpleWeightedGraph{T,U}
2424
weights::SparseMatrixCSC{U,T}

src/simpleweightedgraph.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ SimpleWeightedGraph(adjmx) # from adjacency matrix
1919
SimpleWeightedGraph(sources, destinations, weights) # from list of edges
2020
```
2121
Use `methods(SimpleWeightedGraph)` for the full list of constructors.
22-
When building a new graph from a list of edges, you must avoid repeating `(src, dst)` pairs in the list: this can lead to undefined behavior.
22+
When building a new graph from a list of edges, be aware that repeating `(src, dst)` pairs may lead to undefined behavior (e.g. due to floating point errors during weight addition).
2323
"""
2424
mutable struct SimpleWeightedGraph{T<:Integer,U<:Real} <: AbstractSimpleWeightedGraph{T,U}
2525
weights::SparseMatrixCSC{U,T}

0 commit comments

Comments
 (0)