Dorjzodovsuren commited on
Commit
6160702
·
verified ·
1 Parent(s): a431423

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +491 -18
index.html CHANGED
@@ -1,19 +1,492 @@
1
- <!doctype html>
2
  <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <html>
2
+ <head>
3
+ <meta charset="utf-8">
4
+
5
+ <script>function neighbourhoodHighlight(params) {
6
+ // console.log("in nieghbourhoodhighlight");
7
+ allNodes = nodes.get({ returnType: "Object" });
8
+ // originalNodes = JSON.parse(JSON.stringify(allNodes));
9
+ // if something is selected:
10
+ if (params.nodes.length > 0) {
11
+ highlightActive = true;
12
+ var i, j;
13
+ var selectedNode = params.nodes[0];
14
+ var degrees = 2;
15
+
16
+ // mark all nodes as hard to read.
17
+ for (let nodeId in allNodes) {
18
+ // nodeColors[nodeId] = allNodes[nodeId].color;
19
+ allNodes[nodeId].color = "rgba(200,200,200,0.5)";
20
+ if (allNodes[nodeId].hiddenLabel === undefined) {
21
+ allNodes[nodeId].hiddenLabel = allNodes[nodeId].label;
22
+ allNodes[nodeId].label = undefined;
23
+ }
24
+ }
25
+ var connectedNodes = network.getConnectedNodes(selectedNode);
26
+ var allConnectedNodes = [];
27
+
28
+ // get the second degree nodes
29
+ for (i = 1; i < degrees; i++) {
30
+ for (j = 0; j < connectedNodes.length; j++) {
31
+ allConnectedNodes = allConnectedNodes.concat(
32
+ network.getConnectedNodes(connectedNodes[j])
33
+ );
34
+ }
35
+ }
36
+
37
+ // all second degree nodes get a different color and their label back
38
+ for (i = 0; i < allConnectedNodes.length; i++) {
39
+ // allNodes[allConnectedNodes[i]].color = "pink";
40
+ allNodes[allConnectedNodes[i]].color = "rgba(150,150,150,0.75)";
41
+ if (allNodes[allConnectedNodes[i]].hiddenLabel !== undefined) {
42
+ allNodes[allConnectedNodes[i]].label =
43
+ allNodes[allConnectedNodes[i]].hiddenLabel;
44
+ allNodes[allConnectedNodes[i]].hiddenLabel = undefined;
45
+ }
46
+ }
47
+
48
+ // all first degree nodes get their own color and their label back
49
+ for (i = 0; i < connectedNodes.length; i++) {
50
+ // allNodes[connectedNodes[i]].color = undefined;
51
+ allNodes[connectedNodes[i]].color = nodeColors[connectedNodes[i]];
52
+ if (allNodes[connectedNodes[i]].hiddenLabel !== undefined) {
53
+ allNodes[connectedNodes[i]].label =
54
+ allNodes[connectedNodes[i]].hiddenLabel;
55
+ allNodes[connectedNodes[i]].hiddenLabel = undefined;
56
+ }
57
+ }
58
+
59
+ // the main node gets its own color and its label back.
60
+ // allNodes[selectedNode].color = undefined;
61
+ allNodes[selectedNode].color = nodeColors[selectedNode];
62
+ if (allNodes[selectedNode].hiddenLabel !== undefined) {
63
+ allNodes[selectedNode].label = allNodes[selectedNode].hiddenLabel;
64
+ allNodes[selectedNode].hiddenLabel = undefined;
65
+ }
66
+ } else if (highlightActive === true) {
67
+ // console.log("highlightActive was true");
68
+ // reset all nodes
69
+ for (let nodeId in allNodes) {
70
+ // allNodes[nodeId].color = "purple";
71
+ allNodes[nodeId].color = nodeColors[nodeId];
72
+ // delete allNodes[nodeId].color;
73
+ if (allNodes[nodeId].hiddenLabel !== undefined) {
74
+ allNodes[nodeId].label = allNodes[nodeId].hiddenLabel;
75
+ allNodes[nodeId].hiddenLabel = undefined;
76
+ }
77
+ }
78
+ highlightActive = false;
79
+ }
80
+
81
+ // transform the object into an array
82
+ var updateArray = [];
83
+ if (params.nodes.length > 0) {
84
+ for (let nodeId in allNodes) {
85
+ if (allNodes.hasOwnProperty(nodeId)) {
86
+ // console.log(allNodes[nodeId]);
87
+ updateArray.push(allNodes[nodeId]);
88
+ }
89
+ }
90
+ nodes.update(updateArray);
91
+ } else {
92
+ // console.log("Nothing was selected");
93
+ for (let nodeId in allNodes) {
94
+ if (allNodes.hasOwnProperty(nodeId)) {
95
+ // console.log(allNodes[nodeId]);
96
+ // allNodes[nodeId].color = {};
97
+ updateArray.push(allNodes[nodeId]);
98
+ }
99
+ }
100
+ nodes.update(updateArray);
101
+ }
102
+ }
103
+
104
+ function filterHighlight(params) {
105
+ allNodes = nodes.get({ returnType: "Object" });
106
+ // if something is selected:
107
+ if (params.nodes.length > 0) {
108
+ filterActive = true;
109
+ let selectedNodes = params.nodes;
110
+
111
+ // hiding all nodes and saving the label
112
+ for (let nodeId in allNodes) {
113
+ allNodes[nodeId].hidden = true;
114
+ if (allNodes[nodeId].savedLabel === undefined) {
115
+ allNodes[nodeId].savedLabel = allNodes[nodeId].label;
116
+ allNodes[nodeId].label = undefined;
117
+ }
118
+ }
119
+
120
+ for (let i=0; i < selectedNodes.length; i++) {
121
+ allNodes[selectedNodes[i]].hidden = false;
122
+ if (allNodes[selectedNodes[i]].savedLabel !== undefined) {
123
+ allNodes[selectedNodes[i]].label = allNodes[selectedNodes[i]].savedLabel;
124
+ allNodes[selectedNodes[i]].savedLabel = undefined;
125
+ }
126
+ }
127
+
128
+ } else if (filterActive === true) {
129
+ // reset all nodes
130
+ for (let nodeId in allNodes) {
131
+ allNodes[nodeId].hidden = false;
132
+ if (allNodes[nodeId].savedLabel !== undefined) {
133
+ allNodes[nodeId].label = allNodes[nodeId].savedLabel;
134
+ allNodes[nodeId].savedLabel = undefined;
135
+ }
136
+ }
137
+ filterActive = false;
138
+ }
139
+
140
+ // transform the object into an array
141
+ var updateArray = [];
142
+ if (params.nodes.length > 0) {
143
+ for (let nodeId in allNodes) {
144
+ if (allNodes.hasOwnProperty(nodeId)) {
145
+ updateArray.push(allNodes[nodeId]);
146
+ }
147
+ }
148
+ nodes.update(updateArray);
149
+ } else {
150
+ for (let nodeId in allNodes) {
151
+ if (allNodes.hasOwnProperty(nodeId)) {
152
+ updateArray.push(allNodes[nodeId]);
153
+ }
154
+ }
155
+ nodes.update(updateArray);
156
+ }
157
+ }
158
+
159
+ function selectNode(nodes) {
160
+ network.selectNodes(nodes);
161
+ neighbourhoodHighlight({ nodes: nodes });
162
+ return nodes;
163
+ }
164
+
165
+ function selectNodes(nodes) {
166
+ network.selectNodes(nodes);
167
+ filterHighlight({nodes: nodes});
168
+ return nodes;
169
+ }
170
+
171
+ function highlightFilter(filter) {
172
+ let selectedNodes = []
173
+ let selectedProp = filter['property']
174
+ if (filter['item'] === 'node') {
175
+ let allNodes = nodes.get({ returnType: "Object" });
176
+ for (let nodeId in allNodes) {
177
+ if (allNodes[nodeId][selectedProp] && filter['value'].includes((allNodes[nodeId][selectedProp]).toString())) {
178
+ selectedNodes.push(nodeId)
179
+ }
180
+ }
181
+ }
182
+ else if (filter['item'] === 'edge'){
183
+ let allEdges = edges.get({returnType: 'object'});
184
+ // check if the selected property exists for selected edge and select the nodes connected to the edge
185
+ for (let edge in allEdges) {
186
+ if (allEdges[edge][selectedProp] && filter['value'].includes((allEdges[edge][selectedProp]).toString())) {
187
+ selectedNodes.push(allEdges[edge]['from'])
188
+ selectedNodes.push(allEdges[edge]['to'])
189
+ }
190
+ }
191
+ }
192
+ selectNodes(selectedNodes)
193
+ }</script>
194
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/vis-network/9.1.2/dist/dist/vis-network.min.css" integrity="sha512-WgxfT5LWjfszlPHXRmBWHkV2eceiWTOBvrKCNbdgDYTHrT2AeLCGbF4sZlZw3UMN3WtL0tGUoIAKsu8mllg/XA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
195
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/vis-network/9.1.2/dist/vis-network.min.js" integrity="sha512-LnvoEWDFrqGHlHmDD2101OrLcbsfkrzoSpvtSQtxK3RMnRV0eOkhhBN2dXHKRrUU8p2DGRTk35n4O8nWSVe1mQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
196
+
197
+
198
+
199
+
200
+
201
+
202
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tom-select/2.0.0-rc.4/css/tom-select.min.css" integrity="sha512-43fHB3GLgZfz8QXl1RPQ8O66oIgv3po9cJ5erMt1c4QISq9dYb195T3vr5ImnJPXuVroKcGBPXBFKETW8jrPNQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
203
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/tom-select/2.0.0-rc.4/js/tom-select.complete.js" integrity="sha512-jeF9CfnvzDiw9G9xiksVjxR2lib44Gnovvkv+3CgCG6NXCD4gqlA5nDAVW5WjpA+i+/zKsUWV5xNEbW1X/HH0Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
204
+
205
+
206
+
207
+ <center>
208
+ <h1></h1>
209
+ </center>
210
+
211
+ <!-- <link rel="stylesheet" href="../node_modules/vis/dist/vis.min.css" type="text/css" />
212
+ <script type="text/javascript" src="../node_modules/vis/dist/vis.js"> </script>-->
213
+ <link
214
+ href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css"
215
+ rel="stylesheet"
216
+ integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6"
217
+ crossorigin="anonymous"
218
+ />
219
+ <script
220
+ src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.bundle.min.js"
221
+ integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf"
222
+ crossorigin="anonymous"
223
+ ></script>
224
+
225
+
226
+ <center>
227
+ <h1></h1>
228
+ </center>
229
+ <style type="text/css">
230
+
231
+ #mynetwork {
232
+ width: 100%;
233
+ height: 1200px;
234
+ background-color: #222222;
235
+ border: 1px solid lightgray;
236
+ position: relative;
237
+ float: left;
238
+ }
239
+
240
+
241
+
242
+
243
+
244
+
245
+ </style>
246
+ </head>
247
+
248
+
249
+ <body>
250
+ <div class="card" style="width: 100%">
251
+
252
+
253
+ <div id="filter-menu" class="card-header">
254
+ <div class="row no-gutters">
255
+ <div class="col-3 pb-2">
256
+ <select
257
+ class="form-select"
258
+ aria-label="Default select example"
259
+ onchange="updateFilter(value, 'item')"
260
+ id="select-item"
261
+ >
262
+ <option value="">Select a network item</option>
263
+ <option value="edge">edge</option>
264
+ <option value="node">node</option>
265
+ </select>
266
+ </div>
267
+ <div class="col-3 pb-2">
268
+ <select
269
+ class="form-select"
270
+ aria-label="Default select example"
271
+ onchange="updateFilter(value, 'property')"
272
+ id="select-property"
273
+ >
274
+ <option value="">Select a property...</option>
275
+ </select>
276
+ </div>
277
+ <div class="col-3 pb-2">
278
+ <select
279
+ class="form-select"
280
+ aria-label="Default select example"
281
+ id="select-value"
282
+ >
283
+ <option value="">Select value(s)...</option>
284
+ </select>
285
+ </div>
286
+ <div class="col-1 pb-2">
287
+ <button type="button" class="btn btn-primary btn-block" onclick="highlightFilter(filter);">Filter</button>
288
+ </div>
289
+ <div class="col-2 pb-2">
290
+ <button type="button" class="btn btn-primary btn-block" onclick="clearFilter(true)">Reset Selection</button>
291
+ </div>
292
+ </div>
293
+ </div>
294
+
295
+ <div id="mynetwork" class="card-body"></div>
296
+ </div>
297
+
298
+
299
+
300
+
301
+ <script type="text/javascript">
302
+
303
+ // initialize global variables.
304
+ var edges;
305
+ var nodes;
306
+ var allNodes;
307
+ var allEdges;
308
+ var nodeColors;
309
+ var originalNodes;
310
+ var network;
311
+ var container;
312
+ var options, data;
313
+ var filter = {
314
+ item : '',
315
+ property : '',
316
+ value : []
317
+ };
318
+
319
+
320
+
321
+
322
+ // explicitly using onItemAdd and this function as we need to save multiple values
323
+ let updateValueFilter = function() {
324
+ return function () {
325
+ filter['value'].push(arguments[0])
326
+ }
327
+ }
328
+
329
+ let valueControl = new TomSelect("#select-value",{
330
+ maxItems: null,
331
+ valueField: 'id',
332
+ labelField: 'title',
333
+ searchField: 'title',
334
+ create: false,
335
+ sortField: {
336
+ field: "text",
337
+ direction: "asc"
338
+ },
339
+ onItemAdd: updateValueFilter()
340
+ });
341
+
342
+ let addValues = function() {
343
+ return function () {
344
+ // clear the current value options and add the selected attribute values
345
+ // tom-select handles duplicates
346
+ let selectedProperty = arguments[0];
347
+ valueControl.clear();
348
+ valueControl.clearOptions();
349
+ filter['value'] = []
350
+ if (filter['item'] === 'node') {
351
+ for (let each in allNodes) {
352
+ valueControl.addOption({
353
+ id:allNodes[each][selectedProperty],
354
+ title:allNodes[each][selectedProperty]
355
+ })
356
+ }
357
+ }
358
+ else if (filter['item'] === 'edge') {
359
+ for (let each in allEdges) {
360
+ valueControl.addOption({
361
+ id:allEdges[each][selectedProperty],
362
+ title:allEdges[each][selectedProperty]
363
+ })
364
+ }
365
+ }
366
+ }
367
+ };
368
+
369
+ let propControl = new TomSelect("#select-property",{
370
+ valueField: 'id',
371
+ labelField: 'title',
372
+ searchField: 'title',
373
+ create: false,
374
+ sortField: {
375
+ field: "text",
376
+ direction: "asc"
377
+ },
378
+ onItemAdd: addValues()
379
+ });
380
+
381
+ let addProperties = function() {
382
+ return function () {
383
+ // loops through the selected network item and adds the attributes to dropdown
384
+ // tom-select handles duplicates
385
+ clearFilter(false)
386
+ if (arguments[0] === 'edge') {
387
+ for (let each in allEdges) {
388
+ if (allEdges.hasOwnProperty(each)) {
389
+ for (let eachProp in allEdges[each]) {
390
+ if (allEdges[each].hasOwnProperty(eachProp)) {
391
+ propControl.addOption({id: eachProp, title: eachProp})
392
+ }
393
+ }
394
+ }
395
+ }
396
+ }
397
+ else if (arguments[0] === 'node') {
398
+ for (let each in allNodes) {
399
+ if (allNodes.hasOwnProperty(each)) {
400
+ for (let eachProp in allNodes[each]) {
401
+ if (allNodes[each].hasOwnProperty(eachProp)
402
+ && (eachProp !== 'hidden' && eachProp !== 'savedLabel'
403
+ && eachProp !== 'hiddenLabel')) {
404
+ propControl.addOption({id: eachProp, title: eachProp})
405
+
406
+ }
407
+ }
408
+ }
409
+ }
410
+ }
411
+ }
412
+ };
413
+
414
+ let itemControl = new TomSelect("#select-item",{
415
+ create: false,
416
+ sortField:{
417
+ field: "text",
418
+ direction: "asc"
419
+ },
420
+ onItemAdd: addProperties()
421
+ });
422
+
423
+ function clearFilter(reset) {
424
+ // utility function to clear all the selected filter options
425
+ // if reset is set to true, the existing filter will be removed
426
+ // else, only the dropdown options are cleared
427
+ propControl.clear();
428
+ propControl.clearOptions();
429
+ valueControl.clear();
430
+ valueControl.clearOptions();
431
+ filter = {
432
+ item : '',
433
+ property : '',
434
+ value : []
435
+ }
436
+ if (reset) {
437
+ itemControl.clear();
438
+ filterHighlight({nodes: []})
439
+ }
440
+ }
441
+
442
+ function updateFilter(value, key) {
443
+ // key could be 'item' or 'property' and value is as selected in dropdown
444
+ filter[key] = value
445
+ }
446
+
447
+
448
+
449
+ // This method is responsible for drawing the graph, returns the drawn network
450
+ function drawGraph() {
451
+ var container = document.getElementById('mynetwork');
452
+
453
+
454
+
455
+ // parsing and collecting nodes and edges from the python
456
+ nodes = new vis.DataSet([{"font": {"color": "white"}, "group": "Concept", "id": "Elliptical Orbit", "label": "Elliptical Orbit", "shape": "dot", "title": "Concept"}, {"font": {"color": "white"}, "group": "Technology", "id": "Orbital Refilling", "label": "Orbital Refilling", "shape": "dot", "title": "Technology"}, {"font": {"color": "white"}, "group": "Organization", "id": "Airbus", "label": "Airbus", "shape": "dot", "title": "Organization"}, {"font": {"color": "white"}, "group": "Material", "id": "Advanced Ceramics", "label": "Advanced Ceramics", "shape": "dot", "title": "Material"}, {"font": {"color": "white"}, "group": "Technology", "id": "Reusable Heat Shield", "label": "Reusable Heat Shield", "shape": "dot", "title": "Technology"}, {"font": {"color": "white"}, "group": "State of matter", "id": "Plasma", "label": "Plasma", "shape": "dot", "title": "State of matter"}, {"font": {"color": "white"}, "group": "Group", "id": "People", "label": "People", "shape": "dot", "title": "Group"}, {"font": {"color": "white"}, "group": "Organization", "id": "Boeing", "label": "Boeing", "shape": "dot", "title": "Organization"}, {"font": {"color": "white"}, "group": "Person", "id": "Douglas Adams", "label": "Douglas Adams", "shape": "dot", "title": "Person"}, {"font": {"color": "white"}, "group": "Concept", "id": "Equipment", "label": "Equipment", "shape": "dot", "title": "Concept"}, {"font": {"color": "white"}, "group": "Chemical compound", "id": "Carbon Dioxide", "label": "Carbon Dioxide", "shape": "dot", "title": "Chemical compound"}, {"font": {"color": "white"}, "group": "Version", "id": "Version 3", "label": "Version 3", "shape": "dot", "title": "Version"}, {"font": {"color": "white"}, "group": "Spacecraft", "id": "Starship", "label": "Starship", "shape": "dot", "title": "Spacecraft"}, {"font": {"color": "white"}, "group": "Celestial body", "id": "Moon", "label": "Moon", "shape": "dot", "title": "Celestial body"}, {"font": {"color": "white"}, "group": "Program", "id": "Apollo Program", "label": "Apollo Program", "shape": "dot", "title": "Program"}, {"font": {"color": "white"}, "group": "Concept", "id": "Heat", "label": "Heat", "shape": "dot", "title": "Concept"}, {"font": {"color": "white"}, "group": "Concept", "id": "Pressure", "label": "Pressure", "shape": "dot", "title": "Concept"}, {"font": {"color": "white"}, "group": "Rocket", "id": "Saturn V", "label": "Saturn V", "shape": "dot", "title": "Rocket"}, {"font": {"color": "white"}, "group": "Concept", "id": "Reliability", "label": "Reliability", "shape": "dot", "title": "Concept"}, {"font": {"color": "white"}, "group": "Planet", "id": "Mars", "label": "Mars", "shape": "dot", "title": "Planet"}, {"font": {"color": "white"}, "group": "Base", "id": "Moon Base Alpha", "label": "Moon Base Alpha", "shape": "dot", "title": "Base"}, {"font": {"color": "white"}, "group": "City", "id": "Starbase", "label": "Starbase", "shape": "dot", "title": "City"}, {"font": {"color": "white"}, "group": "Satellite", "id": "Starlink Satellite", "label": "Starlink Satellite", "shape": "dot", "title": "Satellite"}, {"font": {"color": "white"}, "group": "Rocket component", "id": "Super Heavy Booster", "label": "Super Heavy Booster", "shape": "dot", "title": "Rocket component"}, {"font": {"color": "white"}, "group": "Rocket engine", "id": "Raptor 3", "label": "Raptor 3", "shape": "dot", "title": "Rocket engine"}, {"font": {"color": "white"}, "group": "Chemical element", "id": "Oxygen", "label": "Oxygen", "shape": "dot", "title": "Chemical element"}, {"font": {"color": "white"}, "group": "Robot", "id": "Optimus", "label": "Optimus", "shape": "dot", "title": "Robot"}, {"font": {"color": "white"}, "group": "State", "id": "Texas", "label": "Texas", "shape": "dot", "title": "State"}, {"font": {"color": "white"}, "group": "Organization", "id": "Spacex", "label": "Spacex", "shape": "dot", "title": "Organization"}, {"font": {"color": "white"}, "group": "Book", "id": "The Hitchhiker\u0027S Guide To The Galaxy", "label": "The Hitchhiker\u0027S Guide To The Galaxy", "shape": "dot", "title": "Book"}, {"font": {"color": "white"}, "group": "Service", "id": "Starlink Internet", "label": "Starlink Internet", "shape": "dot", "title": "Service"}, {"font": {"color": "white"}, "group": "Planet", "id": "Earth", "label": "Earth", "shape": "dot", "title": "Planet"}]);
457
+ edges = new vis.DataSet([{"arrows": "to", "from": "Starbase", "label": "located_in", "to": "Texas"}, {"arrows": "to", "from": "Starbase", "label": "purpose_supports_travel_to", "to": "Mars"}, {"arrows": "to", "from": "Starbase", "label": "associated_with", "to": "Spacex"}, {"arrows": "to", "from": "Starship", "label": "uses", "to": "Super Heavy Booster"}, {"arrows": "to", "from": "Starship", "label": "uses", "to": "Raptor 3"}, {"arrows": "to", "from": "Starship", "label": "carries", "to": "Starlink Satellite"}, {"arrows": "to", "from": "Starship", "label": "travels_to", "to": "Mars"}, {"arrows": "to", "from": "Starship", "label": "travels_to", "to": "Moon"}, {"arrows": "to", "from": "Spacex", "label": "built", "to": "Starbase"}, {"arrows": "to", "from": "Spacex", "label": "developed", "to": "Starship"}, {"arrows": "to", "from": "Spacex", "label": "developed", "to": "Super Heavy Booster"}, {"arrows": "to", "from": "Spacex", "label": "developed", "to": "Raptor 3"}, {"arrows": "to", "from": "Spacex", "label": "developed", "to": "Starlink Satellite"}, {"arrows": "to", "from": "Starlink Satellite", "label": "provides", "to": "Starlink Internet"}, {"arrows": "to", "from": "Starship", "label": "production_scale_comparable_to", "to": "Boeing"}, {"arrows": "to", "from": "Starship", "label": "production_scale_comparable_to", "to": "Airbus"}, {"arrows": "to", "from": "Starship", "label": "transports_to_mars", "to": "People"}, {"arrows": "to", "from": "Starship", "label": "transports_to_mars", "to": "Equipment"}, {"arrows": "to", "from": "Version 3", "label": "achieves", "to": "Reliability"}, {"arrows": "to", "from": "Version 3", "label": "achieves", "to": "Orbital Refilling"}, {"arrows": "to", "from": "Version 3", "label": "is_a_version_of", "to": "Starship"}, {"arrows": "to", "from": "Douglas Adams", "label": "authored", "to": "The Hitchhiker\u0027S Guide To The Galaxy"}, {"arrows": "to", "from": "Starship", "label": "capability_twice_that_of", "to": "Saturn V"}, {"arrows": "to", "from": "Moon Base Alpha", "label": "follows", "to": "Apollo Program"}, {"arrows": "to", "from": "Starship", "label": "transports_to_mars", "to": "Optimus"}, {"arrows": "to", "from": "Optimus", "label": "explores", "to": "Mars"}, {"arrows": "to", "from": "Raptor 3", "label": "improves", "to": "Reliability"}, {"arrows": "to", "from": "Reusable Heat Shield", "label": "withstands", "to": "Heat"}, {"arrows": "to", "from": "Reusable Heat Shield", "label": "withstands", "to": "Pressure"}, {"arrows": "to", "from": "Advanced Ceramics", "label": "withstand", "to": "Heat"}, {"arrows": "to", "from": "Advanced Ceramics", "label": "withstand", "to": "Pressure"}, {"arrows": "to", "from": "Carbon Dioxide", "label": "becomes_in_atmosphere", "to": "Plasma"}, {"arrows": "to", "from": "Plasma", "label": "contains", "to": "Oxygen"}, {"arrows": "to", "from": "Elliptical Orbit", "label": "connects", "to": "Earth"}, {"arrows": "to", "from": "Elliptical Orbit", "label": "connects", "to": "Mars"}]);
458
+
459
+ nodeColors = {};
460
+ allNodes = nodes.get({ returnType: "Object" });
461
+ for (nodeId in allNodes) {
462
+ nodeColors[nodeId] = allNodes[nodeId].color;
463
+ }
464
+ allEdges = edges.get({ returnType: "Object" });
465
+ // adding nodes and edges to the graph
466
+ data = {nodes: nodes, edges: edges};
467
+
468
+ var options = {"physics": {"forceAtlas2Based": {"gravitationalConstant": -100, "centralGravity": 0.01, "springLength": 200, "springConstant": 0.08}, "minVelocity": 0.75, "solver": "forceAtlas2Based"}};
469
+
470
+
471
+
472
+
473
+
474
+
475
+ network = new vis.Network(container, data, options);
476
+
477
+
478
+
479
+
480
+
481
+
482
+
483
+
484
+
485
+
486
+ return network;
487
+
488
+ }
489
+ drawGraph();
490
+ </script>
491
+ </body>
492
+ </html>