Hey!
I’m currently working on an annotating system using bokeh and have 2 issues regarding working with network graphs.
I’m using from_networkx
to create a network graph plot and I’m updating it with respect to what the user annotated.
- when I’m renaming node indices and updating - the node disappears
change_label_name_button.js_on_click(CustomJS(
args=dict(
data_src=label_data.data_src, output=label_data.output_data,
table_data=label_data.table_data,
selected_label=change_label_selector, new_label=change_label_input,
graph_src = label_data.network_graph.node_renderer.data_source, output_graph = output_graph_data,
edges=label_data.network_graph.edge_renderer.data_source, output_edges = output_edges_data,
graph_src=label_data.network_graph, output_graph=label_data.output_graph,
new_classes=[], select_label_selector=select, is_new_label = is_new_label_checkbox),
code=('''
for (var i =0; i<graph_src.data['index'].length;i++) {
output_graph.data['index'][i] = graph_src.data['index'][i] === selected_label.value ? new_label.value : graph_src.data['index'][i]
}
for (var i=0; i<edges.data['end'].length;i++) {
output_edges.data['end'][i] = edges.data['end'][i] === selected_label.value ? new_label.value : edges.data['end'][i]
}
for (var i=0; i<edges.data['start'].length;i++) {
output_edges.data['start'][i] = edges.data['start'][i] === selected_label.value ? new_label.value : edges.data['start'][i]
}
graph_src.data = output_graph.data
edges.data = output_edges.data
graph_src.change.emit()
edges.change.emit()
'''
)
- I was wondering if there’s a way to retrieve the new structure I created on the graph. meaning the opposite action of
from_networkx
. I want to save the output graph inside a pickle (or any other file in that manner).
thanks a lot!
Amit.