ucsd-ccbb / visJS2jupyter

visJS2jupyter is a tool to bring the interactivity of networks created with vis.js into jupyter notebook cells
MIT License
78 stars 17 forks source link

Using version 0.18 and having issues. #7

Closed jmbertoncelli closed 6 years ago

jmbertoncelli commented 6 years ago

Hello

visJS2jupyter version 0.18 python 2.7.14 networkx 2.0

when running examples notebooks cell like:

define the initial positions of the nodes using networkx's spring_layout function, and add to the nodes_dict.

pos = nx.spring_layout(G) nodes_dict = [{"id":n, "x":pos[n][0]1000, "y":pos[n][1]1000} for n in nodes] node_map = dict(zip(nodes,range(len(nodes)))) # map to indices for source/target in edges

edges_dict = [{"source":node_map[edges[i][0]], "target":node_map[edges[i][1]], "title":'test'} for i in range(len(edges))]

visJS2jupyter.visJS_module.visjs_network(nodes_dict,edges_dict)

I get this error: TypeError: 'int' object is not iterable

or when running this cell:

add a node attributes to color-code by

cc = nx.clustering(G) degree = G.degree() bc = nx.betweenness_centrality(G) nx.set_node_attributes(G,'clustering_coefficient',cc) nx.set_node_attributes(G,'degree',degree) nx.set_node_attributes(G,'betweenness_centrality',bc)

I get this error: TypeError: unhashable type: 'dict'

let me know if you need more information.

Thanks in advance for your help.

JM

m1webste commented 6 years ago

I also have those same specifications (nx = 2.0, python = 2.7.14, visJS = 0.1.8) and I do not get those errors. I think the problem may be that you haven't updated your notebooks in addition to updating visJS. The current implementation you are displaying was updated to be compatible with nx 2.0. (for example, nx.set_node_attributes(G, 'clustering_coefficient',cc) was changed to nx.set_node_attributes(G, name = 'clustering_coefficient', values = cc) ). Let me know if after re-downloading the notebooks, you still are having problems

jmbertoncelli commented 6 years ago

Hi!

Thanks for your answer! I did download all the notebooks as well as the data needed to execute them. All work but one, this is the error.

[cid:image001.jpg@01D370BD.E0B58A40]

I do not think that has anything to do with the graph package but would be nice to have a no fault set of notebooks.

Thanks again what you have done is awesome!

JM

From: m1webste [mailto:notifications@github.com] Sent: Friday, December 8, 2017 12:11 PM To: ucsd-ccbb/visJS2jupyter visJS2jupyter@noreply.github.com Cc: jmbertoncelli jmbertoncelli@msn.com; Author author@noreply.github.com Subject: Re: [ucsd-ccbb/visJS2jupyter] Using version 0.18 and having issues. (#7)

I also have those same specifications (nx = 2.0, python = 2.7.14, visJS = 0.1.8) and I do not get those errors. I think the problem may be that you haven't updated your notebooks in addition to updating visJS. The current implementation you are displaying was updated to be compatible with nx 2.0. (for example, nx.set_node_attributes(G, 'clustering_coefficient',cc) was changed to nx.set_node_attributes(G, name = 'clustering_coefficient', values = cc) ). Let me know if after re-downloading the notebooks, you still are having problems

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ucsd-ccbb/visJS2jupyter/issues/7#issuecomment-350332613, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJNhY1hA2snlysDNX-79vNsOpn9qEB4zks5s-Xu3gaJpZM4Q7Fa3.

m1webste commented 6 years ago

What was the name of the notebook that failed for you?