dwb2023 commited on
Commit
8d34a49
·
verified ·
1 Parent(s): facd15b

upload files

Browse files
Screenshot 2025-01-22 142631.png ADDED
Screenshot 2025-01-22 142909.png ADDED
Screenshot 2025-01-22 143039.png ADDED
centrality_network.html ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+ <head>
3
+ <meta charset="utf-8">
4
+
5
+ <script src="lib/bindings/utils.js"></script>
6
+ <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" />
7
+ <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>
8
+
9
+
10
+ <center>
11
+ <h1></h1>
12
+ </center>
13
+
14
+ <!-- <link rel="stylesheet" href="../node_modules/vis/dist/vis.min.css" type="text/css" />
15
+ <script type="text/javascript" src="../node_modules/vis/dist/vis.js"> </script>-->
16
+ <link
17
+ href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
18
+ rel="stylesheet"
19
+ integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6"
20
+ crossorigin="anonymous"
21
+ />
22
+ <script
23
+ src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
24
+ integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf"
25
+ crossorigin="anonymous"
26
+ ></script>
27
+
28
+
29
+ <center>
30
+ <h1></h1>
31
+ </center>
32
+ <style type="text/css">
33
+
34
+ #mynetwork {
35
+ width: 100%;
36
+ height: 600px;
37
+ background-color: #ffffff;
38
+ border: 1px solid lightgray;
39
+ position: relative;
40
+ float: left;
41
+ }
42
+
43
+
44
+
45
+
46
+
47
+
48
+ </style>
49
+ </head>
50
+
51
+
52
+ <body>
53
+ <div class="card" style="width: 100%">
54
+
55
+
56
+ <div id="mynetwork" class="card-body"></div>
57
+ </div>
58
+
59
+
60
+
61
+
62
+ <script type="text/javascript">
63
+
64
+ // initialize global variables.
65
+ var edges;
66
+ var nodes;
67
+ var allNodes;
68
+ var allEdges;
69
+ var nodeColors;
70
+ var originalNodes;
71
+ var network;
72
+ var container;
73
+ var options, data;
74
+ var filter = {
75
+ item : '',
76
+ property : '',
77
+ value : []
78
+ };
79
+
80
+
81
+
82
+
83
+
84
+ // This method is responsible for drawing the graph, returns the drawn network
85
+ function drawGraph() {
86
+ var container = document.getElementById('mynetwork');
87
+
88
+
89
+
90
+ // parsing and collecting nodes and edges from the python
91
+ nodes = new vis.DataSet([{"centrality": 0.071, "color": "#97c2fc", "id": "Acciaiuoli", "label": "Acciaiuoli", "shape": "dot", "size": 7.1}, {"centrality": 0.429, "color": "#97c2fc", "id": "Medici", "label": "Medici", "shape": "dot", "size": 42.9}, {"centrality": 0.286, "color": "#97c2fc", "id": "Strozzi", "label": "Strozzi", "shape": "dot", "size": 28.599999999999998}, {"centrality": 0.143, "color": "#97c2fc", "id": "Salviati", "label": "Salviati", "shape": "dot", "size": 14.299999999999999}, {"centrality": 0.214, "color": "#97c2fc", "id": "Castellani", "label": "Castellani", "shape": "dot", "size": 21.4}, {"centrality": 0.214, "color": "#97c2fc", "id": "Peruzzi", "label": "Peruzzi", "shape": "dot", "size": 21.4}, {"centrality": 0.143, "color": "#97c2fc", "id": "Barbadori", "label": "Barbadori", "shape": "dot", "size": 14.299999999999999}, {"centrality": 0.214, "color": "#97c2fc", "id": "Ridolfi", "label": "Ridolfi", "shape": "dot", "size": 21.4}, {"centrality": 0.214, "color": "#97c2fc", "id": "Tornabuoni", "label": "Tornabuoni", "shape": "dot", "size": 21.4}, {"centrality": 0.214, "color": "#97c2fc", "id": "Albizzi", "label": "Albizzi", "shape": "dot", "size": 21.4}, {"centrality": 0.071, "color": "#97c2fc", "id": "Pazzi", "label": "Pazzi", "shape": "dot", "size": 7.1}, {"centrality": 0.214, "color": "#97c2fc", "id": "Bischeri", "label": "Bischeri", "shape": "dot", "size": 21.4}, {"centrality": 0.286, "color": "#97c2fc", "id": "Guadagni", "label": "Guadagni", "shape": "dot", "size": 28.599999999999998}, {"centrality": 0.071, "color": "#97c2fc", "id": "Ginori", "label": "Ginori", "shape": "dot", "size": 7.1}, {"centrality": 0.071, "color": "#97c2fc", "id": "Lamberteschi", "label": "Lamberteschi", "shape": "dot", "size": 7.1}]);
92
+ edges = new vis.DataSet([{"from": "Acciaiuoli", "to": "Medici", "width": 1}, {"from": "Acciaiuoli", "to": "Strozzi", "width": 1}, {"from": "Acciaiuoli", "to": "Salviati", "width": 1}, {"from": "Medici", "to": "Castellani", "width": 1}, {"from": "Medici", "to": "Peruzzi", "width": 1}, {"from": "Medici", "to": "Strozzi", "width": 1}, {"from": "Medici", "to": "Barbadori", "width": 1}, {"from": "Medici", "to": "Ridolfi", "width": 1}, {"from": "Medici", "to": "Tornabuoni", "width": 1}, {"from": "Medici", "to": "Albizzi", "width": 1}, {"from": "Medici", "to": "Salviati", "width": 1}, {"from": "Medici", "to": "Pazzi", "width": 1}, {"from": "Castellani", "to": "Peruzzi", "width": 1}, {"from": "Peruzzi", "to": "Strozzi", "width": 1}, {"from": "Strozzi", "to": "Barbadori", "width": 1}, {"from": "Strozzi", "to": "Ridolfi", "width": 1}, {"from": "Strozzi", "to": "Tornabuoni", "width": 1}, {"from": "Strozzi", "to": "Albizzi", "width": 1}, {"from": "Strozzi", "to": "Salviati", "width": 1}, {"from": "Barbadori", "to": "Ridolfi", "width": 1}, {"from": "Barbadori", "to": "Tornabuoni", "width": 1}, {"from": "Barbadori", "to": "Albizzi", "width": 1}, {"from": "Ridolfi", "to": "Tornabuoni", "width": 1}, {"from": "Ridolfi", "to": "Albizzi", "width": 1}, {"from": "Tornabuoni", "to": "Albizzi", "width": 1}, {"from": "Tornabuoni", "to": "Salviati", "width": 1}, {"from": "Albizzi", "to": "Salviati", "width": 1}, {"from": "Bischeri", "to": "Guadagni", "width": 1}, {"from": "Bischeri", "to": "Ginori", "width": 1}, {"from": "Bischeri", "to": "Lamberteschi", "width": 1}, {"from": "Guadagni", "to": "Ginori", "width": 1}, {"from": "Guadagni", "to": "Lamberteschi", "width": 1}, {"from": "Ginori", "to": "Lamberteschi", "width": 1}]);
93
+
94
+ nodeColors = {};
95
+ allNodes = nodes.get({ returnType: "Object" });
96
+ for (nodeId in allNodes) {
97
+ nodeColors[nodeId] = allNodes[nodeId].color;
98
+ }
99
+ allEdges = edges.get({ returnType: "Object" });
100
+ // adding nodes and edges to the graph
101
+ data = {nodes: nodes, edges: edges};
102
+
103
+ var options = {
104
+ "configure": {
105
+ "enabled": false
106
+ },
107
+ "edges": {
108
+ "color": {
109
+ "inherit": true
110
+ },
111
+ "smooth": {
112
+ "enabled": true,
113
+ "type": "dynamic"
114
+ }
115
+ },
116
+ "interaction": {
117
+ "dragNodes": true,
118
+ "hideEdgesOnDrag": false,
119
+ "hideNodesOnDrag": false
120
+ },
121
+ "physics": {
122
+ "enabled": true,
123
+ "stabilization": {
124
+ "enabled": true,
125
+ "fit": true,
126
+ "iterations": 1000,
127
+ "onlyDynamicEdges": false,
128
+ "updateInterval": 50
129
+ }
130
+ }
131
+ };
132
+
133
+
134
+
135
+
136
+
137
+
138
+ network = new vis.Network(container, data, options);
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+ return network;
150
+
151
+ }
152
+ drawGraph();
153
+ </script>
154
+ </body>
155
+ </html>