You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the method rustworkx.PyGraph.remove_edge is only taking parent and child as input: def remove_edge(self, parent: int, child: int, /) -> None: ...
In the function description, it says:
Note if there are multiple edges between the specified nodes only one will be removed.
But this is ambiguous. Which one of these edge will be exactly removed? It seems random and it caused some trouble.
Can you please modify the function input so we can specify edge to be removed?
Just like add_edge(self, parent: int, child: int, edge: _T, /) function
The text was updated successfully, but these errors were encountered:
As you can see PyGraph.remove_edge was not designed with multigraphs in mind. The functionality you want though, already exists with PyGraph.remove_edge_from_index. If you want to delete a specific edge between the many edges between nodes A and B, you will need to disambiguate with the edge index.
Maybe a follow up question is on how to find the edge index. The most straightforward way is to keep the index from PyGraph.add_edge or related methods, that for sure works. But let's say that is not possible, you can still query all edge indices with PyGraph.edge_indices_from_endpoints and then narrow down the edge you want to delete.
I think there might be a value adding a function such as PyGraph.remove_matching_edges(parent, child, value). But we will need to narrow down if we want to remove one occurrence, all occurrences or let the user specify how many values they want removed.
What is the expected enhancement?
Currently the method
rustworkx.PyGraph.remove_edge
is only takingparent
andchild
as input:def remove_edge(self, parent: int, child: int, /) -> None: ...
In the function description, it says:
But this is ambiguous. Which one of these edge will be exactly removed? It seems random and it caused some trouble.
Can you please modify the function input so we can specify
edge
to be removed?Just like
add_edge(self, parent: int, child: int, edge: _T, /)
functionThe text was updated successfully, but these errors were encountered: