Spaces:
Runtime error
Runtime error
remove files
Browse files- .gitignore +1 -1
- pyvis/notebooks/dot.html +84 -0
- pyvis/notebooks/example.html +108 -0
- pyvis/pyvis/source/gameofthrones.html +97 -0
- pyvis/pyvis/source/jup.png +0 -0
- pyvis/pyvis/source/mulnodes.html +80 -0
- pyvis/pyvis/source/net.png +0 -0
- pyvis/pyvis/source/net2.png +0 -0
- pyvis/pyvis/source/net3.png +0 -0
- pyvis/pyvis/source/rednode.png +0 -0
- pyvis/pyvis/templates/animation_template.html +144 -0
- pyvis/pyvis/templates/template.html +376 -0
.gitignore
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
.DS_Store
|
2 |
.coverage
|
3 |
-
|
4 |
.env
|
5 |
lib/
|
|
|
1 |
.DS_Store
|
2 |
.coverage
|
3 |
+
nx.html
|
4 |
.env
|
5 |
lib/
|
pyvis/notebooks/dot.html
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<html>
|
2 |
+
<head>
|
3 |
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vis-network@latest/styles/vis-network.css" type="text/css" />
|
4 |
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vis-network@latest/dist/vis-network.min.js"> </script>
|
5 |
+
<center>
|
6 |
+
<h1></h1>
|
7 |
+
</center>
|
8 |
+
|
9 |
+
<!-- <link rel="stylesheet" href="../node_modules/vis/dist/vis.min.css" type="text/css" />
|
10 |
+
<script type="text/javascript" src="../node_modules/vis/dist/vis.js"> </script>-->
|
11 |
+
|
12 |
+
<style type="text/css">
|
13 |
+
|
14 |
+
#mynetwork {
|
15 |
+
width: 500px;
|
16 |
+
height: 500px;
|
17 |
+
background-color: #ffffff;
|
18 |
+
border: 1px solid lightgray;
|
19 |
+
position: relative;
|
20 |
+
float: left;
|
21 |
+
}
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
|
28 |
+
</style>
|
29 |
+
|
30 |
+
</head>
|
31 |
+
|
32 |
+
<body>
|
33 |
+
<div id = "mynetwork"></div>
|
34 |
+
|
35 |
+
|
36 |
+
<script type="text/javascript">
|
37 |
+
|
38 |
+
// initialize global variables.
|
39 |
+
var edges;
|
40 |
+
var nodes;
|
41 |
+
var network;
|
42 |
+
var container;
|
43 |
+
var options, data;
|
44 |
+
|
45 |
+
|
46 |
+
// This method is responsible for drawing the graph, returns the drawn network
|
47 |
+
function drawGraph() {
|
48 |
+
var container = document.getElementById('mynetwork');
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
+
var DOTstring = "digraph { a [label=12, entity_id=12, entity_class=\"truck\"]; b [label=7, entity_id=7,entity_class=\"bike\"]; c [label=3, entity_id=3, entity_class=\"car\"]; a -> b[label=\"solid edge\"]; a -> b [label=\"dashed edge\", style=dashed]; a -> c [label=\"dashed edge\", style=dashed]; a -> c [label=\"dotted edge\", style=dotted]; }";
|
53 |
+
data = vis.network.dotparser.DOTToGraph(DOTstring);
|
54 |
+
|
55 |
+
var options = data.options;
|
56 |
+
options = Object.assign(options, {
|
57 |
+
nodes: {
|
58 |
+
shape: "dot"
|
59 |
+
},
|
60 |
+
});
|
61 |
+
|
62 |
+
options = Object.assign(options, {"physics": {"enabled": true, "barnesHut": {"theta": 0.5, "gravitationalConstant": -2000, "centralGravity": 0.3, "springLength": 200, "springConstant": 0.04, "damping": 0.09, "avoidOverlap": 0}, "maxVelocity": 50, "minVelocity": 0.1, "solver": "barnesHut", "stabilization": {"enabled": true, "iterations": 1000, "updateInterval": 100, "onlyDynamicEdges": false, "fit": true}}})
|
63 |
+
|
64 |
+
|
65 |
+
|
66 |
+
|
67 |
+
|
68 |
+
|
69 |
+
network = new vis.Network(container, data, options);
|
70 |
+
|
71 |
+
|
72 |
+
|
73 |
+
|
74 |
+
|
75 |
+
|
76 |
+
return network;
|
77 |
+
|
78 |
+
}
|
79 |
+
|
80 |
+
drawGraph();
|
81 |
+
|
82 |
+
</script>
|
83 |
+
</body>
|
84 |
+
</html>
|
pyvis/notebooks/example.html
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<html>
|
2 |
+
<head>
|
3 |
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vis-network@latest/styles/vis-network.css" type="text/css" />
|
4 |
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vis-network@latest/dist/vis-network.min.js"> </script>
|
5 |
+
<center>
|
6 |
+
<h1></h1>
|
7 |
+
</center>
|
8 |
+
|
9 |
+
<!-- <link rel="stylesheet" href="../node_modules/vis/dist/vis.min.css" type="text/css" />
|
10 |
+
<script type="text/javascript" src="../node_modules/vis/dist/vis.js"> </script>-->
|
11 |
+
|
12 |
+
<style type="text/css">
|
13 |
+
|
14 |
+
#mynetwork {
|
15 |
+
width: 500px;
|
16 |
+
height: 500px;
|
17 |
+
background-color: #ffffff;
|
18 |
+
border: 1px solid lightgray;
|
19 |
+
position: relative;
|
20 |
+
float: left;
|
21 |
+
}
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
|
28 |
+
</style>
|
29 |
+
|
30 |
+
</head>
|
31 |
+
|
32 |
+
<body>
|
33 |
+
<div id = "mynetwork"></div>
|
34 |
+
|
35 |
+
|
36 |
+
<script type="text/javascript">
|
37 |
+
|
38 |
+
// initialize global variables.
|
39 |
+
var edges;
|
40 |
+
var nodes;
|
41 |
+
var network;
|
42 |
+
var container;
|
43 |
+
var options, data;
|
44 |
+
|
45 |
+
|
46 |
+
// This method is responsible for drawing the graph, returns the drawn network
|
47 |
+
function drawGraph() {
|
48 |
+
var container = document.getElementById('mynetwork');
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
+
// parsing and collecting nodes and edges from the python
|
53 |
+
nodes = new vis.DataSet([{"id": 0, "label": 0, "shape": "dot"}, {"id": 1, "label": 1, "shape": "dot"}, {"id": 2, "label": 2, "shape": "dot"}, {"id": 3, "label": 3, "shape": "dot"}, {"id": 4, "label": 4, "shape": "dot"}]);
|
54 |
+
edges = new vis.DataSet([{"from": 0, "to": 2}, {"from": 0, "to": 3}, {"from": 0, "to": 4}, {"from": 1, "to": 1}, {"from": 1, "to": 3}, {"from": 1, "to": 2}]);
|
55 |
+
|
56 |
+
// adding nodes and edges to the graph
|
57 |
+
data = {nodes: nodes, edges: edges};
|
58 |
+
|
59 |
+
var options = {
|
60 |
+
"configure": {
|
61 |
+
"enabled": false
|
62 |
+
},
|
63 |
+
"edges": {
|
64 |
+
"color": {
|
65 |
+
"inherit": true
|
66 |
+
},
|
67 |
+
"smooth": {
|
68 |
+
"enabled": true,
|
69 |
+
"type": "dynamic"
|
70 |
+
}
|
71 |
+
},
|
72 |
+
"interaction": {
|
73 |
+
"dragNodes": true,
|
74 |
+
"hideEdgesOnDrag": false,
|
75 |
+
"hideNodesOnDrag": false
|
76 |
+
},
|
77 |
+
"physics": {
|
78 |
+
"enabled": true,
|
79 |
+
"stabilization": {
|
80 |
+
"enabled": true,
|
81 |
+
"fit": true,
|
82 |
+
"iterations": 1000,
|
83 |
+
"onlyDynamicEdges": false,
|
84 |
+
"updateInterval": 50
|
85 |
+
}
|
86 |
+
}
|
87 |
+
};
|
88 |
+
|
89 |
+
|
90 |
+
|
91 |
+
|
92 |
+
|
93 |
+
network = new vis.Network(container, data, options);
|
94 |
+
|
95 |
+
|
96 |
+
|
97 |
+
|
98 |
+
|
99 |
+
|
100 |
+
return network;
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
+
drawGraph();
|
105 |
+
|
106 |
+
</script>
|
107 |
+
</body>
|
108 |
+
</html>
|
pyvis/pyvis/source/gameofthrones.html
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<html>
|
2 |
+
<head>
|
3 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis.css" type="text/css" />
|
4 |
+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis-network.min.js"> </script>
|
5 |
+
|
6 |
+
<!-- <link rel="stylesheet" href="../node_modules/vis/dist/vis.min.css" type="text/css" />
|
7 |
+
<script type="text/javascript" src="../node_modules/vis/dist/vis.js"> </script>-->
|
8 |
+
|
9 |
+
<style type="text/css">
|
10 |
+
|
11 |
+
#mynetwork3 {
|
12 |
+
width: 100%;
|
13 |
+
height: 750px;
|
14 |
+
background-color: #222222;
|
15 |
+
border: 1px solid lightgray;
|
16 |
+
}
|
17 |
+
</style>
|
18 |
+
|
19 |
+
</head>
|
20 |
+
|
21 |
+
<body>
|
22 |
+
<div id = "mynetwork3"></div>
|
23 |
+
<script type="text/javascript">
|
24 |
+
|
25 |
+
// initialize global variables.
|
26 |
+
var edges;
|
27 |
+
var nodes;
|
28 |
+
var network;
|
29 |
+
var container;
|
30 |
+
var options, data;
|
31 |
+
|
32 |
+
|
33 |
+
// This method is responsible for drawing the graph, returns the drawn network
|
34 |
+
function drawGraph() {
|
35 |
+
var container = document.getElementById('mynetwork3');
|
36 |
+
|
37 |
+
|
38 |
+
|
39 |
+
// parsing and collecting nodes and edges from the python
|
40 |
+
nodes = [{'title': 'Aemon Neighbors:<br>Grenn<br>Samwell<br>Robert<br>Jon<br>Stannis', 'value': 5, 'label': 'Aemon', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Aemon'}, {'title': 'Grenn Neighbors:<br>Samwell<br>Aemon<br>Jon<br>Eddison', 'value': 4, 'label': 'Grenn', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Grenn'}, {'title': 'Samwell Neighbors:<br>Jojen<br>Craster<br>Mance<br>Stannis<br>Bowen<br>Melisandre<br>Eddison<br>Bran<br>Gilly<br>Grenn<br>Janos<br>Meera<br>Qhorin<br>Aemon<br>Jon', 'value': 15, 'label': 'Samwell', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Samwell'}, {'title': 'Aerys Neighbors:<br>Tywin<br>Robert<br>Jaime<br>Tyrion', 'value': 4, 'label': 'Aerys', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Aerys'}, {'title': 'Jaime Neighbors:<br>Stannis<br>Meryn<br>Balon<br>Robert<br>Robb<br>Brienne<br>Renly<br>Aerys<br>Walton<br>Joffrey<br>Tyrion<br>Gregor<br>Loras<br>Edmure<br>Barristan<br>Arya<br>Elia<br>Sansa<br>Tywin<br>Eddard<br>Cersei<br>Catelyn<br>Qyburn<br>Tommen', 'value': 24, 'label': 'Jaime', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Jaime'}, {'title': 'Robert Neighbors:<br>Barristan<br>Jon Arryn<br>Rhaegar<br>Renly<br>Tywin<br>Eddard<br>Sansa<br>Cersei<br>Aemon<br>Stannis<br>Jaime<br>Sandor<br>Daenerys<br>Tyrion<br>Arya<br>Aerys<br>Jon<br>Thoros', 'value': 18, 'label': 'Robert', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Robert'}, {'title': 'Tyrion Neighbors:<br>Stannis<br>Meryn<br>Balon<br>Gregor<br>Shae<br>Robb<br>Podrick<br>Ellaria<br>Renly<br>Chataya<br>Aerys<br>Mace<br>Joffrey<br>Janos<br>Margaery<br>Oberyn<br>Loras<br>Petyr<br>Pycelle<br>Kevan<br>Lysa<br>Bronn<br>Jaime<br>Varys<br>Arya<br>Viserys<br>Myrcella<br>Elia<br>Sansa<br>Tywin<br>Cersei<br>Sandor<br>Catelyn<br>Robert<br>Doran<br>Ilyn', 'value': 36, 'label': 'Tyrion', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Tyrion'}, {'title': 'Tywin Neighbors:<br>Stannis<br>Val<br>Balon<br>Gregor<br>Brynden<br>Robb<br>Podrick<br>Aerys<br>Mace<br>Joffrey<br>Tyrion<br>Oberyn<br>Petyr<br>Pycelle<br>Kevan<br>Lysa<br>Varys<br>Jaime<br>Tommen<br>Cersei<br>Walder<br>Robert', 'value': 22, 'label': 'Tywin', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Tywin'}, {'title': 'Alliser Neighbors:<br>Janos<br>Mance<br>Jon', 'value': 3, 'label': 'Alliser', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Alliser'}, {'title': 'Mance Neighbors:<br>Ygritte<br>Craster<br>Dalla<br>Val<br>Rattleshirt<br>Samwell<br>Styr<br>Gilly<br>Alliser<br>Janos<br>Qhorin<br>Jon', 'value': 12, 'label': 'Mance', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Mance'}, {'title': 'Amory Neighbors:<br>Oberyn', 'value': 1, 'label': 'Amory', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Amory'}, {'title': 'Oberyn Neighbors:<br>Ellaria<br>Tywin<br>Gregor<br>Amory<br>Mace<br>Joffrey<br>Tyrion', 'value': 7, 'label': 'Oberyn', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Oberyn'}, {'title': 'Arya Neighbors:<br>Sansa<br>Anguy<br>Eddard<br>Gendry<br>Gregor<br>Tyrion<br>Cersei<br>Beric<br>Roose<br>Robb<br>Jaime<br>Joffrey<br>Sandor<br>Brynden<br>Robert<br>Rickon<br>Bran<br>Jon<br>Thoros', 'value': 19, 'label': 'Arya', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Arya'}, {'title': 'Anguy Neighbors:<br>Arya<br>Beric', 'value': 2, 'label': 'Anguy', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Anguy'}, {'title': 'Beric Neighbors:<br>Anguy<br>Gendry<br>Eddard<br>Sandor<br>Arya<br>Thoros', 'value': 6, 'label': 'Beric', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Beric'}, {'title': 'Bran Neighbors:<br>Jojen<br>Luwin<br>Theon<br>Samwell<br>Sansa<br>Nan<br>Robb<br>Hodor<br>Meera<br>Arya<br>Rickon<br>Eddard<br>Jon<br>Catelyn', 'value': 14, 'label': 'Bran', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Bran'}, {'title': 'Brynden Neighbors:<br>Edmure<br>Walder<br>Tywin<br>Rickard<br>Catelyn<br>Lothar<br>Arya<br>Robb', 'value': 8, 'label': 'Brynden', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Brynden'}, {'title': 'Cersei Neighbors:<br>Eddard<br>Meryn<br>Elia<br>Sansa<br>Brienne<br>Lysa<br>Gregor<br>Shae<br>Bronn<br>Tywin<br>Jaime<br>Joffrey<br>Catelyn<br>Sandor<br>Tyrion<br>Arya<br>Varys<br>Robert<br>Ilyn<br>Pycelle', 'value': 20, 'label': 'Cersei', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Cersei'}, {'title': 'Gendry Neighbors:<br>Sandor<br>Arya<br>Beric<br>Thoros', 'value': 4, 'label': 'Gendry', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Gendry'}, {'title': 'Gregor Neighbors:<br>Jaime<br>Meryn<br>Elia<br>Tywin<br>Cersei<br>Bronn<br>Sandor<br>Joffrey<br>Tyrion<br>Arya<br>Oberyn<br>Ilyn', 'value': 12, 'label': 'Gregor', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Gregor'}, {'title': 'Joffrey Neighbors:<br>Stannis<br>Meryn<br>Kevan<br>Sansa<br>Tywin<br>Gregor<br>Tyrion<br>Cersei<br>Oberyn<br>Robb<br>Tommen<br>Jaime<br>Loras<br>Sandor<br>Margaery<br>Arya<br>Myrcella<br>Ilyn', 'value': 18, 'label': 'Joffrey', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Joffrey'}, {'title': 'Jon Neighbors:<br>Stannis<br>Ygritte<br>Val<br>Theon<br>Styr<br>Robert<br>Gilly<br>Robb<br>Dalla<br>Orell<br>Samwell<br>Janos<br>Meera<br>Qhorin<br>Craster<br>Rattleshirt<br>Eddison<br>Alliser<br>Arya<br>Bran<br>Mance<br>Sansa<br>Eddard<br>Melisandre<br>Grenn<br>Aemon', 'value': 26, 'label': 'Jon', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Jon'}, {'title': 'Rickon Neighbors:<br>Sansa<br>Eddard<br>Theon<br>Bran<br>Arya<br>Robb', 'value': 6, 'label': 'Rickon', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Rickon'}, {'title': 'Roose Neighbors:<br>Brienne<br>Arya<br>Catelyn<br>Robb', 'value': 4, 'label': 'Roose', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Roose'}, {'title': 'Sandor Neighbors:<br>Meryn<br>Gendry<br>Eddard<br>Sansa<br>Cersei<br>Beric<br>Joffrey<br>Tyrion<br>Robert<br>Arya<br>Gregor<br>Ilyn<br>Thoros', 'value': 13, 'label': 'Sandor', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Sandor'}, {'title': 'Thoros Neighbors:<br>Sandor<br>Robert<br>Arya<br>Beric<br>Gendry', 'value': 5, 'label': 'Thoros', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Thoros'}, {'title': 'Balon Neighbors:<br>Stannis<br>Tywin<br>Jaime<br>Tyrion<br>Robb<br>Loras', 'value': 6, 'label': 'Balon', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Balon'}, {'title': 'Loras Neighbors:<br>Balon<br>Brienne<br>Olenna<br>Renly<br>Jaime<br>Joffrey<br>Tyrion<br>Margaery<br>Sansa', 'value': 9, 'label': 'Loras', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Loras'}, {'title': 'Belwas Neighbors:<br>Daenerys<br>Barristan<br>Jorah<br>Illyrio', 'value': 4, 'label': 'Belwas', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Belwas'}, {'title': 'Barristan Neighbors:<br>Rhaegar<br>Robert<br>Jorah<br>Belwas<br>Jaime<br>Daenerys', 'value': 6, 'label': 'Barristan', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Barristan'}, {'title': 'Illyrio Neighbors:<br>Belwas', 'value': 1, 'label': 'Illyrio', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Illyrio'}, {'title': 'Hodor Neighbors:<br>Robb<br>Jojen<br>Bran<br>Meera', 'value': 4, 'label': 'Hodor', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Hodor'}, {'title': 'Jojen Neighbors:<br>Samwell<br>Hodor<br>Bran<br>Meera', 'value': 4, 'label': 'Jojen', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Jojen'}, {'title': 'Luwin Neighbors:<br>Nan<br>Bran', 'value': 2, 'label': 'Luwin', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Luwin'}, {'title': 'Meera Neighbors:<br>Jojen<br>Samwell<br>Hodor<br>Bran<br>Jon', 'value': 5, 'label': 'Meera', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Meera'}, {'title': 'Nan Neighbors:<br>Luwin<br>Bran', 'value': 2, 'label': 'Nan', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Nan'}, {'title': 'Theon Neighbors:<br>Rickon<br>Bran<br>Jon<br>Robb', 'value': 4, 'label': 'Theon', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Theon'}, {'title': 'Brienne Neighbors:<br>Sansa<br>Cersei<br>Roose<br>Jaime<br>Catelyn<br>Robb<br>Loras', 'value': 7, 'label': 'Brienne', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Brienne'}, {'title': 'Bronn Neighbors:<br>Gregor<br>Podrick<br>Cersei<br>Tyrion', 'value': 4, 'label': 'Bronn', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Bronn'}, {'title': 'Podrick Neighbors:<br>Tywin<br>Margaery<br>Tyrion<br>Bronn<br>Sansa', 'value': 5, 'label': 'Podrick', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Podrick'}, {'title': 'Lothar Neighbors:<br>Edmure<br>Brynden<br>Walder<br>Robb<br>Roslin', 'value': 5, 'label': 'Lothar', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Lothar'}, {'title': 'Walder Neighbors:<br>Edmure<br>Roslin<br>Tywin<br>Catelyn<br>Lothar<br>Brynden<br>Robb<br>Petyr', 'value': 8, 'label': 'Walder', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Walder'}, {'title': 'Catelyn Neighbors:<br>Edmure<br>Hoster<br>Jeyne<br>Roose<br>Roslin<br>Brienne<br>Lysa<br>Eddard<br>Sansa<br>Cersei<br>Robb<br>Stannis<br>Jaime<br>Tyrion<br>Brynden<br>Walder<br>Bran<br>Petyr', 'value': 18, 'label': 'Catelyn', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Catelyn'}, {'title': 'Edmure Neighbors:<br>Hoster<br>Roslin<br>Walder<br>Jaime<br>Catelyn<br>Lothar<br>Brynden<br>Robb', 'value': 8, 'label': 'Edmure', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Edmure'}, {'title': 'Hoster Neighbors:<br>Edmure<br>Lysa<br>Catelyn', 'value': 3, 'label': 'Hoster', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Hoster'}, {'title': 'Jeyne Neighbors:<br>Catelyn<br>Robb', 'value': 2, 'label': 'Jeyne', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Jeyne'}, {'title': 'Lysa Neighbors:<br>Hoster<br>Jon Arryn<br>Sansa<br>Tywin<br>Marillion<br>Cersei<br>Catelyn<br>Tyrion<br>Robert Arryn<br>Petyr', 'value': 10, 'label': 'Lysa', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Lysa'}, {'title': 'Petyr Neighbors:<br>Sansa<br>Tywin<br>Lysa<br>Walder<br>Catelyn<br>Tyrion<br>Robb', 'value': 7, 'label': 'Petyr', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Petyr'}, {'title': 'Robb Neighbors:<br>Stannis<br>Jeyne<br>Theon<br>Brynden<br>Brienne<br>Balon<br>Rickard<br>Joffrey<br>Tyrion<br>Rickon<br>Roose<br>Jon<br>Ramsay<br>Edmure<br>Jaime<br>Lothar<br>Arya<br>Bran<br>Sansa<br>Tywin<br>Eddard<br>Walder<br>Hodor<br>Catelyn<br>Petyr', 'value': 25, 'label': 'Robb', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Robb'}, {'title': 'Roslin Neighbors:<br>Edmure<br>Lothar<br>Catelyn<br>Walder', 'value': 4, 'label': 'Roslin', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Roslin'}, {'title': 'Sansa Neighbors:<br>Renly<br>Olenna<br>Robert<br>Shae<br>Robb<br>Loras<br>Podrick<br>Brienne<br>Bran<br>Joffrey<br>Tyrion<br>Margaery<br>Rickon<br>Jon<br>Petyr<br>Kevan<br>Lysa<br>Marillion<br>Jaime<br>Arya<br>Myrcella<br>Eddard<br>Cersei<br>Sandor<br>Catelyn<br>Robert Arryn', 'value': 26, 'label': 'Sansa', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Sansa'}, {'title': 'Stannis Neighbors:<br>Davos<br>Balon<br>Tywin<br>Robert<br>Renly<br>Melisandre<br>Aemon<br>Jaime<br>Joffrey<br>Catelyn<br>Tyrion<br>Robb<br>Jon<br>Samwell', 'value': 14, 'label': 'Stannis', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Stannis'}, {'title': 'Elia Neighbors:<br>Tyrion<br>Gregor<br>Jaime<br>Cersei<br>Rhaegar', 'value': 5, 'label': 'Elia', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Elia'}, {'title': 'Ilyn Neighbors:<br>Meryn<br>Gregor<br>Cersei<br>Sandor<br>Joffrey<br>Tyrion', 'value': 6, 'label': 'Ilyn', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Ilyn'}, {'title': 'Meryn Neighbors:<br>Gregor<br>Tyrion<br>Cersei<br>Jaime<br>Joffrey<br>Sandor<br>Ilyn', 'value': 7, 'label': 'Meryn', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Meryn'}, {'title': 'Pycelle Neighbors:<br>Tywin<br>Cersei<br>Varys<br>Tyrion', 'value': 4, 'label': 'Pycelle', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Pycelle'}, {'title': 'Shae Neighbors:<br>Chataya<br>Tyrion<br>Cersei<br>Varys<br>Sansa', 'value': 5, 'label': 'Shae', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Shae'}, {'title': 'Varys Neighbors:<br>Pycelle<br>Kevan<br>Renly<br>Tywin<br>Shae<br>Cersei<br>Tyrion', 'value': 7, 'label': 'Varys', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Varys'}, {'title': 'Craster Neighbors:<br>Gilly<br>Samwell<br>Jon<br>Karl<br>Mance', 'value': 5, 'label': 'Craster', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Craster'}, {'title': 'Karl Neighbors:<br>Craster', 'value': 1, 'label': 'Karl', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Karl'}, {'title': 'Daario Neighbors:<br>Daenerys<br>Drogo<br>Jorah<br>Irri', 'value': 4, 'label': 'Daario', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Daario'}, {'title': 'Drogo Neighbors:<br>Daenerys<br>Daario<br>Jorah<br>Irri', 'value': 4, 'label': 'Drogo', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Drogo'}, {'title': 'Irri Neighbors:<br>Daenerys<br>Daario<br>Missandei<br>Drogo', 'value': 4, 'label': 'Irri', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Irri'}, {'title': 'Daenerys Neighbors:<br>Barristan<br>Drogo<br>Rhaegar<br>Kraznys<br>Viserys<br>Robert<br>Jorah<br>Worm<br>Belwas<br>Daario<br>Irri<br>Aegon<br>Missandei<br>Rakharo', 'value': 14, 'label': 'Daenerys', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Daenerys'}, {'title': 'Aegon Neighbors:<br>Daenerys', 'value': 1, 'label': 'Aegon', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Aegon'}, {'title': 'Jorah Neighbors:<br>Barristan<br>Drogo<br>Rhaegar<br>Belwas<br>Daario<br>Daenerys', 'value': 6, 'label': 'Jorah', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Jorah'}, {'title': 'Kraznys Neighbors:<br>Daenerys', 'value': 1, 'label': 'Kraznys', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Kraznys'}, {'title': 'Missandei Neighbors:<br>Daenerys<br>Irri', 'value': 2, 'label': 'Missandei', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Missandei'}, {'title': 'Rakharo Neighbors:<br>Daenerys', 'value': 1, 'label': 'Rakharo', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Rakharo'}, {'title': 'Rhaegar Neighbors:<br>Barristan<br>Elia<br>Robert<br>Jorah<br>Daenerys<br>Viserys', 'value': 6, 'label': 'Rhaegar', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Rhaegar'}, {'title': 'Viserys Neighbors:<br>Daenerys<br>Rhaegar<br>Tyrion', 'value': 3, 'label': 'Viserys', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Viserys'}, {'title': 'Worm Neighbors:<br>Daenerys', 'value': 1, 'label': 'Worm', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Worm'}, {'title': 'Davos Neighbors:<br>Melisandre<br>Salladhor<br>Cressen<br>Shireen<br>Stannis', 'value': 5, 'label': 'Davos', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Davos'}, {'title': 'Cressen Neighbors:<br>Davos', 'value': 1, 'label': 'Cressen', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Cressen'}, {'title': 'Salladhor Neighbors:<br>Davos', 'value': 1, 'label': 'Salladhor', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Salladhor'}, {'title': 'Eddard Neighbors:<br>Sansa<br>Robert<br>Cersei<br>Beric<br>Robb<br>Jaime<br>Catelyn<br>Sandor<br>Arya<br>Rickon<br>Bran<br>Jon', 'value': 12, 'label': 'Eddard', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Eddard'}, {'title': 'Eddison Neighbors:<br>Grenn<br>Samwell<br>Jon', 'value': 3, 'label': 'Eddison', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Eddison'}, {'title': 'Gilly Neighbors:<br>Samwell<br>Craster<br>Mance<br>Jon', 'value': 4, 'label': 'Gilly', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Gilly'}, {'title': 'Qyburn Neighbors:<br>Jaime', 'value': 1, 'label': 'Qyburn', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Qyburn'}, {'title': 'Renly Neighbors:<br>Stannis<br>Sansa<br>Robert<br>Varys<br>Jaime<br>Tyrion<br>Margaery<br>Loras', 'value': 8, 'label': 'Renly', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Renly'}, {'title': 'Tommen Neighbors:<br>Tywin<br>Margaery<br>Jaime<br>Joffrey<br>Myrcella', 'value': 5, 'label': 'Tommen', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Tommen'}, {'title': 'Janos Neighbors:<br>Mance<br>Bowen<br>Samwell<br>Alliser<br>Tyrion<br>Jon', 'value': 6, 'label': 'Janos', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Janos'}, {'title': 'Bowen Neighbors:<br>Samwell<br>Janos', 'value': 2, 'label': 'Bowen', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Bowen'}, {'title': 'Kevan Neighbors:<br>Lancel<br>Sansa<br>Tywin<br>Varys<br>Joffrey<br>Tyrion', 'value': 6, 'label': 'Kevan', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Kevan'}, {'title': 'Margaery Neighbors:<br>Podrick<br>Sansa<br>Tommen<br>Renly<br>Joffrey<br>Tyrion<br>Loras', 'value': 7, 'label': 'Margaery', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Margaery'}, {'title': 'Myrcella Neighbors:<br>Tommen<br>Sansa<br>Joffrey<br>Tyrion', 'value': 4, 'label': 'Myrcella', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Myrcella'}, {'title': 'Dalla Neighbors:<br>Val<br>Mance<br>Jon', 'value': 3, 'label': 'Dalla', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Dalla'}, {'title': 'Melisandre Neighbors:<br>Stannis<br>Davos<br>Samwell<br>Jon', 'value': 4, 'label': 'Melisandre', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Melisandre'}, {'title': 'Orell Neighbors:<br>Jon', 'value': 1, 'label': 'Orell', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Orell'}, {'title': 'Qhorin Neighbors:<br>Rattleshirt<br>Samwell<br>Ygritte<br>Mance<br>Jon', 'value': 5, 'label': 'Qhorin', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Qhorin'}, {'title': 'Rattleshirt Neighbors:<br>Qhorin<br>Ygritte<br>Mance<br>Jon', 'value': 4, 'label': 'Rattleshirt', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Rattleshirt'}, {'title': 'Styr Neighbors:<br>Mance<br>Jon', 'value': 2, 'label': 'Styr', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Styr'}, {'title': 'Val Neighbors:<br>Tywin<br>Dalla<br>Mance<br>Jon', 'value': 4, 'label': 'Val', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Val'}, {'title': 'Ygritte Neighbors:<br>Rattleshirt<br>Qhorin<br>Mance<br>Jon', 'value': 4, 'label': 'Ygritte', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Ygritte'}, {'title': 'Jon Arryn Neighbors:<br>Lysa<br>Robert', 'value': 2, 'label': 'Jon Arryn', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Jon Arryn'}, {'title': 'Lancel Neighbors:<br>Kevan', 'value': 1, 'label': 'Lancel', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Lancel'}, {'title': 'Olenna Neighbors:<br>Loras<br>Sansa', 'value': 2, 'label': 'Olenna', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Olenna'}, {'title': 'Marillion Neighbors:<br>Robert Arryn<br>Lysa<br>Sansa', 'value': 3, 'label': 'Marillion', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Marillion'}, {'title': 'Robert Arryn Neighbors:<br>Lysa<br>Marillion<br>Sansa', 'value': 3, 'label': 'Robert Arryn', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Robert Arryn'}, {'title': 'Ellaria Neighbors:<br>Oberyn<br>Tyrion', 'value': 2, 'label': 'Ellaria', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Ellaria'}, {'title': 'Mace Neighbors:<br>Tywin<br>Oberyn<br>Tyrion', 'value': 3, 'label': 'Mace', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Mace'}, {'title': 'Rickard Neighbors:<br>Brynden<br>Robb', 'value': 2, 'label': 'Rickard', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Rickard'}, {'title': 'Ramsay Neighbors:<br>Robb', 'value': 1, 'label': 'Ramsay', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Ramsay'}, {'title': 'Chataya Neighbors:<br>Tyrion<br>Shae', 'value': 2, 'label': 'Chataya', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Chataya'}, {'title': 'Shireen Neighbors:<br>Davos', 'value': 1, 'label': 'Shireen', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Shireen'}, {'title': 'Doran Neighbors:<br>Tyrion', 'value': 1, 'label': 'Doran', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Doran'}, {'title': 'Walton Neighbors:<br>Jaime', 'value': 1, 'label': 'Walton', 'shape': 'dot', 'font': {'color': 'white'}, 'id': 'Walton'}];
|
41 |
+
edges = [{'to': 'Grenn', 'from': 'Aemon', 'value': 5}, {'to': 'Samwell', 'from': 'Aemon', 'value': 31}, {'to': 'Jaime', 'from': 'Aerys', 'value': 18}, {'to': 'Robert', 'from': 'Aerys', 'value': 6}, {'to': 'Tyrion', 'from': 'Aerys', 'value': 5}, {'to': 'Tywin', 'from': 'Aerys', 'value': 8}, {'to': 'Mance', 'from': 'Alliser', 'value': 5}, {'to': 'Oberyn', 'from': 'Amory', 'value': 5}, {'to': 'Anguy', 'from': 'Arya', 'value': 11}, {'to': 'Beric', 'from': 'Arya', 'value': 23}, {'to': 'Bran', 'from': 'Arya', 'value': 9}, {'to': 'Brynden', 'from': 'Arya', 'value': 6}, {'to': 'Cersei', 'from': 'Arya', 'value': 5}, {'to': 'Gendry', 'from': 'Arya', 'value': 43}, {'to': 'Gregor', 'from': 'Arya', 'value': 7}, {'to': 'Jaime', 'from': 'Arya', 'value': 11}, {'to': 'Joffrey', 'from': 'Arya', 'value': 6}, {'to': 'Jon', 'from': 'Arya', 'value': 7}, {'to': 'Rickon', 'from': 'Arya', 'value': 8}, {'to': 'Robert', 'from': 'Arya', 'value': 4}, {'to': 'Roose', 'from': 'Arya', 'value': 5}, {'to': 'Sandor', 'from': 'Arya', 'value': 46}, {'to': 'Thoros', 'from': 'Arya', 'value': 18}, {'to': 'Tyrion', 'from': 'Arya', 'value': 5}, {'to': 'Loras', 'from': 'Balon', 'value': 4}, {'to': 'Barristan', 'from': 'Belwas', 'value': 18}, {'to': 'Illyrio', 'from': 'Belwas', 'value': 10}, {'to': 'Anguy', 'from': 'Beric', 'value': 4}, {'to': 'Gendry', 'from': 'Beric', 'value': 4}, {'to': 'Thoros', 'from': 'Beric', 'value': 21}, {'to': 'Hodor', 'from': 'Bran', 'value': 96}, {'to': 'Jojen', 'from': 'Bran', 'value': 46}, {'to': 'Jon', 'from': 'Bran', 'value': 12}, {'to': 'Luwin', 'from': 'Bran', 'value': 4}, {'to': 'Meera', 'from': 'Bran', 'value': 54}, {'to': 'Nan', 'from': 'Bran', 'value': 14}, {'to': 'Rickon', 'from': 'Bran', 'value': 35}, {'to': 'Samwell', 'from': 'Bran', 'value': 11}, {'to': 'Theon', 'from': 'Bran', 'value': 11}, {'to': 'Loras', 'from': 'Brienne', 'value': 7}, {'to': 'Gregor', 'from': 'Bronn', 'value': 5}, {'to': 'Podrick', 'from': 'Bronn', 'value': 19}, {'to': 'Lothar', 'from': 'Brynden', 'value': 4}, {'to': 'Walder', 'from': 'Brynden', 'value': 5}, {'to': 'Bran', 'from': 'Catelyn', 'value': 4}, {'to': 'Brienne', 'from': 'Catelyn', 'value': 7}, {'to': 'Brynden', 'from': 'Catelyn', 'value': 8}, {'to': 'Cersei', 'from': 'Catelyn', 'value': 4}, {'to': 'Edmure', 'from': 'Catelyn', 'value': 16}, {'to': 'Hoster', 'from': 'Catelyn', 'value': 9}, {'to': 'Jaime', 'from': 'Catelyn', 'value': 19}, {'to': 'Jeyne', 'from': 'Catelyn', 'value': 10}, {'to': 'Lysa', 'from': 'Catelyn', 'value': 8}, {'to': 'Petyr', 'from': 'Catelyn', 'value': 5}, {'to': 'Robb', 'from': 'Catelyn', 'value': 43}, {'to': 'Roose', 'from': 'Catelyn', 'value': 4}, {'to': 'Roslin', 'from': 'Catelyn', 'value': 6}, {'to': 'Sansa', 'from': 'Catelyn', 'value': 8}, {'to': 'Stannis', 'from': 'Catelyn', 'value': 4}, {'to': 'Tyrion', 'from': 'Catelyn', 'value': 5}, {'to': 'Walder', 'from': 'Catelyn', 'value': 19}, {'to': 'Brienne', 'from': 'Cersei', 'value': 5}, {'to': 'Bronn', 'from': 'Cersei', 'value': 4}, {'to': 'Elia', 'from': 'Cersei', 'value': 4}, {'to': 'Gregor', 'from': 'Cersei', 'value': 6}, {'to': 'Ilyn', 'from': 'Cersei', 'value': 7}, {'to': 'Jaime', 'from': 'Cersei', 'value': 36}, {'to': 'Joffrey', 'from': 'Cersei', 'value': 23}, {'to': 'Meryn', 'from': 'Cersei', 'value': 10}, {'to': 'Pycelle', 'from': 'Cersei', 'value': 4}, {'to': 'Robert', 'from': 'Cersei', 'value': 16}, {'to': 'Sandor', 'from': 'Cersei', 'value': 6}, {'to': 'Shae', 'from': 'Cersei', 'value': 4}, {'to': 'Tyrion', 'from': 'Cersei', 'value': 46}, {'to': 'Varys', 'from': 'Cersei', 'value': 4}, {'to': 'Karl', 'from': 'Craster', 'value': 6}, {'to': 'Drogo', 'from': 'Daario', 'value': 4}, {'to': 'Irri', 'from': 'Daario', 'value': 5}, {'to': 'Aegon', 'from': 'Daenerys', 'value': 8}, {'to': 'Barristan', 'from': 'Daenerys', 'value': 20}, {'to': 'Belwas', 'from': 'Daenerys', 'value': 26}, {'to': 'Daario', 'from': 'Daenerys', 'value': 14}, {'to': 'Drogo', 'from': 'Daenerys', 'value': 18}, {'to': 'Irri', 'from': 'Daenerys', 'value': 17}, {'to': 'Jorah', 'from': 'Daenerys', 'value': 47}, {'to': 'Kraznys', 'from': 'Daenerys', 'value': 10}, {'to': 'Missandei', 'from': 'Daenerys', 'value': 26}, {'to': 'Rakharo', 'from': 'Daenerys', 'value': 7}, {'to': 'Rhaegar', 'from': 'Daenerys', 'value': 12}, {'to': 'Robert', 'from': 'Daenerys', 'value': 5}, {'to': 'Viserys', 'from': 'Daenerys', 'value': 8}, {'to': 'Worm', 'from': 'Daenerys', 'value': 14}, {'to': 'Cressen', 'from': 'Davos', 'value': 4}, {'to': 'Salladhor', 'from': 'Davos', 'value': 16}, {'to': 'Arya', 'from': 'Eddard', 'value': 18}, {'to': 'Beric', 'from': 'Eddard', 'value': 8}, {'to': 'Bran', 'from': 'Eddard', 'value': 15}, {'to': 'Catelyn', 'from': 'Eddard', 'value': 5}, {'to': 'Cersei', 'from': 'Eddard', 'value': 6}, {'to': 'Jaime', 'from': 'Eddard', 'value': 6}, {'to': 'Jon', 'from': 'Eddard', 'value': 8}, {'to': 'Rickon', 'from': 'Eddard', 'value': 8}, {'to': 'Robb', 'from': 'Eddard', 'value': 13}, {'to': 'Robert', 'from': 'Eddard', 'value': 10}, {'to': 'Sandor', 'from': 'Eddard', 'value': 5}, {'to': 'Sansa', 'from': 'Eddard', 'value': 6}, {'to': 'Grenn', 'from': 'Eddison', 'value': 8}, {'to': 'Brynden', 'from': 'Edmure', 'value': 7}, {'to': 'Lothar', 'from': 'Edmure', 'value': 4}, {'to': 'Roslin', 'from': 'Edmure', 'value': 16}, {'to': 'Walder', 'from': 'Edmure', 'value': 9}, {'to': 'Thoros', 'from': 'Gendry', 'value': 7}, {'to': 'Craster', 'from': 'Gilly', 'value': 17}, {'to': 'Elia', 'from': 'Gregor', 'value': 9}, {'to': 'Ilyn', 'from': 'Gregor', 'value': 7}, {'to': 'Meryn', 'from': 'Gregor', 'value': 7}, {'to': 'Oberyn', 'from': 'Gregor', 'value': 24}, {'to': 'Sandor', 'from': 'Gregor', 'value': 12}, {'to': 'Jojen', 'from': 'Hodor', 'value': 35}, {'to': 'Meera', 'from': 'Hodor', 'value': 41}, {'to': 'Edmure', 'from': 'Hoster', 'value': 9}, {'to': 'Drogo', 'from': 'Irri', 'value': 7}, {'to': 'Balon', 'from': 'Jaime', 'value': 6}, {'to': 'Barristan', 'from': 'Jaime', 'value': 4}, {'to': 'Brienne', 'from': 'Jaime', 'value': 88}, {'to': 'Edmure', 'from': 'Jaime', 'value': 5}, {'to': 'Elia', 'from': 'Jaime', 'value': 4}, {'to': 'Gregor', 'from': 'Jaime', 'value': 6}, {'to': 'Joffrey', 'from': 'Jaime', 'value': 15}, {'to': 'Loras', 'from': 'Jaime', 'value': 16}, {'to': 'Meryn', 'from': 'Jaime', 'value': 11}, {'to': 'Qyburn', 'from': 'Jaime', 'value': 11}, {'to': 'Renly', 'from': 'Jaime', 'value': 7}, {'to': 'Robert', 'from': 'Jaime', 'value': 17}, {'to': 'Stannis', 'from': 'Jaime', 'value': 5}, {'to': 'Tommen', 'from': 'Jaime', 'value': 8}, {'to': 'Tyrion', 'from': 'Jaime', 'value': 31}, {'to': 'Alliser', 'from': 'Janos', 'value': 9}, {'to': 'Bowen', 'from': 'Janos', 'value': 5}, {'to': 'Mance', 'from': 'Janos', 'value': 4}, {'to': 'Gregor', 'from': 'Joffrey', 'value': 5}, {'to': 'Ilyn', 'from': 'Joffrey', 'value': 4}, {'to': 'Kevan', 'from': 'Joffrey', 'value': 8}, {'to': 'Loras', 'from': 'Joffrey', 'value': 7}, {'to': 'Margaery', 'from': 'Joffrey', 'value': 28}, {'to': 'Meryn', 'from': 'Joffrey', 'value': 5}, {'to': 'Myrcella', 'from': 'Joffrey', 'value': 5}, {'to': 'Oberyn', 'from': 'Joffrey', 'value': 4}, {'to': 'Sandor', 'from': 'Joffrey', 'value': 14}, {'to': 'Stannis', 'from': 'Joffrey', 'value': 10}, {'to': 'Tommen', 'from': 'Joffrey', 'value': 9}, {'to': 'Tyrion', 'from': 'Joffrey', 'value': 54}, {'to': 'Meera', 'from': 'Jojen', 'value': 33}, {'to': 'Samwell', 'from': 'Jojen', 'value': 11}, {'to': 'Aemon', 'from': 'Jon', 'value': 30}, {'to': 'Alliser', 'from': 'Jon', 'value': 15}, {'to': 'Craster', 'from': 'Jon', 'value': 7}, {'to': 'Dalla', 'from': 'Jon', 'value': 6}, {'to': 'Eddison', 'from': 'Jon', 'value': 4}, {'to': 'Gilly', 'from': 'Jon', 'value': 9}, {'to': 'Grenn', 'from': 'Jon', 'value': 25}, {'to': 'Janos', 'from': 'Jon', 'value': 8}, {'to': 'Mance', 'from': 'Jon', 'value': 69}, {'to': 'Meera', 'from': 'Jon', 'value': 4}, {'to': 'Melisandre', 'from': 'Jon', 'value': 7}, {'to': 'Orell', 'from': 'Jon', 'value': 6}, {'to': 'Qhorin', 'from': 'Jon', 'value': 31}, {'to': 'Rattleshirt', 'from': 'Jon', 'value': 20}, {'to': 'Robert', 'from': 'Jon', 'value': 5}, {'to': 'Samwell', 'from': 'Jon', 'value': 52}, {'to': 'Stannis', 'from': 'Jon', 'value': 9}, {'to': 'Styr', 'from': 'Jon', 'value': 16}, {'to': 'Theon', 'from': 'Jon', 'value': 8}, {'to': 'Val', 'from': 'Jon', 'value': 12}, {'to': 'Ygritte', 'from': 'Jon', 'value': 54}, {'to': 'Lysa', 'from': 'Jon Arryn', 'value': 5}, {'to': 'Robert', 'from': 'Jon Arryn', 'value': 6}, {'to': 'Barristan', 'from': 'Jorah', 'value': 11}, {'to': 'Belwas', 'from': 'Jorah', 'value': 13}, {'to': 'Daario', 'from': 'Jorah', 'value': 7}, {'to': 'Drogo', 'from': 'Jorah', 'value': 6}, {'to': 'Lancel', 'from': 'Kevan', 'value': 7}, {'to': 'Varys', 'from': 'Kevan', 'value': 5}, {'to': 'Margaery', 'from': 'Loras', 'value': 9}, {'to': 'Olenna', 'from': 'Loras', 'value': 5}, {'to': 'Roslin', 'from': 'Lothar', 'value': 4}, {'to': 'Nan', 'from': 'Luwin', 'value': 4}, {'to': 'Cersei', 'from': 'Lysa', 'value': 4}, {'to': 'Hoster', 'from': 'Lysa', 'value': 6}, {'to': 'Marillion', 'from': 'Lysa', 'value': 10}, {'to': 'Petyr', 'from': 'Lysa', 'value': 29}, {'to': 'Robert Arryn', 'from': 'Lysa', 'value': 9}, {'to': 'Tyrion', 'from': 'Lysa', 'value': 5}, {'to': 'Tywin', 'from': 'Lysa', 'value': 4}, {'to': 'Craster', 'from': 'Mance', 'value': 11}, {'to': 'Dalla', 'from': 'Mance', 'value': 8}, {'to': 'Gilly', 'from': 'Mance', 'value': 7}, {'to': 'Qhorin', 'from': 'Mance', 'value': 10}, {'to': 'Rattleshirt', 'from': 'Mance', 'value': 9}, {'to': 'Styr', 'from': 'Mance', 'value': 7}, {'to': 'Val', 'from': 'Mance', 'value': 8}, {'to': 'Ygritte', 'from': 'Mance', 'value': 12}, {'to': 'Samwell', 'from': 'Meera', 'value': 7}, {'to': 'Davos', 'from': 'Melisandre', 'value': 30}, {'to': 'Samwell', 'from': 'Melisandre', 'value': 5}, {'to': 'Ilyn', 'from': 'Meryn', 'value': 5}, {'to': 'Irri', 'from': 'Missandei', 'value': 4}, {'to': 'Tommen', 'from': 'Myrcella', 'value': 5}, {'to': 'Tyrion', 'from': 'Myrcella', 'value': 4}, {'to': 'Ellaria', 'from': 'Oberyn', 'value': 6}, {'to': 'Mace', 'from': 'Oberyn', 'value': 6}, {'to': 'Margaery', 'from': 'Podrick', 'value': 4}, {'to': 'Qhorin', 'from': 'Rattleshirt', 'value': 6}, {'to': 'Loras', 'from': 'Renly', 'value': 8}, {'to': 'Margaery', 'from': 'Renly', 'value': 7}, {'to': 'Varys', 'from': 'Renly', 'value': 4}, {'to': 'Barristan', 'from': 'Rhaegar', 'value': 5}, {'to': 'Elia', 'from': 'Rhaegar', 'value': 7}, {'to': 'Jorah', 'from': 'Rhaegar', 'value': 5}, {'to': 'Robert', 'from': 'Rhaegar', 'value': 6}, {'to': 'Brynden', 'from': 'Rickard', 'value': 4}, {'to': 'Theon', 'from': 'Rickon', 'value': 8}, {'to': 'Arya', 'from': 'Robb', 'value': 15}, {'to': 'Balon', 'from': 'Robb', 'value': 6}, {'to': 'Bran', 'from': 'Robb', 'value': 23}, {'to': 'Brienne', 'from': 'Robb', 'value': 6}, {'to': 'Brynden', 'from': 'Robb', 'value': 17}, {'to': 'Edmure', 'from': 'Robb', 'value': 32}, {'to': 'Hodor', 'from': 'Robb', 'value': 5}, {'to': 'Jaime', 'from': 'Robb', 'value': 15}, {'to': 'Jeyne', 'from': 'Robb', 'value': 18}, {'to': 'Joffrey', 'from': 'Robb', 'value': 10}, {'to': 'Jon', 'from': 'Robb', 'value': 14}, {'to': 'Lothar', 'from': 'Robb', 'value': 10}, {'to': 'Petyr', 'from': 'Robb', 'value': 5}, {'to': 'Ramsay', 'from': 'Robb', 'value': 4}, {'to': 'Rickard', 'from': 'Robb', 'value': 7}, {'to': 'Rickon', 'from': 'Robb', 'value': 15}, {'to': 'Roose', 'from': 'Robb', 'value': 4}, {'to': 'Sansa', 'from': 'Robb', 'value': 15}, {'to': 'Stannis', 'from': 'Robb', 'value': 4}, {'to': 'Theon', 'from': 'Robb', 'value': 11}, {'to': 'Tyrion', 'from': 'Robb', 'value': 12}, {'to': 'Tywin', 'from': 'Robb', 'value': 12}, {'to': 'Walder', 'from': 'Robb', 'value': 26}, {'to': 'Aemon', 'from': 'Robert', 'value': 4}, {'to': 'Barristan', 'from': 'Robert', 'value': 5}, {'to': 'Renly', 'from': 'Robert', 'value': 4}, {'to': 'Stannis', 'from': 'Robert', 'value': 5}, {'to': 'Thoros', 'from': 'Robert', 'value': 4}, {'to': 'Marillion', 'from': 'Robert Arryn', 'value': 4}, {'to': 'Brienne', 'from': 'Roose', 'value': 4}, {'to': 'Bowen', 'from': 'Samwell', 'value': 6}, {'to': 'Craster', 'from': 'Samwell', 'value': 34}, {'to': 'Eddison', 'from': 'Samwell', 'value': 12}, {'to': 'Gilly', 'from': 'Samwell', 'value': 36}, {'to': 'Grenn', 'from': 'Samwell', 'value': 43}, {'to': 'Janos', 'from': 'Samwell', 'value': 6}, {'to': 'Mance', 'from': 'Samwell', 'value': 10}, {'to': 'Qhorin', 'from': 'Samwell', 'value': 5}, {'to': 'Beric', 'from': 'Sandor', 'value': 15}, {'to': 'Gendry', 'from': 'Sandor', 'value': 5}, {'to': 'Ilyn', 'from': 'Sandor', 'value': 4}, {'to': 'Meryn', 'from': 'Sandor', 'value': 4}, {'to': 'Robert', 'from': 'Sandor', 'value': 6}, {'to': 'Thoros', 'from': 'Sandor', 'value': 10}, {'to': 'Arya', 'from': 'Sansa', 'value': 22}, {'to': 'Bran', 'from': 'Sansa', 'value': 10}, {'to': 'Brienne', 'from': 'Sansa', 'value': 5}, {'to': 'Cersei', 'from': 'Sansa', 'value': 16}, {'to': 'Jaime', 'from': 'Sansa', 'value': 10}, {'to': 'Joffrey', 'from': 'Sansa', 'value': 35}, {'to': 'Jon', 'from': 'Sansa', 'value': 4}, {'to': 'Kevan', 'from': 'Sansa', 'value': 5}, {'to': 'Loras', 'from': 'Sansa', 'value': 14}, {'to': 'Lysa', 'from': 'Sansa', 'value': 28}, {'to': 'Margaery', 'from': 'Sansa', 'value': 36}, {'to': 'Marillion', 'from': 'Sansa', 'value': 9}, {'to': 'Myrcella', 'from': 'Sansa', 'value': 4}, {'to': 'Olenna', 'from': 'Sansa', 'value': 7}, {'to': 'Petyr', 'from': 'Sansa', 'value': 28}, {'to': 'Podrick', 'from': 'Sansa', 'value': 8}, {'to': 'Renly', 'from': 'Sansa', 'value': 4}, {'to': 'Rickon', 'from': 'Sansa', 'value': 7}, {'to': 'Robert', 'from': 'Sansa', 'value': 5}, {'to': 'Robert Arryn', 'from': 'Sansa', 'value': 6}, {'to': 'Sandor', 'from': 'Sansa', 'value': 6}, {'to': 'Shae', 'from': 'Sansa', 'value': 8}, {'to': 'Tyrion', 'from': 'Sansa', 'value': 77}, {'to': 'Chataya', 'from': 'Shae', 'value': 4}, {'to': 'Varys', 'from': 'Shae', 'value': 8}, {'to': 'Davos', 'from': 'Shireen', 'value': 5}, {'to': 'Aemon', 'from': 'Stannis', 'value': 4}, {'to': 'Balon', 'from': 'Stannis', 'value': 4}, {'to': 'Davos', 'from': 'Stannis', 'value': 32}, {'to': 'Melisandre', 'from': 'Stannis', 'value': 20}, {'to': 'Renly', 'from': 'Stannis', 'value': 15}, {'to': 'Samwell', 'from': 'Stannis', 'value': 13}, {'to': 'Margaery', 'from': 'Tommen', 'value': 5}, {'to': 'Balon', 'from': 'Tyrion', 'value': 4}, {'to': 'Bronn', 'from': 'Tyrion', 'value': 31}, {'to': 'Chataya', 'from': 'Tyrion', 'value': 5}, {'to': 'Doran', 'from': 'Tyrion', 'value': 5}, {'to': 'Elia', 'from': 'Tyrion', 'value': 5}, {'to': 'Ellaria', 'from': 'Tyrion', 'value': 4}, {'to': 'Gregor', 'from': 'Tyrion', 'value': 22}, {'to': 'Ilyn', 'from': 'Tyrion', 'value': 5}, {'to': 'Janos', 'from': 'Tyrion', 'value': 5}, {'to': 'Kevan', 'from': 'Tyrion', 'value': 11}, {'to': 'Loras', 'from': 'Tyrion', 'value': 6}, {'to': 'Mace', 'from': 'Tyrion', 'value': 9}, {'to': 'Margaery', 'from': 'Tyrion', 'value': 7}, {'to': 'Meryn', 'from': 'Tyrion', 'value': 5}, {'to': 'Oberyn', 'from': 'Tyrion', 'value': 25}, {'to': 'Petyr', 'from': 'Tyrion', 'value': 12}, {'to': 'Podrick', 'from': 'Tyrion', 'value': 28}, {'to': 'Pycelle', 'from': 'Tyrion', 'value': 11}, {'to': 'Renly', 'from': 'Tyrion', 'value': 6}, {'to': 'Robert', 'from': 'Tyrion', 'value': 9}, {'to': 'Sandor', 'from': 'Tyrion', 'value': 4}, {'to': 'Shae', 'from': 'Tyrion', 'value': 21}, {'to': 'Stannis', 'from': 'Tyrion', 'value': 6}, {'to': 'Varys', 'from': 'Tyrion', 'value': 18}, {'to': 'Balon', 'from': 'Tywin', 'value': 5}, {'to': 'Brynden', 'from': 'Tywin', 'value': 4}, {'to': 'Cersei', 'from': 'Tywin', 'value': 16}, {'to': 'Gregor', 'from': 'Tywin', 'value': 7}, {'to': 'Jaime', 'from': 'Tywin', 'value': 13}, {'to': 'Joffrey', 'from': 'Tywin', 'value': 13}, {'to': 'Kevan', 'from': 'Tywin', 'value': 14}, {'to': 'Mace', 'from': 'Tywin', 'value': 5}, {'to': 'Oberyn', 'from': 'Tywin', 'value': 6}, {'to': 'Petyr', 'from': 'Tywin', 'value': 4}, {'to': 'Podrick', 'from': 'Tywin', 'value': 5}, {'to': 'Pycelle', 'from': 'Tywin', 'value': 5}, {'to': 'Robert', 'from': 'Tywin', 'value': 11}, {'to': 'Stannis', 'from': 'Tywin', 'value': 15}, {'to': 'Tommen', 'from': 'Tywin', 'value': 4}, {'to': 'Tyrion', 'from': 'Tywin', 'value': 39}, {'to': 'Val', 'from': 'Tywin', 'value': 4}, {'to': 'Varys', 'from': 'Tywin', 'value': 6}, {'to': 'Walder', 'from': 'Tywin', 'value': 4}, {'to': 'Dalla', 'from': 'Val', 'value': 7}, {'to': 'Pycelle', 'from': 'Varys', 'value': 4}, {'to': 'Rhaegar', 'from': 'Viserys', 'value': 7}, {'to': 'Tyrion', 'from': 'Viserys', 'value': 4}, {'to': 'Lothar', 'from': 'Walder', 'value': 12}, {'to': 'Petyr', 'from': 'Walder', 'value': 6}, {'to': 'Roslin', 'from': 'Walder', 'value': 6}, {'to': 'Jaime', 'from': 'Walton', 'value': 10}, {'to': 'Qhorin', 'from': 'Ygritte', 'value': 7}, {'to': 'Rattleshirt', 'from': 'Ygritte', 'value': 9}];
|
42 |
+
|
43 |
+
// adding nodes and edges to the graph
|
44 |
+
data = {nodes: nodes, edges: edges};
|
45 |
+
|
46 |
+
var options = {
|
47 |
+
"configure": {
|
48 |
+
"enabled": false
|
49 |
+
},
|
50 |
+
"edges": {
|
51 |
+
"color": {
|
52 |
+
"inherit": true
|
53 |
+
},
|
54 |
+
"smooth": {
|
55 |
+
"enabled": false,
|
56 |
+
"type": "continuous"
|
57 |
+
}
|
58 |
+
},
|
59 |
+
"interaction": {
|
60 |
+
"dragNodes": true,
|
61 |
+
"hideEdgesOnDrag": false,
|
62 |
+
"hideNodesOnDrag": false
|
63 |
+
},
|
64 |
+
"physics": {
|
65 |
+
"barnesHut": {
|
66 |
+
"gravitationalConstant": -80000,
|
67 |
+
"springConstant": 0.001,
|
68 |
+
"springLength": 250
|
69 |
+
},
|
70 |
+
"enabled": true,
|
71 |
+
"stabilization": {
|
72 |
+
"enabled": true,
|
73 |
+
"fit": true,
|
74 |
+
"iterations": 1000,
|
75 |
+
"onlyDynamicEdges": false,
|
76 |
+
"updateInterval": 50
|
77 |
+
}
|
78 |
+
}
|
79 |
+
};
|
80 |
+
|
81 |
+
|
82 |
+
|
83 |
+
// default to using dot shape for nodes
|
84 |
+
options.nodes = {
|
85 |
+
shape: "dot"
|
86 |
+
}
|
87 |
+
|
88 |
+
network = new vis.Network(container, data, options);
|
89 |
+
return network;
|
90 |
+
|
91 |
+
}
|
92 |
+
|
93 |
+
drawGraph();
|
94 |
+
|
95 |
+
</script>
|
96 |
+
</body>
|
97 |
+
</html>
|
pyvis/pyvis/source/jup.png
DELETED
Binary file (35.8 kB)
|
|
pyvis/pyvis/source/mulnodes.html
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<html>
|
2 |
+
<head>
|
3 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis.css" type="text/css" />
|
4 |
+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis-network.min.js"> </script>
|
5 |
+
|
6 |
+
<!-- <link rel="stylesheet" href="../node_modules/vis/dist/vis.min.css" type="text/css" />
|
7 |
+
<script type="text/javascript" src="../node_modules/vis/dist/vis.js"> </script>-->
|
8 |
+
|
9 |
+
<style type="text/css">
|
10 |
+
|
11 |
+
#mynetwork1 {
|
12 |
+
width: 100%;
|
13 |
+
height: 300px;
|
14 |
+
border: 1px solid lightgray;
|
15 |
+
}
|
16 |
+
</style>
|
17 |
+
|
18 |
+
</head>
|
19 |
+
|
20 |
+
<body>
|
21 |
+
<div id = "mynetwork1"></div>
|
22 |
+
<script type="text/javascript">
|
23 |
+
|
24 |
+
// initialize global variables.
|
25 |
+
var edges;
|
26 |
+
var nodes;
|
27 |
+
var network;
|
28 |
+
var container;
|
29 |
+
var options, data;
|
30 |
+
|
31 |
+
|
32 |
+
// This method is responsible for drawing the graph, returns the drawn network
|
33 |
+
function drawGraph() {
|
34 |
+
var container = document.getElementById('mynetwork1');
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
// parsing and collecting nodes and edges from the python
|
39 |
+
nodes = [{'title': 'I am node 1', 'color': '#00ff1e', 'value': 10, 'label': 'NODE 1', 'shape': 'dot', 'y': 100.2, 'x': 21.4, 'id': 1}, {'title': 'node 2 here', 'color': '#162347', 'value': 100, 'label': 'NODE 2', 'shape': 'dot', 'y': 23.54, 'x': 54.2, 'id': 2}, {'title': 'and im node 3', 'color': '#dd4b39', 'value': 400, 'label': 'NODE 3', 'shape': 'dot', 'y': 32.1, 'x': 11.2, 'id': 3}];
|
40 |
+
edges = [];
|
41 |
+
|
42 |
+
// adding nodes and edges to the graph
|
43 |
+
data = {nodes: nodes, edges: edges};
|
44 |
+
|
45 |
+
var options = {
|
46 |
+
"configure": {
|
47 |
+
"enabled": false
|
48 |
+
},
|
49 |
+
"edges": {
|
50 |
+
"color": {
|
51 |
+
"inherit": true
|
52 |
+
},
|
53 |
+
"smooth": {
|
54 |
+
"enabled": false,
|
55 |
+
"type": "continuous"
|
56 |
+
}
|
57 |
+
},
|
58 |
+
"interaction": {},
|
59 |
+
"physics": {
|
60 |
+
"enabled": true
|
61 |
+
}
|
62 |
+
};
|
63 |
+
|
64 |
+
|
65 |
+
|
66 |
+
// default to using dot shape for nodes
|
67 |
+
options.nodes = {
|
68 |
+
shape: "dot"
|
69 |
+
}
|
70 |
+
|
71 |
+
network = new vis.Network(container, data, options);
|
72 |
+
return network;
|
73 |
+
|
74 |
+
}
|
75 |
+
|
76 |
+
drawGraph();
|
77 |
+
|
78 |
+
</script>
|
79 |
+
</body>
|
80 |
+
</html>
|
pyvis/pyvis/source/net.png
DELETED
Binary file (112 kB)
|
|
pyvis/pyvis/source/net2.png
DELETED
Binary file (327 kB)
|
|
pyvis/pyvis/source/net3.png
DELETED
Binary file (800 kB)
|
|
pyvis/pyvis/source/rednode.png
DELETED
Binary file (4.12 kB)
|
|
pyvis/pyvis/templates/animation_template.html
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<html>
|
2 |
+
|
3 |
+
<head>
|
4 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis.css" type="text/css" />
|
5 |
+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis-network.min.js"> </script>
|
6 |
+
<style type="text/css">
|
7 |
+
#mynetwork {
|
8 |
+
width: {{width}};
|
9 |
+
height: {{height}};
|
10 |
+
border: 1px solid lightgray;
|
11 |
+
}
|
12 |
+
</style>
|
13 |
+
</head>
|
14 |
+
|
15 |
+
<body>
|
16 |
+
<div id="mynetwork"></div>
|
17 |
+
|
18 |
+
|
19 |
+
<button onclick="getNextData()">Next Data!</button>
|
20 |
+
|
21 |
+
|
22 |
+
<input type="button" onclick="addNextData()" value="add node dynamically"> <br />
|
23 |
+
|
24 |
+
|
25 |
+
<script type="text/javascript">
|
26 |
+
var row_index = 0;
|
27 |
+
function addNextData() {
|
28 |
+
console.log(row_index);
|
29 |
+
row_index++;
|
30 |
+
document.button_form.row.value = row_index;
|
31 |
+
}
|
32 |
+
|
33 |
+
</script>
|
34 |
+
|
35 |
+
<script type="text/javascript">
|
36 |
+
|
37 |
+
var edges;
|
38 |
+
var network;
|
39 |
+
var container;
|
40 |
+
var options, data;
|
41 |
+
var edge_ids;
|
42 |
+
|
43 |
+
function drawGraph() {
|
44 |
+
|
45 |
+
var container = document.getElementById('mynetwork');
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
+
{% if use_DOT %}
|
50 |
+
alert("using DOT");
|
51 |
+
var DOTstring = "{{dot_lang|safe}}";
|
52 |
+
var parsedData = vis.network.convertDot(DOTstring);
|
53 |
+
|
54 |
+
data = {
|
55 |
+
nodes: parsedData.nodes,
|
56 |
+
edges: parsedData.edges
|
57 |
+
}
|
58 |
+
|
59 |
+
|
60 |
+
|
61 |
+
var options = parsedData.options;
|
62 |
+
|
63 |
+
options.nodes = {
|
64 |
+
shape: "dot"
|
65 |
+
}
|
66 |
+
|
67 |
+
|
68 |
+
|
69 |
+
{% else %}
|
70 |
+
|
71 |
+
|
72 |
+
var nodes = {{nodes|safe}};
|
73 |
+
|
74 |
+
edges = {{edges|safe}};
|
75 |
+
|
76 |
+
var e_values = [];
|
77 |
+
|
78 |
+
|
79 |
+
console.log("edges: " + e_values);
|
80 |
+
|
81 |
+
data = {nodes: nodes, edges: edges};
|
82 |
+
var options = {{options|safe}};
|
83 |
+
|
84 |
+
{% endif %}
|
85 |
+
|
86 |
+
{% if widget %}
|
87 |
+
var widgetFn = function(option, path) {
|
88 |
+
if(path.indexOf('nodes') !== -1 && option == 'size') {
|
89 |
+
return true;
|
90 |
+
}
|
91 |
+
return false;
|
92 |
+
};
|
93 |
+
|
94 |
+
options.configure.filter = widgetFn;
|
95 |
+
{% endif %}
|
96 |
+
|
97 |
+
|
98 |
+
|
99 |
+
network = new vis.Network(container, data, options);
|
100 |
+
return network;
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
+
|
105 |
+
function getEdges() {
|
106 |
+
old_edges = {};
|
107 |
+
for (var i = 0; i < edges.length; i++) {
|
108 |
+
old_edges[i] = edges[i]["width"];
|
109 |
+
}
|
110 |
+
return old_edges;
|
111 |
+
}
|
112 |
+
|
113 |
+
function outputUpdate(vol) {
|
114 |
+
document.querySelector('#volume').value = vol;
|
115 |
+
updateEdges(vol);
|
116 |
+
}
|
117 |
+
|
118 |
+
function updateEdges(vol) {
|
119 |
+
//console.log("Updating edges based off original widths of " + JSON.stringify(edge_ids));
|
120 |
+
for (var i = 0; i < edges.length; i++) {
|
121 |
+
|
122 |
+
var originalVal = old_edges[i];
|
123 |
+
//console.log("original value: " + originalVal);
|
124 |
+
edges[i]["width"] = originalVal + ((vol/10) * originalVal);
|
125 |
+
//console.log("new edge width: " + edges[i]["width"]);
|
126 |
+
|
127 |
+
}
|
128 |
+
|
129 |
+
data.edges = edges;
|
130 |
+
//console.log(data);
|
131 |
+
network.setData(data);
|
132 |
+
}
|
133 |
+
|
134 |
+
new_network = drawGraph();
|
135 |
+
old_edges = getEdges();
|
136 |
+
|
137 |
+
|
138 |
+
|
139 |
+
</script>
|
140 |
+
|
141 |
+
|
142 |
+
|
143 |
+
</body>
|
144 |
+
</html>
|
pyvis/pyvis/templates/template.html
ADDED
@@ -0,0 +1,376 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<html>
|
2 |
+
<head>
|
3 |
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vis-network@latest/styles/vis-network.css" type="text/css" />
|
4 |
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vis-network@latest/dist/vis-network.min.js"> </script>
|
5 |
+
|
6 |
+
<script type="text/javascript" src="lib/bindings/utils.js"></script>
|
7 |
+
<link
|
8 |
+
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css"
|
9 |
+
rel="stylesheet"
|
10 |
+
integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6"
|
11 |
+
crossorigin="anonymous"
|
12 |
+
/>
|
13 |
+
<script
|
14 |
+
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.bundle.min.js"
|
15 |
+
integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf"
|
16 |
+
crossorigin="anonymous"
|
17 |
+
></script>
|
18 |
+
|
19 |
+
{#
|
20 |
+
<link
|
21 |
+
rel="stylesheet"
|
22 |
+
href="https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis.css"
|
23 |
+
type="text/css"
|
24 |
+
/>
|
25 |
+
<script
|
26 |
+
type="text/javascript"
|
27 |
+
src="https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis-network.min.js"
|
28 |
+
></script>
|
29 |
+
#}
|
30 |
+
<center>
|
31 |
+
<h1>{{heading}}</h1>
|
32 |
+
</center>
|
33 |
+
|
34 |
+
<!-- <link rel="stylesheet" href="../node_modules/vis/dist/vis.min.css" type="text/css" />
|
35 |
+
|
36 |
+
<script type="text/javascript" src="../node_modules/vis/dist/vis.js"> </script>-->
|
37 |
+
|
38 |
+
<style type="text/css">
|
39 |
+
|
40 |
+
#mynetwork {
|
41 |
+
width: {{width}};
|
42 |
+
height: {{height}};
|
43 |
+
background-color: {{bgcolor}};
|
44 |
+
border: 1px solid lightgray;
|
45 |
+
position: relative;
|
46 |
+
float: left;
|
47 |
+
}
|
48 |
+
|
49 |
+
{% if nodes|length > 100 and physics_enabled %}
|
50 |
+
#loadingBar {
|
51 |
+
position:absolute;
|
52 |
+
top:0px;
|
53 |
+
left:0px;
|
54 |
+
width: {{width}};
|
55 |
+
height: {{height}};
|
56 |
+
background-color:rgba(200,200,200,0.8);
|
57 |
+
-webkit-transition: all 0.5s ease;
|
58 |
+
-moz-transition: all 0.5s ease;
|
59 |
+
-ms-transition: all 0.5s ease;
|
60 |
+
-o-transition: all 0.5s ease;
|
61 |
+
transition: all 0.5s ease;
|
62 |
+
opacity:1;
|
63 |
+
}
|
64 |
+
|
65 |
+
#bar {
|
66 |
+
position:absolute;
|
67 |
+
top:0px;
|
68 |
+
left:0px;
|
69 |
+
width:20px;
|
70 |
+
height:20px;
|
71 |
+
margin:auto auto auto auto;
|
72 |
+
border-radius:11px;
|
73 |
+
border:2px solid rgba(30,30,30,0.05);
|
74 |
+
background: rgb(0, 173, 246); /* Old browsers */
|
75 |
+
box-shadow: 2px 0px 4px rgba(0,0,0,0.4);
|
76 |
+
}
|
77 |
+
|
78 |
+
#border {
|
79 |
+
position:absolute;
|
80 |
+
top:10px;
|
81 |
+
left:10px;
|
82 |
+
width:500px;
|
83 |
+
height:23px;
|
84 |
+
margin:auto auto auto auto;
|
85 |
+
box-shadow: 0px 0px 4px rgba(0,0,0,0.2);
|
86 |
+
border-radius:10px;
|
87 |
+
}
|
88 |
+
|
89 |
+
#text {
|
90 |
+
position:absolute;
|
91 |
+
top:8px;
|
92 |
+
left:530px;
|
93 |
+
width:30px;
|
94 |
+
height:50px;
|
95 |
+
margin:auto auto auto auto;
|
96 |
+
font-size:22px;
|
97 |
+
color: #000000;
|
98 |
+
}
|
99 |
+
|
100 |
+
div.outerBorder {
|
101 |
+
position:relative;
|
102 |
+
top:400px;
|
103 |
+
width:600px;
|
104 |
+
height:44px;
|
105 |
+
margin:auto auto auto auto;
|
106 |
+
border:8px solid rgba(0,0,0,0.1);
|
107 |
+
background: rgb(252,252,252); /* Old browsers */
|
108 |
+
background: -moz-linear-gradient(top, rgba(252,252,252,1) 0%, rgba(237,237,237,1) 100%); /* FF3.6+ */
|
109 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(252,252,252,1)), color-stop(100%,rgba(237,237,237,1))); /* Chrome,Safari4+ */
|
110 |
+
background: -webkit-linear-gradient(top, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* Chrome10+,Safari5.1+ */
|
111 |
+
background: -o-linear-gradient(top, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* Opera 11.10+ */
|
112 |
+
background: -ms-linear-gradient(top, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* IE10+ */
|
113 |
+
background: linear-gradient(to bottom, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* W3C */
|
114 |
+
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfcfc', endColorstr='#ededed',GradientType=0 ); /* IE6-9 */
|
115 |
+
border-radius:72px;
|
116 |
+
box-shadow: 0px 0px 10px rgba(0,0,0,0.2);
|
117 |
+
}
|
118 |
+
{% endif %}
|
119 |
+
|
120 |
+
{% if conf %}
|
121 |
+
#config {
|
122 |
+
float: left;
|
123 |
+
width: 400px;
|
124 |
+
height: 600px;
|
125 |
+
}
|
126 |
+
{% endif %}
|
127 |
+
|
128 |
+
{% if tooltip_link %}
|
129 |
+
/* position absolute is important and the container has to be relative or absolute as well. */
|
130 |
+
div.popup {
|
131 |
+
position:absolute;
|
132 |
+
top:0px;
|
133 |
+
left:0px;
|
134 |
+
display:none;
|
135 |
+
background-color:#f5f4ed;
|
136 |
+
-moz-border-radius: 3px;
|
137 |
+
-webkit-border-radius: 3px;
|
138 |
+
border-radius: 3px;
|
139 |
+
border: 1px solid #808074;
|
140 |
+
box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);
|
141 |
+
}
|
142 |
+
|
143 |
+
/* hide the original tooltip */
|
144 |
+
.vis-tooltip {
|
145 |
+
display:none;
|
146 |
+
}
|
147 |
+
{% endif %}
|
148 |
+
</style>
|
149 |
+
</head>
|
150 |
+
|
151 |
+
<body>
|
152 |
+
<div class="card" style="width: 100%">
|
153 |
+
{% if select_menu %}
|
154 |
+
<div class="card-header">
|
155 |
+
<div class="row no-gutters">
|
156 |
+
<div class="col-10 pb-2">
|
157 |
+
<select
|
158 |
+
class="form-select"
|
159 |
+
aria-label="Default select example"
|
160 |
+
onchange="selectNode(value);"
|
161 |
+
searchable="Search here"
|
162 |
+
>
|
163 |
+
<option selected>Select a Node by ID</option>
|
164 |
+
{% for node in nodes %}
|
165 |
+
<option value="{{ node.id }}">{{node.id}}</option>
|
166 |
+
{% endfor %} {#
|
167 |
+
<option value="2">Two</option>
|
168 |
+
<option value="3">Three</option>
|
169 |
+
#}
|
170 |
+
</select>
|
171 |
+
</div>
|
172 |
+
<div class="col-2 pb-2">
|
173 |
+
<button type="button" class="btn btn-primary btn-block" onclick="neighbourhoodHighlight({nodes: []});">Reset Selection</button>
|
174 |
+
<div>
|
175 |
+
</div>
|
176 |
+
</div>
|
177 |
+
{% endif %}
|
178 |
+
<div id="mynetwork" class="card-body"></div>
|
179 |
+
</div>
|
180 |
+
{#
|
181 |
+
<div id="mynetwork"></div>
|
182 |
+
#} {% if nodes|length > 100 and physics_enabled %}
|
183 |
+
<div id="loadingBar">
|
184 |
+
<div class="outerBorder">
|
185 |
+
<div id="text">0%</div>
|
186 |
+
<div id="border">
|
187 |
+
<div id="bar"></div>
|
188 |
+
</div>
|
189 |
+
</div>
|
190 |
+
</div>
|
191 |
+
|
192 |
+
{% endif %} {% if conf %}
|
193 |
+
<div id="config"></div>
|
194 |
+
|
195 |
+
|
196 |
+
{% endif %}
|
197 |
+
<script type="text/javascript">
|
198 |
+
|
199 |
+
// initialize global variables.
|
200 |
+
var edges;
|
201 |
+
var nodes;
|
202 |
+
var allNodes;
|
203 |
+
var nodeColors;
|
204 |
+
var originalNodes;
|
205 |
+
var network;
|
206 |
+
var container;
|
207 |
+
var options, data;
|
208 |
+
|
209 |
+
|
210 |
+
// This method is responsible for drawing the graph, returns the drawn network
|
211 |
+
function drawGraph() {
|
212 |
+
var container = document.getElementById('mynetwork');
|
213 |
+
|
214 |
+
{% if use_DOT %}
|
215 |
+
|
216 |
+
var DOTstring = "{{dot_lang|safe}}";
|
217 |
+
var parsedData = vis.network.convertDot(DOTstring);
|
218 |
+
|
219 |
+
//data = vis.network.dotparser.DOTToGraph(DOTstring);
|
220 |
+
data = {
|
221 |
+
nodes: parsedData.nodes,
|
222 |
+
edges: parsedData.edges
|
223 |
+
}
|
224 |
+
|
225 |
+
var options = parsedData.options;
|
226 |
+
options = Object.assign(options, {
|
227 |
+
nodes: {
|
228 |
+
shape: "dot"
|
229 |
+
},
|
230 |
+
});
|
231 |
+
{% if options %}
|
232 |
+
options = Object.assign(options, {{options|safe}})
|
233 |
+
{% endif %}
|
234 |
+
|
235 |
+
{% else %}
|
236 |
+
|
237 |
+
// parsing and collecting nodes and edges from the python
|
238 |
+
nodes = new vis.DataSet({{nodes|tojson}});
|
239 |
+
edges = new vis.DataSet({{edges|tojson}});
|
240 |
+
|
241 |
+
nodeColors = {};
|
242 |
+
allNodes = nodes.get({ returnType: "Object" });
|
243 |
+
for (var nodeId in allNodes) {
|
244 |
+
nodeColors[nodeId] = allNodes[nodeId].color;
|
245 |
+
}
|
246 |
+
|
247 |
+
// adding nodes and edges to the graph
|
248 |
+
data = {nodes: nodes, edges: edges};
|
249 |
+
|
250 |
+
var options = {{options|safe}};
|
251 |
+
|
252 |
+
{% endif %}
|
253 |
+
|
254 |
+
{% if conf %}
|
255 |
+
// if this network requires displaying the configure window,
|
256 |
+
// put it in its div
|
257 |
+
options.configure["container"] = document.getElementById("config");
|
258 |
+
{% endif %}
|
259 |
+
|
260 |
+
network = new vis.Network(container, data, options);
|
261 |
+
|
262 |
+
{% if neighborhood_highlight %}
|
263 |
+
network.on("click", neighbourhoodHighlight);
|
264 |
+
{% endif %}
|
265 |
+
|
266 |
+
{% if select_menu %}
|
267 |
+
network.on("selectNode", neighbourhoodHighlight);
|
268 |
+
{% endif %}
|
269 |
+
|
270 |
+
{% if tooltip_link %}
|
271 |
+
// make a custom popup
|
272 |
+
var popup = document.createElement("div");
|
273 |
+
popup.className = 'popup';
|
274 |
+
popupTimeout = null;
|
275 |
+
popup.addEventListener('mouseover', function () {
|
276 |
+
console.log(popup)
|
277 |
+
if (popupTimeout !== null) {
|
278 |
+
clearTimeout(popupTimeout);
|
279 |
+
popupTimeout = null;
|
280 |
+
}
|
281 |
+
});
|
282 |
+
popup.addEventListener('mouseout', function () {
|
283 |
+
if (popupTimeout === null) {
|
284 |
+
hidePopup();
|
285 |
+
}
|
286 |
+
});
|
287 |
+
container.appendChild(popup);
|
288 |
+
|
289 |
+
|
290 |
+
// use the popup event to show
|
291 |
+
network.on("showPopup", function (params) {
|
292 |
+
showPopup(params);
|
293 |
+
});
|
294 |
+
|
295 |
+
// use the hide event to hide it
|
296 |
+
network.on("hidePopup", function (params) {
|
297 |
+
hidePopup();
|
298 |
+
});
|
299 |
+
|
300 |
+
|
301 |
+
// hiding the popup through css
|
302 |
+
function hidePopup() {
|
303 |
+
popupTimeout = setTimeout(function () { popup.style.display = 'none'; }, 500);
|
304 |
+
}
|
305 |
+
|
306 |
+
// showing the popup
|
307 |
+
function showPopup(nodeId) {
|
308 |
+
|
309 |
+
// get the data from the vis.DataSet
|
310 |
+
var nodeData = nodes.get(nodeId);
|
311 |
+
// get the position of the node
|
312 |
+
var posCanvas = network.getPositions([nodeId])[nodeId];
|
313 |
+
|
314 |
+
if (!nodeData) {
|
315 |
+
var edgeData = edges.get(nodeId);
|
316 |
+
var poses = network.getPositions([edgeData.from, edgeData.to]);
|
317 |
+
var middle_x = (poses[edgeData.to].x - poses[edgeData.from].x) * 0.5;
|
318 |
+
var middle_y = (poses[edgeData.to].y - poses[edgeData.from].y) * 0.5;
|
319 |
+
posCanvas = poses[edgeData.from];
|
320 |
+
posCanvas.x = posCanvas.x + middle_x;
|
321 |
+
posCanvas.y = posCanvas.y + middle_y;
|
322 |
+
|
323 |
+
popup.innerHTML = edgeData.title;
|
324 |
+
} else {
|
325 |
+
popup.innerHTML = nodeData.title;
|
326 |
+
// get the bounding box of the node
|
327 |
+
var boundingBox = network.getBoundingBox(nodeId);
|
328 |
+
posCanvas.x = posCanvas.x + 0.5 * (boundingBox.right - boundingBox.left);
|
329 |
+
posCanvas.y = posCanvas.y + 0.5 * (boundingBox.top - boundingBox.bottom);
|
330 |
+
};
|
331 |
+
|
332 |
+
// convert coordinates to the DOM space
|
333 |
+
var posDOM = network.canvasToDOM(posCanvas);
|
334 |
+
|
335 |
+
// Give it an offset
|
336 |
+
posDOM.x += 10;
|
337 |
+
posDOM.y -= 20;
|
338 |
+
|
339 |
+
// show and place the tooltip.
|
340 |
+
popup.style.display = 'block';
|
341 |
+
popup.style.top = posDOM.y + 'px';
|
342 |
+
popup.style.left = posDOM.x + 'px';
|
343 |
+
}
|
344 |
+
{% endif %}
|
345 |
+
|
346 |
+
|
347 |
+
{% if nodes|length > 100 and physics_enabled %}
|
348 |
+
network.on("stabilizationProgress", function(params) {
|
349 |
+
document.getElementById('loadingBar').removeAttribute("style");
|
350 |
+
var maxWidth = 496;
|
351 |
+
var minWidth = 20;
|
352 |
+
var widthFactor = params.iterations/params.total;
|
353 |
+
var width = Math.max(minWidth,maxWidth * widthFactor);
|
354 |
+
|
355 |
+
document.getElementById('bar').style.width = width + 'px';
|
356 |
+
document.getElementById('text').innerHTML = Math.round(widthFactor*100) + '%';
|
357 |
+
});
|
358 |
+
network.once("stabilizationIterationsDone", function() {
|
359 |
+
document.getElementById('text').innerHTML = '100%';
|
360 |
+
document.getElementById('bar').style.width = '496px';
|
361 |
+
document.getElementById('loadingBar').style.opacity = 0;
|
362 |
+
// really clean the dom element
|
363 |
+
setTimeout(function () {document.getElementById('loadingBar').style.display = 'none';}, 500);
|
364 |
+
});
|
365 |
+
{% endif %}
|
366 |
+
|
367 |
+
return network;
|
368 |
+
|
369 |
+
}
|
370 |
+
|
371 |
+
drawGraph();
|
372 |
+
|
373 |
+
</script>
|
374 |
+
</body>
|
375 |
+
|
376 |
+
</html>
|