Skip to content

misra_gries_edge_color panicking on UnGraphMap #1593

@willchet

Description

@willchet

Information

  • rustworkx version: 0.17.1
  • Python version: N/A
  • Rust version: 1.96.0-nightly (900485642 2026-04-08)
  • Operating system: Fedora Linux 44 (Workstation Edition)

What is the current behavior?

When calling misra_gries_edge_color, I get a panic when passing an UnGraphMap. The panic occurs at rustworkx-core-0.17.1/src/coloring.rs:711:21 with message "edge not found".

The issue vanishes if I convert it to an UnGraph first. However, the documentation does not mention this as being a requirement.

What is the expected behavior?

The function should return DictMap with the coloring without panic.

Steps to reproduce the problem

Use the MWE:

use petgraph::prelude::UnGraphMap;
use rustworkx_core::coloring::misra_gries_edge_color;

fn main() {
    let mut my_graph: UnGraphMap<&str, &str> = UnGraphMap::new();

    my_graph.add_edge("Node 1", "Node 2", "Edge 1");
    my_graph.add_edge("Node 2", "Node 3", "Edge 2");

    misra_gries_edge_color(&my_graph);
}

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