Networkx import and PointDrawTool

Hi,
I am new to Bokeh and wondering, if the PointDrawTool supports the graph_renderer.node_renderer? I am asking because I would like to interactively move the nodes of a networkx graph. My code example is the following:

import networkx as nx

from bokeh.io import show, output_file
from bokeh.models import Plot, Range1d, MultiLine, Circle, HoverTool, BoxZoomTool, ResetTool, PointDrawTool
from bokeh.models.graphs import from_networkx
from bokeh.palettes import Spectral4

import bokeh.plotting as bpl

bpl.output_notebook()

# Prepare Data
G = nx.karate_club_graph()

SAME_CLUB_COLOR, DIFFERENT_CLUB_COLOR = "black", "red"
edge_attrs = {}

for start_node, end_node, _ in G.edges(data=True):
   edge_color = SAME_CLUB_COLOR if G.nodes[start_node]["club"] == G.nodes[end_node]["club"] else DIFFERENT_CLUB_COLOR
   edge_attrs[(start_node, end_node)] = edge_color

nx.set_edge_attributes(G, edge_attrs, "edge_color")

# Show with Bokeh
plot = Plot(plot_width=400, plot_height=400,
           x_range=Range1d(-1.1, 1.1), y_range=Range1d(-1.1, 1.1))
plot.title.text = "Graph Interaction Demonstration"

node_hover_tool = HoverTool(tooltips=[("index", "@index"), ("club", "@club")])


graph_renderer = from_networkx(G, nx.spring_layout, scale=1, center=(0, 0))

graph_renderer.node_renderer.glyph = Circle(size=15, fill_color=Spectral4[0])
graph_renderer.edge_renderer.glyph = MultiLine(line_color="edge_color", line_alpha=0.8, line_width=1)

plot.add_tools(node_hover_tool, BoxZoomTool(), ResetTool(), PointDrawTool(renderers = [graph_renderer.node_renderer], empty_value = 'black'))

plot.renderers.append(graph_renderer)

output_file("interactive_graphs.html")
show(plot)

Movement of the nodes does not work. I am using Bokeh 1.1.0.

edit: maybe there are better resources to pose this question like stackexchange or is there something missing in the problem formulation?

The proximate cause of the problem is that the tool requires access to glyph.x.field and glyph.y.field but both of these are null for the Circle node renderer. The GraphRenderer is the only example of a “composite” renderer, so it’s entirely possible (probable) that there is some interaction problem specific to it with the PointDrawTool. The next appropriate step would be to make a bug report issue on GitHub with details.

edit : maybe there are better resources to pose this question like stackexchange or is there something missing in the problem formulation?

Please be patient, responses may take some time. All answers here (and on StackOverflow) are on a purely volunteer, during-free-time basis, and sometimes people are simply overcommitted.