paulbrodersen / netgraph

Publication-quality network visualisations in python
GNU General Public License v3.0
667 stars 40 forks source link

Bundle_parallel_edges problem #86

Closed lcastri closed 7 months ago

lcastri commented 7 months ago

Hi,

I'm encountering a strange issue with the bundle_parallel_edges parameter. I am generating the graph in the following way:

a = Graph(G, 
                    node_layout = 'dot',
                    node_size = 5,
                    node_color = 'orange',
                    node_label_fontdict = dict(size=14),
                    node_label_offset = 0.1,
                    node_alpha = 1,

                    arrows = True,
                    edge_layout = 'curved',
                    edge_label = False,
                    edge_color = 'grey', 
                    edge_width = edge_width,
                    edge_alpha = 1,
                    edge_zorder = 1,
                    edge_label_position = 0.35,
                    edge_layout_kwargs = dict(bundle_parallel_edges = True, k = 0.05))

where edge_width is defined as a dict containing different width for each edge. I get the following graph:

example

As you can see, there are 3 bi-directed edges: v <-> $g_r$, v <-> r, $\omega$ <-> $\theta_g$, but only the bi-directed link between $\omega$ and $\theta_g$ is in the desired format. Am I setting something incorrectly?

paulbrodersen commented 7 months ago

Wow, it fails not in one but in two different ways. That is impressive, and screwed up at the same time.

Can you paste the data and code required to generate G, and let me know what version (print(netgraph.__version__)) and/or which branch you are using?

lcastri commented 7 months ago

I am using the main branch version 4.13.2.

In the following a zip folder containing a json file and python script to generate the graph: dag

code_data.zip

paulbrodersen commented 7 months ago

It looks like I fixed the issue some time ago, when I overhauled the edge artists and edge routing routines to support multi-graph visualisations.

Figure_1

However, I haven't merged the dev branch since, as I am working on the next major release (and will be for some time). Until the next major version release, I would suggest using the dev branch. You can install the dev branch with:

pip install https://github.com/paulbrodersen/netgraph/archive/dev.zip

Let me know if that fixes the issue on your end, too.

lcastri commented 7 months ago

Yes, it works. Thanks :)

dag