Skip to content

No weight information in calling yen_k_shortest_simple_paths(v, v, report_edges=True, report_weight=True) #40247

@kappybar

Description

@kappybar
Contributor

Steps To Reproduce

g = DiGraph([(1, 2)])
list(yen_k_shortest_simple_paths(g, 1, 1, report_edges=True, report_weight=True))

Expected Behavior

[(0, [])] (returned value shoud have weight information)

Actual Behavior

[[]]

Additional Information

We may be able to solve issue by updating this part

if source == target:

to this code.

if source == target:
     if report_weight:
          if report_edges:
               yield (0, [])
         else:
                yield (0, [source])
        else:
              if report_edges:
                  yield []
              else:
                    yield [source]
      return

Environment

  • OS: macOS Sequioa 15.3.1
  • Sage Version: 10.6

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
    I have read the documentation and troubleshoot guide

Activity

changed the title [-]<title> No weight information in calling `yen_k_shortest_simple_paths(v, v, report_edges=True, report_weight=True)`[/-] [+]No weight information in calling `yen_k_shortest_simple_paths(v, v, report_edges=True, report_weight=True)`[/+] on Jun 12, 2025
added 4 commits that reference this issue on Jun 17, 2025
b40085c
ddbb5b6
b5e7d98
9944efa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @dcoudert@kappybar

      Issue actions

        No weight information in calling `yen_k_shortest_simple_paths(v, v, report_edges=True, report_weight=True)` · Issue #40247 · sagemath/sage