Skip to content

Commit e7d306e

Browse files
committed
added new cdn and cleaned up
1 parent 4c39dbd commit e7d306e

File tree

6 files changed

+15
-452
lines changed

6 files changed

+15
-452
lines changed

neographviz/__init__.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import py2neo
22

3-
version = py2neo.__version__[0]
4-
if int(version) == 4:
5-
from .vis import * # as graphviz
6-
elif int(version) == 3:
7-
from .vis_old import * # vis_old as graphviz
8-
elif int(version) < 3:
9-
raise NotImplementedError(f"Not defined for py2neo version {version} ")
3+
__version__ = 0.3
4+
5+
if py2neo.__version__[0] >= 4:
6+
from .vis import plot_query, get_edges, get_nodes, draw # as graphviz
7+
else:
8+
raise NotImplementedError("Requires py2neo v4 or (possibly) newer")

neographviz/templates/vis.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66

77
<div id="main">
88
<!-- from output.jsbin.com/pejohi -->
9-
<script src="http://www.visjs.org/dist/vis.js"></script>
10-
<link href="http://www.visjs.org/dist/vis.css" rel="stylesheet" type="text/css" />
9+
<script src="https://cdnjs.cloudflare.com/ajax/libs/vis/4.21.0/vis-network.min.js"></script>
10+
<link href="https://cdnjs.cloudflare.com/ajax/libs/vis/4.21.0/vis-network.min.css" rel="stylesheet" type="text/css" />
11+
1112
<div class="graph" id="visualization1"></div>
1213

1314

neographviz/vis.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ def draw(
186186
cache = {}
187187
nodes = []
188188
edges = []
189-
190189
for row in data:
191190
source_node = row[0]
192191
source_id = row[1]
@@ -198,7 +197,6 @@ def draw(
198197
if source_info not in nodes:
199198
nodes.append(source_info)
200199

201-
# smooth: {type: 'curvedCW', roundness: 0.2}
202200
if rel is not None:
203201
target_info = get_vis_info(target_node, target_id, options)
204202

@@ -208,18 +206,13 @@ def draw(
208206
label = "".join([f"{name} " for name in rel.types()]).strip()
209207
if len(rel.keys()):
210208
# we have keys get the details
211-
try:
212-
title = "".join(
213-
[f"{key}:{str(rel[key])} " for key in list(rel.keys())]
214-
).strip()
215-
except:
216-
breakpoint()
209+
title = "".join(
210+
[f"{key}:{str(rel[key])} " for key in list(rel.keys())]
211+
).strip()
217212
else:
218213
# there is nothing more to it
219214
title = "".join([f"{name} " for name in rel.types()]).strip()
220-
# try:
221-
# title = "".join([f"{name}:{value} " for name, value in rel.items()]).strip()
222-
# except:
215+
223216
rdns, cache = roundness(source_info["id"], target_info["id"], cache)
224217
edges.append(
225218
{

neographviz/vis_new.backup.py

Lines changed: 0 additions & 294 deletions
This file was deleted.

0 commit comments

Comments
 (0)