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

co-localization breaks when some nodes are strings #3

Closed brinrosenthal closed 7 years ago

brinrosenthal commented 7 years ago

G = nx.planted_partition_graph(3,20,.5,.01) G = nx.relabel_nodes(G,dict(zip(G.nodes(),[chr(n+97) if n < 25 else n for n in G.nodes()]))) visJS2jupyter.visualizations.draw_colocalization(G,G.nodes()[0:3],G.nodes()[35:37],export_network=False,k=1)

the error i get is:


ValueError Traceback (most recent call last)

in () ----> 1 visJS2jupyter.visualizations.draw_colocalization(G,G.nodes()[0:3],G.nodes()[35:37],export_network=False,k=1,graph_id=3) 2 #visJS2jupyter.visualizations.draw_heat_prop(G,G.nodes()[0:3],k=1,graph_id=3) /Users/brin/anaconda/lib/python2.7/site-packages/visJS2jupyter/visualizations.pyc in draw_colocalization(G, seed_nodes_1, seed_nodes_2, edge_cmap, export_file, export_network, highlight_nodes, k, largest_connected_component, node_cmap, node_size, num_nodes, physics_enabled, Wprime, **kwargs) 566 node_labels[node] = '' 567 else: --> 568 node_labels = {n:np.int64(n).item() for n in nodes} 569 570 nx.set_node_attributes(G,'nodeLabel',node_labels) /Users/brin/anaconda/lib/python2.7/site-packages/visJS2jupyter/visualizations.pyc in ((n,)) 566 node_labels[node] = '' 567 else: --> 568 node_labels = {n:np.int64(n).item() for n in nodes} 569 570 nx.set_node_attributes(G,'nodeLabel',node_labels) ValueError: invalid literal for long() with base 10: 'b'