JuliaGraphs / JuliaGraphs/SimpleWeightedGraphs.jl
Switch to an adjacency list storage of vertices.
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 41
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
This seems to be mostly equivalent to a sparse matrix (I mentioned slower access of weights, but using binary search, I think it should be same complexity than for a sparse matrix)
You can get back the sparse matrix by simply:
- collecting the weights in the order found in the adjacency list
- concatenating the outneighbors adjacency lists
- computing the cumulative degrees of the vertices.
As shown in the discussion, the benefit obtained by iterating simultaneously weights and vertices can be also achieved with the sparse matrix implementation, although it seems a bit slower.
The proposed implementation is by storing tuples in the adjacency lists, but it might be better to store in some aside adjacency list to avoid the penalty cost of accessing tuple when considering only neighbors. (we can still zip through both lists at the same time).
At this point, I think the bigger drawback will be the linear cost for generating the weight matrix, all other computations should be asymptotically equivalent.
I think we need some benchmarking to find the best implementation, by considering both the access of a single weight and the access of weights when iterating neighbors.
Contributor guide
No contributing guide indexed for this repository
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
Start with the linked Discourse conversation and examine the current sparse-matrix representation, adjacency lists, outneighbor access, and weight lookup behavior. Benchmark single-weight access and iteration over neighbors, then compare the proposed adjacency-list designs; done means selecting and implementing the best-supported storage approach.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100