Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'DummyVertex' object has no attribute 'data' #26

Closed
alabamagan opened this issue Sep 13, 2021 · 1 comment
Closed

AttributeError: 'DummyVertex' object has no attribute 'data' #26

alabamagan opened this issue Sep 13, 2021 · 1 comment

Comments

@alabamagan
Copy link

Reproducing Example:

import networkx as nx
import matplotlib.pyplot as plt
from netgraph import Graph

G = nx.DiGraph()
G.add_nodes_from([0, 1, 2, 3, 4])
G.add_edges_from([(0, 1),
                  (1, 2),
                  (0, 2),
                  (1, 3),
                  (3, 4)])
Graph(graph=G, arrows=True, node_layout='dot', node_labels=True,
      node_label_fontdict={'size':14}, node_label_offset=0.1)
plt.show()

This results in error:
AttributeError: 'DummyVertex' object has no attribute 'data'

My package versions are:

networkx=2.6.2
netgraph=4.0.4
grandalf=0.7

Possible fix:
_node_layout.py:588

    # extract node positions
    node_positions = dict()
    for v in graph.C[0].sV:
        node_positions[v.data] = v.view.xy
    # for layer in layout.layers:
    #     for vertex in layer:
    #         node_positions[vertex.data] = vertex.view.xy
@paulbrodersen
Copy link
Owner

Hi, thanks for raising the issue with a brilliant MWE. I had never seen a DummyVertex object before today. From the grandalf documentation:

The DummyVertex class is used by the sugiyama layout to represent
long edges, i.e. edges that span over several ranks.
For these edges, a DummyVertex is inserted in every inner layer.

I adopted a slightly different solution but the issue should be solved in the latest version on github, and I will push a new version to PyPI presently.

Again, thank you very much and have a great week!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants