Cannot add edge with Num type weights (from Symbolics)
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
Research direction
Start at the add_edge! path shown in the MWE and inspect the zero-weight check that rejects Symbolics.jl Num values. Reproduce the example with SimpleWeightedDiGraph{Int,Num}, then verify that adding the symbolic edge succeeds without breaking the existing numeric-weight behavior.
Written by the indexing model from the issue text.
Description
Hi, so I'm trying to use the package for a graph with terms from Symbolics.jl as the weights. I'm pretty sure everything should work just fine except when I try to add a new edge via add_edge! which checks if the weight is zero and which does not work for these terms. For a MWE:
using Symbolics, SimpleWeightedGraphs, Graphs
g = SimpleWeightedDiGraph{Int,Num}(2)
add_edge!(g, 1, 2, 2.0) # works
@variables x
add_edge!(g, 1, 2, x) # does not work
This also seems like it could very well apply to other types, the problem here is the == operator does not do the same thing for Num. A simple fix may be to add this check in a try block and maybe print a warning that the check could not be done? Though such a warning should be toggleable to avoid excessive printing.
- Dominant language
- Julia
- Stars
- 41
- Forks
- 9
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 1
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from JuliaGraphs/SimpleWeightedGraphs.jl
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
JuliaGraphs/SimpleWeightedGraphs.jl#54 · 1 comment ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 25/100
JuliaGraphs/SimpleWeightedGraphs.jl#47 · 1 comment ·
-
bug question
Difficulty 5/5 Over a week Newbie friendliness 25/100
JuliaGraphs/SimpleWeightedGraphs.jl#43 · 2 comments ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 30/100
JuliaGraphs/SimpleWeightedGraphs.jl#25 · 3 comments ·
All issues in JuliaGraphs/SimpleWeightedGraphs.jl
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
JuliaStats/LogExpFunctions.jl#134 · 2 comments ·
-
code bug PowerSystems 6.0
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Sienna-Platform/PowerSystems.jl#1849 ·
Maintainers usually reply within 7 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
FluxML/Metalhead.jl#407 ·
Maintainers usually reply within 1 day