Skip to content

Commit

Permalink
added new cdn and cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
icfly2 committed Jan 6, 2020
1 parent 4c39dbd commit e7d306e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 452 deletions.
13 changes: 6 additions & 7 deletions neographviz/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import py2neo

version = py2neo.__version__[0]
if int(version) == 4:
from .vis import * # as graphviz
elif int(version) == 3:
from .vis_old import * # vis_old as graphviz
elif int(version) < 3:
raise NotImplementedError(f"Not defined for py2neo version {version} ")
__version__ = 0.3

if py2neo.__version__[0] >= 4:
from .vis import plot_query, get_edges, get_nodes, draw # as graphviz
else:
raise NotImplementedError("Requires py2neo v4 or (possibly) newer")
5 changes: 3 additions & 2 deletions neographviz/templates/vis.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@

<div id="main">
<!-- from output.jsbin.com/pejohi -->
<script src="http://www.visjs.org/dist/vis.js"></script>
<link href="http://www.visjs.org/dist/vis.css" rel="stylesheet" type="text/css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/vis/4.21.0/vis-network.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/vis/4.21.0/vis-network.min.css" rel="stylesheet" type="text/css" />

<div class="graph" id="visualization1"></div>


Expand Down
15 changes: 4 additions & 11 deletions neographviz/vis.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ def draw(
cache = {}
nodes = []
edges = []

for row in data:
source_node = row[0]
source_id = row[1]
Expand All @@ -198,7 +197,6 @@ def draw(
if source_info not in nodes:
nodes.append(source_info)

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

Expand All @@ -208,18 +206,13 @@ def draw(
label = "".join([f"{name} " for name in rel.types()]).strip()
if len(rel.keys()):
# we have keys get the details
try:
title = "".join(
[f"{key}:{str(rel[key])} " for key in list(rel.keys())]
).strip()
except:
breakpoint()
title = "".join(
[f"{key}:{str(rel[key])} " for key in list(rel.keys())]
).strip()
else:
# there is nothing more to it
title = "".join([f"{name} " for name in rel.types()]).strip()
# try:
# title = "".join([f"{name}:{value} " for name, value in rel.items()]).strip()
# except:

rdns, cache = roundness(source_info["id"], target_info["id"], cache)
edges.append(
{
Expand Down
294 changes: 0 additions & 294 deletions neographviz/vis_new.backup.py

This file was deleted.

Loading

0 comments on commit e7d306e

Please sign in to comment.