JuliaGraphs / JuliaGraphs/Graphs.jl
`SimpleGraph(::Base.OneTo)`
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 538
- Forks
- 128
- Avg merge
- 10h 25m
- Merged PRs (30d)
- 2
Description
I think it would be helpful to add constructors:
SimpleGraph(Base.OneTo(4)) == SimpleGraph(4)
SimpleDiGraph(Base.OneTo(4)) == SimpleDiGraph(4)
representing the more general concept of constructing a graph from a set of vertices. It would enable writing generic code like:
rem_all_edges(g::AbstractGraph) = typeof(g)(vertices(g))
which would work with graphs that don't have simple vertices.
This is analogous to constructing Julia arrays from axes:
julia> zeros(Base.OneTo(3), Base.OneTo(3))
3×3 Matrix{Float64}:
0.0 0.0 0.0
0.0 0.0 0.0
0.0 0.0 0.0
(though for whatever reason Matrix{Float64}(undef, (Base.OneTo(3), Base.OneTo(3))) doesn't work).
Contributor guide
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.
Research direction
The issue names the SimpleGraph and SimpleDiGraph constructors but no files or tests. Start by locating those constructor entry points and the existing vertex-handling behavior; done means both Base.OneTo examples work and the generic rem_all_edges pattern can construct an equivalent graph.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100