@@ -142,10 +142,12 @@ def find_tag(file, tag):
142142 from IPython.core.display import display, HTML, Javascript
143143from string import Template
144144import json
145+ from scripts.algo import viz_config, render_image
145146
146- query = "MATCH (p1:Page)-[r:LINKS]->(p2:Page) RETURN *"
147- labels_json = {'Page': {'caption': 'name', 'size': 'pagerank'}}
148- relationships_json = {'LINKS': {'thickness': 'weight', 'caption': False}}
147+ config = viz_config("%s")
148+ query = config["query"]
149+ labels_json = config["labels_json"]
150+ relationships_json = config["relationships_json"]
149151
150152json_graph = {
151153 "query": query,
@@ -156,7 +158,7 @@ def find_tag(file, tag):
156158 "password": password
157159}
158160
159- Javascript("""window.jsonGraph={};""".format(json.dumps(json_graph)))'''
161+ Javascript("""window.jsonGraph={};""".format(json.dumps(json_graph)))''' % algorithm_name
160162
161163neo_vis_div_cell = '''\
162164 %%html
@@ -204,7 +206,7 @@ def find_tag(file, tag):
204206 var cell_element = output_area.element.parents('.cell');
205207 var cell_idx = Jupyter.notebook.get_cell_elements().index(cell_element);
206208 var cell = Jupyter.notebook.get_cell(cell_idx+1);
207- cell.set_text("HTML('<img id= \\ "viz-image \\ " width= \\ "300px \\ " src= \\ "%s \\ " />' % image_src)")
209+ cell.set_text("render_image( image_src)")
208210 cell.execute();
209211 });
210212});'''
0 commit comments