Skip to content

Commit 289d729

Browse files
authored
Add details to the docs fixing #8 and #9 (#42)
fix #8 and #9 by - specifying that self-loops are not supported - specifying that constructors from edge lists should avoid duplicate edges
1 parent d995ffd commit 289d729

File tree

4 files changed

+5
-1
lines changed

4 files changed

+5
-1
lines changed

docs/src/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Because `SimpleWeighted(Di)Graph`s are stored in sparse matrices, they have two
2020

2121
- 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).
2222

23+
In additions, self-loops are not supported.
24+
2325
## Alternatives
2426

2527
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.

src/SimpleWeightedGraphs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
SimpleWeightedGraphs
33
4-
A package for graphs with edge weights, stored as sparse adjacency matrices.
4+
A package for graphs with edge weights and no self-loops, stored as sparse adjacency matrices.
55
"""
66
module SimpleWeightedGraphs
77

src/simpleweighteddigraph.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +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, be aware that repeating `(src, dst)` pairs may lead to undefined behavior (e.g. due to floating point errors during weight addition).
2122
"""
2223
mutable struct SimpleWeightedDiGraph{T<:Integer,U<:Real} <: AbstractSimpleWeightedGraph{T,U}
2324
weights::SparseMatrixCSC{U,T}

src/simpleweightedgraph.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +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, be aware that repeating `(src, dst)` pairs may lead to undefined behavior (e.g. due to floating point errors during weight addition).
2223
"""
2324
mutable struct SimpleWeightedGraph{T<:Integer,U<:Real} <: AbstractSimpleWeightedGraph{T,U}
2425
weights::SparseMatrixCSC{U,T}

0 commit comments

Comments
 (0)