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

TypeError: draw_networkx_nodes() got an unexpected keyword argument 'with_labels' #242

Open
derrick710 opened this issue Apr 7, 2024 · 1 comment

Comments

@derrick710
Copy link

I am trying to recreate the GNNExplainer on Google Colab using the example xgraph_code_tutorial.ipynb. Everything works great until I try to visualize the graph. Thank you for your help

sparsity = 0.7
import matplotlib.pyplot as plt

# Visualization
gnnexplainer_related_preds = \
    gnnexplainer(data.x, data.edge_index, sparsity=sparsity, num_classes=num_classes, node_idx=node_idx)
ax, G = gnnexplainer.visualize_graph(node_idx=node_idx,
                                     edge_index=data.edge_index,
                                     edge_mask=gnnexplainer_related_preds[1][prediction],
                                     y=data.y)
plt.show()


TypeError                                 Traceback (most recent call last)
[<ipython-input-8-413a9bd50c1c>](https://localhost:8080/#) in <cell line: 7>()
      5 gnnexplainer_related_preds = \
      6     gnnexplainer(data.x, data.edge_index, sparsity=sparsity, num_classes=num_classes, node_idx=node_idx)
----> 7 ax, G = gnnexplainer.visualize_graph(node_idx=node_idx,
      8                                      edge_index=data.edge_index,
      9                                      edge_mask=gnnexplainer_related_preds[1][prediction],

[/usr/local/lib/python3.10/dist-packages/dig/xgraph/method/base_explainer.py](https://localhost:8080/#) in visualize_graph(self, node_idx, edge_index, edge_mask, y, threshold, nolabel, **kwargs)
    240                     connectionstyle="arc3,rad=0.08",  # rad control angle
    241                 ))
--> 242         nx.draw_networkx_nodes(G, pos, node_color=node_colors, **kwargs)
    243         # define node labels
    244         if self.molecule:

TypeError: draw_networkx_nodes() got an unexpected keyword argument 'with_labels'
@Moses14159
Copy link

I also have this problem

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