2

I created a graph with networkx assigning properties to each node. Then, I used netgraph to display my graph in Jupiter Notebook (Python 3.5) as an Interactive graph (using netgraph.InteractiveGraph), the problem is that when I want to use a different shape for different nodes, the nodes aren't moving unless they all are the same figure.

If anyone knows how to solve this, please let me know! Below is my code. Thank you!

#Graph creation:
G=nx.Graph(type="")

for i in range(6):
     G.add_node(i,shape="o")

#Changing shape for two nodes
G.node[1]['shape'] = "v"
G.node[5]['shape'] = "v"

#Add edges
G.add_edge(1,2)
G.add_edge(4,5)
G.add_edge(0,4)
G.add_edge(2,3)
G.add_edge(2,4)

#Get node shapes
node_shapes = nx.get_node_attributes(G,"shape")

%matplotlib notebook

plot_instance =   netgraph.InteractiveGraph(G, node_shape=node_shapes)
Paul Brodersen
  • 11,221
  • 21
  • 38
  • Can you post the version of code where the interactivity works (inside Jupyter) and then show the change that causes it to stop responding? That will help those attempting to solve. Thanks – Ram Narasimhan Jun 15 '18 at 05:28
  • This is the part that creates the interactivity: **plot_instance=netgraph.InteractiveGraph(G,node_shape=node_shapes)** and I display it inside Jupyther with **matplotlib notebook** If I do this: **plot_instance = netgraph.InteractiveGraph(G)** it works fine, when I specify the shapes, it doesn't work. – Karla Godinez Jun 15 '18 at 08:14
  • 2
    I wrote `netgraph`. That is almost certainly a bug. If you raise an issue [on my github](https://github.com/paulbrodersen/netgraph) then I I won't forget to look into it early next week. Won't happen before as I had a really bad week and desperately need the weekend. Make sure to include your python version and your matplotlib version, and the netgraph version you are working on (`netgraph__version__`). – Paul Brodersen Jun 15 '18 at 16:45
  • thank you! it works now! – Karla Godinez Jun 19 '18 at 09:51

0 Answers0