diff --git a/docs/src/index.md b/docs/src/index.md index 0712df6..8bc0249 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -20,6 +20,8 @@ Because `SimpleWeighted(Di)Graph`s are stored in sparse matrices, they have two - Zero-weight edges are discarded by `add_edge!`. A possible workaround is to [set a very small weight instead](https://stackoverflow.com/questions/48977068/how-to-add-free-edge-to-graph-in-lightgraphs-julia/48994712#48994712). +In additions, self-loops are not supported. + ## Alternatives If your graphs have more than just edge weights to store, take a look at [MetaGraphsNext.jl](https://github.com/JuliaGraphs/MetaGraphsNext.jl) or [MetaGraphs.jl](https://github.com/JuliaGraphs/MetaGraphs.jl) for more complex formats. diff --git a/src/SimpleWeightedGraphs.jl b/src/SimpleWeightedGraphs.jl index 3111485..d2eb1c9 100644 --- a/src/SimpleWeightedGraphs.jl +++ b/src/SimpleWeightedGraphs.jl @@ -1,7 +1,7 @@ """ SimpleWeightedGraphs -A package for graphs with edge weights, stored as sparse adjacency matrices. +A package for graphs with edge weights and no self-loops, stored as sparse adjacency matrices. """ module SimpleWeightedGraphs diff --git a/src/simpleweighteddigraph.jl b/src/simpleweighteddigraph.jl index 2714f41..7c41c26 100644 --- a/src/simpleweighteddigraph.jl +++ b/src/simpleweighteddigraph.jl @@ -18,6 +18,7 @@ SimpleWeightedDiGraph(adjmx; permute) # from adjacency matrix, possibly transpo SimpleWeightedDiGraph(sources, destinations, weights) # from list of edges ``` Use `methods(SimpleWeightedDiGraph)` for the full list of constructors. +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). """ mutable struct SimpleWeightedDiGraph{T<:Integer,U<:Real} <: AbstractSimpleWeightedGraph{T,U} weights::SparseMatrixCSC{U,T} diff --git a/src/simpleweightedgraph.jl b/src/simpleweightedgraph.jl index 3d7d6ec..bfc990e 100644 --- a/src/simpleweightedgraph.jl +++ b/src/simpleweightedgraph.jl @@ -19,6 +19,7 @@ SimpleWeightedGraph(adjmx) # from adjacency matrix SimpleWeightedGraph(sources, destinations, weights) # from list of edges ``` Use `methods(SimpleWeightedGraph)` for the full list of constructors. +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). """ mutable struct SimpleWeightedGraph{T<:Integer,U<:Real} <: AbstractSimpleWeightedGraph{T,U} weights::SparseMatrixCSC{U,T}