Skip to content

Acyclic::try_add_edge shouldn't err if the edge is already present #769

@marcospb19

Description

@marcospb19

The docs for try_add_edge say:

... (returns) [AcyclicEdgeError] if the edge would create a cycle, a self-loop or if the edge addition failed in the underlying graph.

I'm using GraphMap as the underlying graph, where you can add duplicated edges, I don't think any of these conditions are true but I'm getting an error.

Minimal repro:

fn main() {
    let mut graph = Acyclic::<GraphMap<usize, (), Directed>>::new();
    graph.add_node(0);
    graph.add_node(1);
    graph.try_add_edge(0, 1, ()).unwrap();
    graph.try_add_edge(0, 1, ()).unwrap(); // `Result::unwrap()` on an `Err` value: InvalidEdge
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions