Skip to content

Panic in traversal #1386

@barakatzir

Description

@barakatzir

What is the expected enhancement?

Currently, setting source to non present indices in bfs_search will panic.

Running

import rustworkx as rx
from rustworkx.visit import BFSVisitor

graph = rx.PyGraph()
rx.bfs_search(graph, [100], BFSVisitor())

raises:

Traceback (most recent call last):
pyo3_runtime.PanicException: put at index 100 exceeds fixedbitset size 0

I suggest:

  1. raising an IndexError instead.
  2. In rustworkx-core either returning an Error or documenting the panic behavior
  3. If needed do the same for other traversals (dfs, dijkstra).

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions