networkx / nx-guides

Examples and Jupyter Notebooks about NetworkX
https://networkx.org/nx-guides/
Creative Commons Zero v1.0 Universal
192 stars 104 forks source link

draw_networkx_edge_labels does not work for multidigraph #79

Closed shivonkar closed 2 years ago

shivonkar commented 2 years ago

The dictionary returned by nx.get_edge_attributes has the structure (source, dest, enum):attr, where the third field just enumerates the occurrences of each edge. This third field is necessary because keys have to be unique in the dictionary. However this will imply that it cannot be used in nx.draw_networkx_edge_labels, because it expects a (source, dest):attr structured dict.

Any plan to fix this bug

dschult commented 2 years ago

I would not call this a bug -- rather a limitation. It is an intentional design due to the incomplete treatment of multiedges in our drawing package. If all the edges are drawn on top of each other how do we label the edges? You can, however, construct a single label for all the multiedges between two nodes and use that with the currently available tools.

I think the next step in solving this issue is to figure out a good way to handle drawing the multiedges.

dschult commented 2 years ago

I'm going to close this as it is not an issue with nx-guides, but with networkx itself. You can create a new issue on the networkx/networkx repository to continue the conversation (or you can still post here even with it closed).

shivonkar commented 1 year ago

Hi Dan,Thank you for replyYou have provided 'multidigraph' for multiple connections (with same source and atrget) and those are not met for display lebal for each edge. I beleive it is bug. Although, you have choice to fix or not Thank you, Shiv, 91-9108282540

On Friday, 6 May, 2022, 06:47:07 pm IST, Dan Schult ***@***.***> wrote:  

I would not call this a bug -- rather a limitation. It is an intentional design due to the incomplete treatment of multiedges in our drawing package. If all the edges are drawn on top of each other how do we label the edges? You can, however, construct a single label for all the multiedges between two nodes and use that with the currently available tools.

I think the next step in solving this issue is to figure out a good way to handle drawing the multiedges.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

dschult commented 1 year ago

The plans to fix this are to 1) allow the drawing of multiedges, which is proposed in the NetworkX PR #5882 2) build on that positioning of the multiedges to place the labels for the labels for those edges.

Suggestions are welcome in the main NetworkX repository. Thanks.