Skip to content

[BUG] enumerate_paths does not give all paths #478

@SimonEnsemble

Description

@SimonEnsemble

the function enumerate_paths, when passed a DijkstraState, does not enumerate all paths as advertised.

below, I create a minimal example.

	# construct graph
	my_g = SimpleGraph(5)
	add_edge!(my_g, 1, 2)
	add_edge!(my_g, 3, 2)
	add_edge!(my_g, 2, 4)
	add_edge!(my_g, 3, 4)
	add_edge!(my_g, 5, 4)
	add_edge!(my_g, 5, 3)

	# find all shortest paths from node 5 to other nodes
	my_dsp = dijkstra_shortest_paths(my_g, 5, allpaths=true)

	# enumerate paths from node 5 to 1
	print(enumerate_paths(my_dsp, 1)) # only gives one path!

	graphplot(my_g, nlabels=["$i" for i = 1:5])

Expected behavior
I expect enumerate_paths(my_dsp, 1) to give both:

[5, 3, 2, 1]

[5, 4, 2, 1]
Image

but it only gives one of the paths.

Version information

Julia Version 1.12.2
Commit ca9b6662be4 (2025-11-20 16:25 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 8 × Apple M3
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, apple-m3)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 4 virtual cores)

Status ~/.julia/environments/v1.12/Project.toml
[86223c79] Graphs v1.13.2


Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions