-
Notifications
You must be signed in to change notification settings - Fork 0
/
nx.html
80 lines (45 loc) · 7.42 KB
/
nx.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis.css" type="text/css" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis-network.min.js"> </script>
<center>
<h1></h1>
</center>
<!-- <link rel="stylesheet" href="../node_modules/vis/dist/vis.min.css" type="text/css" />
<script type="text/javascript" src="../node_modules/vis/dist/vis.js"> </script>-->
<style type="text/css">
#mynetwork {
width: 500px;
height: 500px;
background-color: #ffffff;
border: 1px solid lightgray;
position: relative;
float: left;
}
</style>
</head>
<body>
<div id = "mynetwork"></div>
<script type="text/javascript">
// initialize global variables.
var edges;
var nodes;
var network;
var container;
var options, data;
// This method is responsible for drawing the graph, returns the drawn network
function drawGraph() {
var container = document.getElementById('mynetwork');
// parsing and collecting nodes and edges from the python
nodes = new vis.DataSet([{"id": "-117.9027018373121133.82400999381079", "label": 1896, "physics": false, "shape": "dot", "size": 10}, {"id": "-118.354745870712434.07472304960422", "label": 463, "physics": false, "shape": "dot", "size": 10}, {"id": "-122.3655578662295137.773846056393445", "label": 3049, "physics": false, "shape": "dot", "size": 10}, {"id": "-122.012145814323637.34730218037135", "label": 213, "physics": false, "shape": "dot", "size": 10}, {"id": "-117.1357510875576132.835742556067586", "label": 651, "physics": false, "shape": "dot", "size": 10}, {"id": "-119.6311127356321934.84359938505747", "label": 174, "physics": false, "shape": "dot", "size": 10}, {"id": "-116.9144713380281633.907904633802815", "label": 142, "physics": false, "shape": "dot", "size": 10}, {"id": "-121.3225045226781938.57332355291577", "label": 1130, "physics": false, "shape": "dot", "size": 10}, {"color": "green", "id": "-119.6945900519480536.7120376948052", "label": 1508, "physics": false, "shape": "star", "size": 10}, {"id": "-122.495728517730538.48772224822695", "label": 154, "physics": false, "shape": "dot", "size": 10}]);
edges = new vis.DataSet([{"from": "-117.9027018373121133.82400999381079", "to": "-118.354745870712434.07472304960422", "weight": 1}, {"from": "-117.9027018373121133.82400999381079", "to": "-122.3655578662295137.773846056393445", "weight": 1}, {"from": "-117.9027018373121133.82400999381079", "to": "-122.012145814323637.34730218037135", "weight": 1}, {"from": "-117.9027018373121133.82400999381079", "to": "-117.1357510875576132.835742556067586", "weight": 1}, {"from": "-117.9027018373121133.82400999381079", "to": "-119.6311127356321934.84359938505747", "weight": 1}, {"from": "-117.9027018373121133.82400999381079", "to": "-116.9144713380281633.907904633802815", "weight": 1}, {"from": "-117.9027018373121133.82400999381079", "to": "-121.3225045226781938.57332355291577", "weight": 1}, {"from": "-117.9027018373121133.82400999381079", "to": "-119.6945900519480536.7120376948052", "weight": 1}, {"from": "-117.9027018373121133.82400999381079", "to": "-122.495728517730538.48772224822695", "weight": 1}, {"from": "-122.3655578662295137.773846056393445", "to": "-118.354745870712434.07472304960422", "weight": 1}, {"from": "-122.3655578662295137.773846056393445", "to": "-119.6311127356321934.84359938505747", "weight": 1}, {"from": "-122.3655578662295137.773846056393445", "to": "-122.012145814323637.34730218037135", "weight": 1}, {"from": "-122.3655578662295137.773846056393445", "to": "-117.1357510875576132.835742556067586", "weight": 1}, {"from": "-122.3655578662295137.773846056393445", "to": "-116.9144713380281633.907904633802815", "weight": 1}, {"from": "-122.3655578662295137.773846056393445", "to": "-121.3225045226781938.57332355291577", "weight": 1}, {"from": "-122.3655578662295137.773846056393445", "to": "-119.6945900519480536.7120376948052", "weight": 1}, {"from": "-122.3655578662295137.773846056393445", "to": "-122.495728517730538.48772224822695", "weight": 1}, {"from": "-119.6945900519480536.7120376948052", "to": "-118.354745870712434.07472304960422", "weight": 1}, {"from": "-119.6945900519480536.7120376948052", "to": "-122.012145814323637.34730218037135", "weight": 1}, {"from": "-119.6945900519480536.7120376948052", "to": "-117.1357510875576132.835742556067586", "weight": 1}, {"from": "-119.6945900519480536.7120376948052", "to": "-116.9144713380281633.907904633802815", "weight": 1}, {"from": "-119.6945900519480536.7120376948052", "to": "-121.3225045226781938.57332355291577", "weight": 1}, {"from": "-119.6945900519480536.7120376948052", "to": "-119.6311127356321934.84359938505747", "weight": 1}, {"from": "-119.6945900519480536.7120376948052", "to": "-122.495728517730538.48772224822695", "weight": 1}, {"from": "-117.1357510875576132.835742556067586", "to": "-118.354745870712434.07472304960422", "weight": 1}, {"from": "-117.1357510875576132.835742556067586", "to": "-122.012145814323637.34730218037135", "weight": 1}, {"from": "-117.1357510875576132.835742556067586", "to": "-119.6311127356321934.84359938505747", "weight": 1}, {"from": "-117.1357510875576132.835742556067586", "to": "-116.9144713380281633.907904633802815", "weight": 1}, {"from": "-117.1357510875576132.835742556067586", "to": "-121.3225045226781938.57332355291577", "weight": 1}, {"from": "-117.1357510875576132.835742556067586", "to": "-122.495728517730538.48772224822695", "weight": 1}, {"from": "-121.3225045226781938.57332355291577", "to": "-118.354745870712434.07472304960422", "weight": 1}, {"from": "-121.3225045226781938.57332355291577", "to": "-122.012145814323637.34730218037135", "weight": 1}, {"from": "-121.3225045226781938.57332355291577", "to": "-116.9144713380281633.907904633802815", "weight": 1}, {"from": "-121.3225045226781938.57332355291577", "to": "-119.6311127356321934.84359938505747", "weight": 1}, {"from": "-121.3225045226781938.57332355291577", "to": "-122.495728517730538.48772224822695", "weight": 1}, {"from": "-122.012145814323637.34730218037135", "to": "-118.354745870712434.07472304960422", "weight": 1}, {"from": "-122.012145814323637.34730218037135", "to": "-119.6311127356321934.84359938505747", "weight": 1}, {"from": "-122.012145814323637.34730218037135", "to": "-116.9144713380281633.907904633802815", "weight": 1}, {"from": "-122.012145814323637.34730218037135", "to": "-122.495728517730538.48772224822695", "weight": 1}, {"from": "-118.354745870712434.07472304960422", "to": "-116.9144713380281633.907904633802815", "weight": 1}, {"from": "-118.354745870712434.07472304960422", "to": "-122.495728517730538.48772224822695", "weight": 1}, {"from": "-118.354745870712434.07472304960422", "to": "-119.6311127356321934.84359938505747", "weight": 1}, {"from": "-122.495728517730538.48772224822695", "to": "-116.9144713380281633.907904633802815", "weight": 1}, {"from": "-122.495728517730538.48772224822695", "to": "-119.6311127356321934.84359938505747", "weight": 1}, {"from": "-116.9144713380281633.907904633802815", "to": "-119.6311127356321934.84359938505747", "weight": 1}]);
// adding nodes and edges to the graph
data = {nodes: nodes, edges: edges};
var options = {"layout": {"randomSeed": 5}};
network = new vis.Network(container, data, options);
return network;
}
drawGraph();
</script>
</body>
</html>