-
Notifications
You must be signed in to change notification settings - Fork 194
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Information
Recently (see #971) the token swapper algorithm has been extended to support disconnected coupling maps, and in particular return an error rather than internally panic when swapping is not possible.
Here is an example where token swapper still internally panics.
let mut g = petgraph::graph::UnGraph::<(), ()>::new_undirected();
let a = g.add_node(());
let b = g.add_node(());
let c = g.add_node(());
let d = g.add_node(());
g.add_edge(c, d, ());
let mapping = HashMap::from([(a, b), (b, a)]);
let out = token_swapper(&g, mapping, Some(10), Some(4), Some(50));
Ideally this should return Err(MapNotPossible)
instead of panicking:
panicked at 'index out of bounds: the len is 0 but the index is 0', rustworkx-core\src\token_swapper.rs:305:40
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working