JuliaGraphs / JuliaGraphs/Graphs.jl
why is `enumerate_paths` not returning an iterator?
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 538
- Forks
- 128
- Avg merge
- 10h 25m
- Merged PRs (30d)
- 2
Description
Currently, the enumerate_paths function returns a vector which contains a bunch of things, depending on the type of state you put into it. Especially when looking at all shortest paths (for example from floyd_warshall_shortest_paths) of a graph with n nodes, this allocates a vector of length n which contains vectors of length n which in turn contain vectors of various lengths, containing the paths.
I feel like iterating over all paths is the main use case for this function, so it would make sense to me to return an iterator which runs over all paths, rather than to allocate a vector of paths. Is there some reason why this approach has not been considered?
Changing the behaviour of enumerate_paths would probably be breaking, so maybe, if there are no huge problems I missed, I propose we add this to the "Graphs 2.0" wishlist under issue #146.
If you think something like this would be a good addition, I might give it a go and build an iterate_paths function, once I find the time.
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
Start by reading the existing enumerate_paths entry point and how it is used for all shortest paths from floyd_warshall_shortest_paths. Review issue #146 for the proposed “Graphs 2.0” direction and determine the intended iterator API and compatibility expectations. Done should mean a reviewed iterator-based alternative that covers the relevant path enumeration use cases without the current eager allocation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100