I managed to solve half of my issue so I modified this post, the only problem I encounter now is a error type that has no record to find a solution, if anyone know why this error happens and can give me some advice or some links lead my way to a solution, it will be appreciate.
My nodes are list of lists from Dataframe, my edges are from a list of tuples.
I know below error may due to my nodes and edges involved in G=nx.Graph(), but they run well if I just need a static plot, but no idea how to modify it when I need a dynamic graph.
Below is part of my code:
...
nodelist = [A, B, C, D, E, F, G, H, N, O, P, Q, R]
#create empty graph
G = nx.Graph()
node_list = []
for sublist in nodelist:
for item in sublist:
node_list.append(item)
for i in node_list:
G.add_node(i)
G.nodes()
edges = set(AB+BC+CN+NE+ED+DO+OP+PQ+QH+HG+GF+FR+BE+HR)
# edges
G.add_edges_from(edges)
pos = nx.fruchterman_reingold_layout(G, scale=4)
#nx.draw_networkx(G, pos=pos, nodelist=nodelist[0], with_labels=False, node_size=10, node_color='#FF0000', font_size=5, width=2)
...
plot = Plot(plot_width=400, plot_height=400,x_range=Range1d(-1.1, 1.1), y_range=Range1d(-1.1, 1.1))
title = "track-dynamic graph"
HOVER_TOOLTIPS = [("a", "@index"), ("b", "@type")]
plot = figure(tooltips = HOVER_TOOLTIPS, tools="pan,wheel_zoom,save,reset", active_scroll='wheel_zoom',x_range=Range1d(-10.1, 10.1), y_range=Range1d(-10.1, 10.1), title=title)
network_graph = from_networkx(G, nx.spring_layout, scale=10, center=(0, 0))
network_graph.node_renderer.glyph = Circle(size=3, fill_color='blue')
network_graph.edge_renderer.glyph = MultiLine(line_alpha=0.5, line_width=1)
plot.renderers.append(network_graph)
show(plot)
Above bokeh code gives me below error:
ValueError: failed to validate StaticLayoutProvider(id='1058', ...).graph_layout: expected an element of Dict(Either(String, Int), Seq(Any)), got {'6600d5067598ac904ac8e1ed3d3760c0': array([-1.67995763, 3.53275585]), 'd151da7d698cd5a6f6957ca77549ebbe': array([-5.69608212, 0.91764808])...