mirror of
https://github.com/fhswf/aki_prj23_transparenzregister.git
synced 2026-02-13 22:17:38 +01:00
feat: NetworkX in Plotly Dash
This commit is contained in:
1 parent
b9e9475050
commit
af0578bb00
5 files changed
+1507
-33
No files matched your search
@@ -0,0 +1,272 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<script src="lib/bindings/utils.js"></script>
|
||||
<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" />
|
||||
<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>
|
||||
|
||||
|
||||
<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>-->
|
||||
<link
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css"
|
||||
rel="stylesheet"
|
||||
integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
<script
|
||||
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.bundle.min.js"
|
||||
integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
|
||||
|
||||
<center>
|
||||
<h1></h1>
|
||||
</center>
|
||||
<style type="text/css">
|
||||
|
||||
#mynetwork {
|
||||
width: 100%;
|
||||
height: 600px;
|
||||
background-color: white;
|
||||
border: 1px solid lightgray;
|
||||
position: relative;
|
||||
float: left;
|
||||
}
|
||||
|
||||
|
||||
#loadingBar {
|
||||
position:absolute;
|
||||
top:0px;
|
||||
left:0px;
|
||||
width: 100%;
|
||||
height: 600px;
|
||||
background-color:rgba(200,200,200,0.8);
|
||||
-webkit-transition: all 0.5s ease;
|
||||
-moz-transition: all 0.5s ease;
|
||||
-ms-transition: all 0.5s ease;
|
||||
-o-transition: all 0.5s ease;
|
||||
transition: all 0.5s ease;
|
||||
opacity:1;
|
||||
}
|
||||
|
||||
#bar {
|
||||
position:absolute;
|
||||
top:0px;
|
||||
left:0px;
|
||||
width:20px;
|
||||
height:20px;
|
||||
margin:auto auto auto auto;
|
||||
border-radius:11px;
|
||||
border:2px solid rgba(30,30,30,0.05);
|
||||
background: rgb(0, 173, 246); /* Old browsers */
|
||||
box-shadow: 2px 0px 4px rgba(0,0,0,0.4);
|
||||
}
|
||||
|
||||
#border {
|
||||
position:absolute;
|
||||
top:10px;
|
||||
left:10px;
|
||||
width:500px;
|
||||
height:23px;
|
||||
margin:auto auto auto auto;
|
||||
box-shadow: 0px 0px 4px rgba(0,0,0,0.2);
|
||||
border-radius:10px;
|
||||
}
|
||||
|
||||
#text {
|
||||
position:absolute;
|
||||
top:8px;
|
||||
left:530px;
|
||||
width:30px;
|
||||
height:50px;
|
||||
margin:auto auto auto auto;
|
||||
font-size:22px;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
div.outerBorder {
|
||||
position:relative;
|
||||
top:400px;
|
||||
width:600px;
|
||||
height:44px;
|
||||
margin:auto auto auto auto;
|
||||
border:8px solid rgba(0,0,0,0.1);
|
||||
background: rgb(252,252,252); /* Old browsers */
|
||||
background: -moz-linear-gradient(top, rgba(252,252,252,1) 0%, rgba(237,237,237,1) 100%); /* FF3.6+ */
|
||||
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+ */
|
||||
background: -webkit-linear-gradient(top, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* Chrome10+,Safari5.1+ */
|
||||
background: -o-linear-gradient(top, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* Opera 11.10+ */
|
||||
background: -ms-linear-gradient(top, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* IE10+ */
|
||||
background: linear-gradient(to bottom, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* W3C */
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfcfc', endColorstr='#ededed',GradientType=0 ); /* IE6-9 */
|
||||
border-radius:72px;
|
||||
box-shadow: 0px 0px 10px rgba(0,0,0,0.2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#config {
|
||||
float: left;
|
||||
width: 400px;
|
||||
height: 600px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
<div class="card" style="width: 100%">
|
||||
|
||||
|
||||
<div id="mynetwork" class="card-body"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="loadingBar">
|
||||
<div class="outerBorder">
|
||||
<div id="text">0%</div>
|
||||
<div id="border">
|
||||
<div id="bar"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="config"></div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
// initialize global variables.
|
||||
var edges;
|
||||
var nodes;
|
||||
var allNodes;
|
||||
var allEdges;
|
||||
var nodeColors;
|
||||
var originalNodes;
|
||||
var network;
|
||||
var container;
|
||||
var options, data;
|
||||
var filter = {
|
||||
item : '',
|
||||
property : '',
|
||||
value : []
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 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([{"color": "#729b79ff", "font": {"color": "black"}, "id": "person_1", "label": "Tetau, Nicolas", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "company_1", "label": "0 10 24 Telefondienste GmbH", "shape": "dot", "size": 10, "type": "Company"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "company_4", "label": "01050.com GmbH", "shape": "dot", "size": 10, "type": "Company"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_2", "label": "Dammast, Lutz", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_3", "label": "Tutsch, Rosemarie", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "company_2", "label": "1. Staiger Grundst\u00fccksverwaltung GmbH \u0026 Co. KG", "shape": "dot", "size": 10, "type": "Company"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_4", "label": "Staiger, Marc", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_5", "label": "Staiger, Michaela", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_6", "label": "Staiger, Margarete", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_7", "label": "Staiger, Bruno", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_8", "label": "Hofmann, Nicole", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_9", "label": "Autenrieth, Steffen", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "company_3", "label": "1 A Autenrieth Kunststofftechnik GmbH \u0026 Co. KG", "shape": "dot", "size": 10, "type": "Company"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_10", "label": "Bischoff, Stefanie", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "company_2213", "label": "Multi-Center Warenvertriebs GmbH", "shape": "dot", "size": 10, "type": "Company"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "company_5", "label": "2. Schaper Objekt GmbH \u0026 Co. Kiel KG", "shape": "dot", "size": 10, "type": "Company"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_11", "label": "Achilles, Christel", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "company_6", "label": "AASP Filmproduktionsgesellschaft mbH \u0026 Co. Leonie KG", "shape": "dot", "size": 10, "type": "Company"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_12", "label": "Ackermann, Wilhelm", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_13", "label": "Ahrens, Harald", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_14", "label": "Al Sibai, Mohamed Maged", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_15", "label": "Al-Bazaz, Salim", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_16", "label": "Attawar, Marina", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_17", "label": "Babic-Pavicic, Ankica", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_18", "label": "Bak, Ingo", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_19", "label": "Becker, Christoph", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_20", "label": "Becker, Olaf", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_21", "label": "Berg, Rainer", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_22", "label": "Berkhout, Pieter", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_23", "label": "Berns, Bernhard", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_24", "label": "Betz, Franz-Hartwig", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_25", "label": "Birken, Claus", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_26", "label": "Blessing, Helmut", "shape": "dot", "size":Line truncated
|
||||
edges = new vis.DataSet([{"from": "person_1", "label": "Gesch\u00e4ftsf\u00fchrer", "to": "company_1", "width": 1}, {"from": "person_1", "label": "Gesch\u00e4ftsf\u00fchrer", "to": "company_4", "width": 1}, {"from": "company_1", "label": "Prokurist", "to": "person_2", "width": 1}, {"from": "person_2", "label": "Prokurist", "to": "company_4", "width": 1}, {"from": "person_3", "label": "Kommanditist", "to": "company_2", "width": 1}, {"from": "company_2", "label": "Kommanditist", "to": "person_4", "width": 1}, {"from": "company_2", "label": "Kommanditist", "to": "person_5", "width": 1}, {"from": "company_2", "label": "Kommanditist", "to": "person_6", "width": 1}, {"from": "company_2", "label": "Kommanditist", "to": "person_7", "width": 1}, {"from": "company_2", "label": "Kommanditist", "to": "person_8", "width": 1}, {"from": "person_9", "label": "Kommanditist", "to": "company_3", "width": 1}, {"from": "company_3", "label": "Prokurist", "to": "person_10", "width": 1}, {"from": "company_2213", "label": "Organisation", "to": "company_5", "width": 1}, {"from": "person_11", "label": "Kommanditist", "to": "company_6", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_12", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_13", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_14", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_15", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_16", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_17", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_18", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_19", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_20", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_21", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_22", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_23", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_24", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_25", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_26", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_27", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_28", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_29", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_30", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_31", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_32", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_33", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_34", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_35", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_36", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_37", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_38", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_39", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_40", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_41", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_42", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_43", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_44", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_45", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_46", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_47", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_48", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_49", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_50", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_51", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_52", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_53", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_54", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_55", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_56", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_57", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_58", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_59", "width": 1}, {"from": "company_6", "label": "Kommanditist", "tLine truncated
|
||||
|
||||
nodeColors = {};
|
||||
allNodes = nodes.get({ returnType: "Object" });
|
||||
for (nodeId in allNodes) {
|
||||
nodeColors[nodeId] = allNodes[nodeId].color;
|
||||
}
|
||||
allEdges = edges.get({ returnType: "Object" });
|
||||
// adding nodes and edges to the graph
|
||||
data = {nodes: nodes, edges: edges};
|
||||
|
||||
var options = {
|
||||
"configure": {
|
||||
"enabled": true
|
||||
},
|
||||
"edges": {
|
||||
"color": {
|
||||
"inherit": false
|
||||
},
|
||||
"smooth": {
|
||||
"enabled": true,
|
||||
"type": "dynamic"
|
||||
}
|
||||
},
|
||||
"interaction": {
|
||||
"dragNodes": true,
|
||||
"hideEdgesOnDrag": false,
|
||||
"hideNodesOnDrag": false
|
||||
},
|
||||
"physics": {
|
||||
"enabled": true,
|
||||
"repulsion": {
|
||||
"centralGravity": 0.2,
|
||||
"damping": 0.09,
|
||||
"nodeDistance": 100,
|
||||
"springConstant": 0.05,
|
||||
"springLength": 200
|
||||
},
|
||||
"solver": "repulsion",
|
||||
"stabilization": {
|
||||
"enabled": true,
|
||||
"fit": true,
|
||||
"iterations": 1000,
|
||||
"onlyDynamicEdges": false,
|
||||
"updateInterval": 50
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// if this network requires displaying the configure window,
|
||||
// put it in its div
|
||||
options.configure["container"] = document.getElementById("config");
|
||||
|
||||
|
||||
network = new vis.Network(container, data, options);
|
||||
|
||||
|
||||
network.on("click", neighbourhoodHighlight);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
network.on("stabilizationProgress", function(params) {
|
||||
document.getElementById('loadingBar').removeAttribute("style");
|
||||
var maxWidth = 496;
|
||||
var minWidth = 20;
|
||||
var widthFactor = params.iterations/params.total;
|
||||
var width = Math.max(minWidth,maxWidth * widthFactor);
|
||||
document.getElementById('bar').style.width = width + 'px';
|
||||
document.getElementById('text').innerHTML = Math.round(widthFactor*100) + '%';
|
||||
});
|
||||
network.once("stabilizationIterationsDone", function() {
|
||||
document.getElementById('text').innerHTML = '100%';
|
||||
document.getElementById('bar').style.width = '496px';
|
||||
document.getElementById('loadingBar').style.opacity = 0;
|
||||
// really clean the dom element
|
||||
setTimeout(function () {document.getElementById('loadingBar').style.display = 'none';}, 500);
|
||||
});
|
||||
|
||||
|
||||
return network;
|
||||
|
||||
}
|
||||
drawGraph();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,13 +1,14 @@
|
||||
"""Content of home page."""
|
||||
import dash
|
||||
from dash import html
|
||||
import pandas as pd
|
||||
import networkx as nx
|
||||
import pandas as pd
|
||||
import plotly.graph_objects as go
|
||||
from dash import Dash, Input, Output, dcc, html, callback, dash_table
|
||||
from aki_prj23_transparenzregister.config.config_providers import JsonFileConfigProvider
|
||||
from aki_prj23_transparenzregister.utils.sql import connector, entities
|
||||
from aki_prj23_transparenzregister.utils.networkx.networkx_data import find_top_companies, find_all_company_relations
|
||||
from dash import Input, Output, callback, html
|
||||
|
||||
from aki_prj23_transparenzregister.utils.networkx.networkx_data import (
|
||||
find_all_company_relations,
|
||||
find_top_companies,
|
||||
)
|
||||
|
||||
dash.register_page(
|
||||
__name__,
|
||||
@@ -21,10 +22,11 @@ dash.register_page(
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
# Plotly figure
|
||||
def networkGraph(EGDE_VAR: None) -> go.Figure:
|
||||
# find_all_company_relations()
|
||||
|
||||
|
||||
edges = []
|
||||
for index, row in find_all_company_relations().iterrows():
|
||||
edges.append([row["company_name"], row["connected_company_name"]])
|
||||
@@ -92,12 +94,11 @@ def networkGraph(EGDE_VAR: None) -> go.Figure:
|
||||
"mirror": True,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
print(nx.eigenvector_centrality(network_graph))
|
||||
measure_vector = {}
|
||||
network_metrics_df = pd.DataFrame()
|
||||
|
||||
|
||||
measure_vector = nx.eigenvector_centrality(network_graph)
|
||||
network_metrics_df["eigenvector"] = measure_vector.values()
|
||||
|
||||
@@ -120,31 +121,43 @@ def networkGraph(EGDE_VAR: None) -> go.Figure:
|
||||
# figure
|
||||
return go.Figure(data=[edge_trace, node_trace], layout=layout)
|
||||
|
||||
|
||||
df = find_top_companies()
|
||||
with open("src/aki_prj23_transparenzregister/ui/assets/network_graph.html") as file:
|
||||
html_content = file.read()
|
||||
|
||||
|
||||
layout = html.Div(
|
||||
|
||||
children = html.Div(
|
||||
children=[
|
||||
html.Div(
|
||||
className="top_companytable_style",
|
||||
children=[
|
||||
html.Title(title="Top Ten Unternehmen", style={"align": "mid"}),
|
||||
dash_table.DataTable(df.to_dict('records'), [{"name": i, "id": i} for i in df.columns])
|
||||
]
|
||||
),
|
||||
html.Div(
|
||||
className="networkx_style",
|
||||
children=[
|
||||
html.Header(title="Social Graph"),
|
||||
dcc.Dropdown(['eigenvector', 'degree', 'betweeness', 'closeness'], 'eigenvector', id='demo-dropdown'),
|
||||
"Text",
|
||||
dcc.Input(id="EGDE_VAR", type="text", value="K", debounce=True),
|
||||
# dcc.Dropdown(['eigenvector', 'degree', 'betweeness', 'closeness'], 'eigenvector', id='metric-dropdown'),
|
||||
dcc.Graph(id="my-graph"),
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
children=[
|
||||
# NOTE lib dir created by NetworkX has to be placed in assets
|
||||
html.Iframe(
|
||||
src="assets/network_graph.html",
|
||||
style={"height": "100vh", "width": "100vw"},
|
||||
allow="*",
|
||||
)
|
||||
]
|
||||
# children = html.Div(
|
||||
# children=[
|
||||
# html.Div(
|
||||
# className="top_companytable_style",
|
||||
# children=[
|
||||
# html.Title(title="Top Ten Unternehmen", style={"align": "mid"}),
|
||||
# dash_table.DataTable(df.to_dict('records'), [{"name": i, "id": i} for i in df.columns])
|
||||
# ]
|
||||
# ),
|
||||
# html.Div(
|
||||
# className="networkx_style",
|
||||
# children=[
|
||||
# html.Header(title="Social Graph"),
|
||||
# dcc.Dropdown(['eigenvector', 'degree', 'betweeness', 'closeness'], 'eigenvector', id='demo-dropdown'),
|
||||
# "Text",
|
||||
# dcc.Input(id="EGDE_VAR", type="text", value="K", debounce=True),
|
||||
# # dcc.Dropdown(['eigenvector', 'degree', 'betweeness', 'closeness'], 'eigenvector', id='metric-dropdown'),
|
||||
# dcc.Graph(id="my-graph"),
|
||||
# ]
|
||||
# )
|
||||
# ]
|
||||
# )
|
||||
)
|
||||
|
||||
|
||||
@@ -155,4 +168,4 @@ layout = html.Div(
|
||||
)
|
||||
def update_output(EGDE_VAR: None) -> None:
|
||||
find_top_companies()
|
||||
return networkGraph(EGDE_VAR)
|
||||
return networkGraph(EGDE_VAR)
|
||||
@@ -0,0 +1,645 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from aki_prj23_transparenzregister.utils.sql import connector, entities\n",
|
||||
"from aki_prj23_transparenzregister.config.config_providers import JsonFileConfigProvider\n",
|
||||
"import pandas as pd"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\u001b[32m2023-09-30 13:33:34.846\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36maki_prj23_transparenzregister.utils.sql.connector\u001b[0m:\u001b[36mget_session\u001b[0m:\u001b[36m64\u001b[0m - \u001b[34m\u001b[1mConnection definition: Postgre configuration: username: postgres, password d7fd8b09788c6787d4d0aa9e549e467d, host 172.17.38.210:30432, database db_tim., Mongo configuration: username: aki_transparenzregister, password ZOh0f2KFtJXjTgBD, host stagingdbtransparenzreg.ioappzs.mongodb.net/:None, database transparenzregister.\u001b[0m\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"session = connector.get_session(JsonFileConfigProvider(\"../../../../secrets.json\"))\n",
|
||||
"query_companies = session.query(entities.Company) # .all()\n",
|
||||
"query_relations = session.query(entities.CompanyRelation) # .all()\n",
|
||||
"\n",
|
||||
"companies_df: pd.DataFrame = pd.read_sql(str(query_companies), session.bind) # type: ignore\n",
|
||||
"companies_relations_df: pd.DataFrame = pd.read_sql(str(query_relations), session.bind) # type: ignore"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<style scoped>\n",
|
||||
" .dataframe tbody tr th:only-of-type {\n",
|
||||
" vertical-align: middle;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe tbody tr th {\n",
|
||||
" vertical-align: top;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe thead th {\n",
|
||||
" text-align: right;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
" <th></th>\n",
|
||||
" <th>company_id</th>\n",
|
||||
" <th>company_hr</th>\n",
|
||||
" <th>company_court_id</th>\n",
|
||||
" <th>company_name</th>\n",
|
||||
" <th>company_street</th>\n",
|
||||
" <th>company_zip_code</th>\n",
|
||||
" <th>company_city</th>\n",
|
||||
" <th>company_last_update</th>\n",
|
||||
" <th>company_sector</th>\n",
|
||||
" </tr>\n",
|
||||
" </thead>\n",
|
||||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>1</td>\n",
|
||||
" <td>HRB 148048</td>\n",
|
||||
" <td>1</td>\n",
|
||||
" <td>0 10 24 Telefondienste GmbH</td>\n",
|
||||
" <td>Deelbögenkamp</td>\n",
|
||||
" <td>22297</td>\n",
|
||||
" <td>Hamburg</td>\n",
|
||||
" <td>2020-05-11</td>\n",
|
||||
" <td>None</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>1</th>\n",
|
||||
" <td>2</td>\n",
|
||||
" <td>HRA 301114</td>\n",
|
||||
" <td>2</td>\n",
|
||||
" <td>1. Staiger Grundstücksverwaltung GmbH & Co. KG</td>\n",
|
||||
" <td>Johannes-Bieg-Str.8</td>\n",
|
||||
" <td>74391</td>\n",
|
||||
" <td>Erligheim</td>\n",
|
||||
" <td>2020-05-04</td>\n",
|
||||
" <td>None</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2</th>\n",
|
||||
" <td>3</td>\n",
|
||||
" <td>HRA 720015</td>\n",
|
||||
" <td>3</td>\n",
|
||||
" <td>1 A Autenrieth Kunststofftechnik GmbH & Co. KG</td>\n",
|
||||
" <td>Gewerbestraße</td>\n",
|
||||
" <td>72535</td>\n",
|
||||
" <td>Heroldstatt</td>\n",
|
||||
" <td>2016-08-23</td>\n",
|
||||
" <td>None</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3</th>\n",
|
||||
" <td>4</td>\n",
|
||||
" <td>HRB 97262</td>\n",
|
||||
" <td>1</td>\n",
|
||||
" <td>01050.com GmbH</td>\n",
|
||||
" <td>Deelbögenkamp</td>\n",
|
||||
" <td>22297</td>\n",
|
||||
" <td>Hamburg</td>\n",
|
||||
" <td>2020-05-13</td>\n",
|
||||
" <td>None</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>4</th>\n",
|
||||
" <td>5</td>\n",
|
||||
" <td>HRA 17617</td>\n",
|
||||
" <td>4</td>\n",
|
||||
" <td>2. Schaper Objekt GmbH & Co. Kiel KG</td>\n",
|
||||
" <td>Metro-Straße</td>\n",
|
||||
" <td>40235</td>\n",
|
||||
" <td>Düsseldorf</td>\n",
|
||||
" <td>2021-05-27</td>\n",
|
||||
" <td>None</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>...</th>\n",
|
||||
" <td>...</td>\n",
|
||||
" <td>...</td>\n",
|
||||
" <td>...</td>\n",
|
||||
" <td>...</td>\n",
|
||||
" <td>...</td>\n",
|
||||
" <td>...</td>\n",
|
||||
" <td>...</td>\n",
|
||||
" <td>...</td>\n",
|
||||
" <td>...</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3142</th>\n",
|
||||
" <td>3143</td>\n",
|
||||
" <td>HRB 13874</td>\n",
|
||||
" <td>58</td>\n",
|
||||
" <td>WINGAS Holding GmbH</td>\n",
|
||||
" <td>Königstor</td>\n",
|
||||
" <td>34117</td>\n",
|
||||
" <td>Kassel</td>\n",
|
||||
" <td>2023-03-28</td>\n",
|
||||
" <td>None</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3143</th>\n",
|
||||
" <td>3144</td>\n",
|
||||
" <td>HRB 71591</td>\n",
|
||||
" <td>4</td>\n",
|
||||
" <td>WohnServicePlus GmbH</td>\n",
|
||||
" <td>Flughafenstraße</td>\n",
|
||||
" <td>40474</td>\n",
|
||||
" <td>Düsseldorf</td>\n",
|
||||
" <td>2022-03-29</td>\n",
|
||||
" <td>None</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3144</th>\n",
|
||||
" <td>3145</td>\n",
|
||||
" <td>HRB 5297</td>\n",
|
||||
" <td>102</td>\n",
|
||||
" <td>Wohnungsbaugesellschaft mit beschränkter Haftu...</td>\n",
|
||||
" <td>Taubenstraße</td>\n",
|
||||
" <td>47443</td>\n",
|
||||
" <td>Moers</td>\n",
|
||||
" <td>2022-02-16</td>\n",
|
||||
" <td>None</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3145</th>\n",
|
||||
" <td>3146</td>\n",
|
||||
" <td>HRA 48546 B</td>\n",
|
||||
" <td>12</td>\n",
|
||||
" <td>Zalando Customer Care International SE & Co. KG</td>\n",
|
||||
" <td>Mühlenstraße</td>\n",
|
||||
" <td>10243</td>\n",
|
||||
" <td>Berlin</td>\n",
|
||||
" <td>2021-11-26</td>\n",
|
||||
" <td>None</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3146</th>\n",
|
||||
" <td>3147</td>\n",
|
||||
" <td>HRB 382018</td>\n",
|
||||
" <td>9</td>\n",
|
||||
" <td>zebotec GmbH</td>\n",
|
||||
" <td>August-Borsig-Straße</td>\n",
|
||||
" <td>78467</td>\n",
|
||||
" <td>Konstanz</td>\n",
|
||||
" <td>2021-12-15</td>\n",
|
||||
" <td>None</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"<p>3147 rows × 9 columns</p>\n",
|
||||
"</div>"
|
||||
],
|
||||
"text/plain": [
|
||||
" company_id company_hr company_court_id \\\n",
|
||||
"0 1 HRB 148048 1 \n",
|
||||
"1 2 HRA 301114 2 \n",
|
||||
"2 3 HRA 720015 3 \n",
|
||||
"3 4 HRB 97262 1 \n",
|
||||
"4 5 HRA 17617 4 \n",
|
||||
"... ... ... ... \n",
|
||||
"3142 3143 HRB 13874 58 \n",
|
||||
"3143 3144 HRB 71591 4 \n",
|
||||
"3144 3145 HRB 5297 102 \n",
|
||||
"3145 3146 HRA 48546 B 12 \n",
|
||||
"3146 3147 HRB 382018 9 \n",
|
||||
"\n",
|
||||
" company_name company_street \\\n",
|
||||
"0 0 10 24 Telefondienste GmbH Deelbögenkamp \n",
|
||||
"1 1. Staiger Grundstücksverwaltung GmbH & Co. KG Johannes-Bieg-Str.8 \n",
|
||||
"2 1 A Autenrieth Kunststofftechnik GmbH & Co. KG Gewerbestraße \n",
|
||||
"3 01050.com GmbH Deelbögenkamp \n",
|
||||
"4 2. Schaper Objekt GmbH & Co. Kiel KG Metro-Straße \n",
|
||||
"... ... ... \n",
|
||||
"3142 WINGAS Holding GmbH Königstor \n",
|
||||
"3143 WohnServicePlus GmbH Flughafenstraße \n",
|
||||
"3144 Wohnungsbaugesellschaft mit beschränkter Haftu... Taubenstraße \n",
|
||||
"3145 Zalando Customer Care International SE & Co. KG Mühlenstraße \n",
|
||||
"3146 zebotec GmbH August-Borsig-Straße \n",
|
||||
"\n",
|
||||
" company_zip_code company_city company_last_update company_sector \n",
|
||||
"0 22297 Hamburg 2020-05-11 None \n",
|
||||
"1 74391 Erligheim 2020-05-04 None \n",
|
||||
"2 72535 Heroldstatt 2016-08-23 None \n",
|
||||
"3 22297 Hamburg 2020-05-13 None \n",
|
||||
"4 40235 Düsseldorf 2021-05-27 None \n",
|
||||
"... ... ... ... ... \n",
|
||||
"3142 34117 Kassel 2023-03-28 None \n",
|
||||
"3143 40474 Düsseldorf 2022-03-29 None \n",
|
||||
"3144 47443 Moers 2022-02-16 None \n",
|
||||
"3145 10243 Berlin 2021-11-26 None \n",
|
||||
"3146 78467 Konstanz 2021-12-15 None \n",
|
||||
"\n",
|
||||
"[3147 rows x 9 columns]"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"companies_df"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def to_dict(data: object):\n",
|
||||
" return data.__dict__"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"{'company_1': {'label': '0 10 24 Telefondienste GmbH', 'type': 'Company', 'shape': 'dot', 'color': '#729b79ff'}, 'person_1': {'label': 'Tetau, Nicolas', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_2': {'label': 'Dammast, Lutz', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'company_2': {'label': '1. Staiger Grundstücksverwaltung GmbH & Co. KG', 'type': 'Company', 'shape': 'dot', 'color': '#729b79ff'}, 'person_3': {'label': 'Tutsch, Rosemarie', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_4': {'label': 'Staiger, Marc', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_5': {'label': 'Staiger, Michaela', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_6': {'label': 'Staiger, Margarete', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_7': {'label': 'Staiger, Bruno', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_8': {'label': 'Hofmann, Nicole', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'company_3': {'label': '1 A Autenrieth Kunststofftechnik GmbH & Co. KG', 'type': 'Company', 'shape': 'dot', 'color': '#729b79ff'}, 'person_9': {'label': 'Autenrieth, Steffen', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_10': {'label': 'Bischoff, Stefanie', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'company_4': {'label': '01050.com GmbH', 'type': 'Company', 'shape': 'dot', 'color': '#729b79ff'}, 'company_5': {'label': '2. Schaper Objekt GmbH & Co. Kiel KG', 'type': 'Company', 'shape': 'dot', 'color': '#729b79ff'}, 'company_2213': {'label': 'Multi-Center Warenvertriebs GmbH', 'type': 'Company', 'shape': 'dot', 'color': '#729b79ff'}, 'company_6': {'label': 'AASP Filmproduktionsgesellschaft mbH & Co. Leonie KG', 'type': 'Company', 'shape': 'dot', 'color': '#729b79ff'}, 'person_11': {'label': 'Achilles, Christel', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_12': {'label': 'Ackermann, Wilhelm', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_13': {'label': 'Ahrens, Harald', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_14': {'label': 'Al Sibai, Mohamed Maged', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_15': {'label': 'Al-Bazaz, Salim', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_16': {'label': 'Attawar, Marina', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_17': {'label': 'Babic-Pavicic, Ankica', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_18': {'label': 'Bak, Ingo', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_19': {'label': 'Becker, Christoph', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_20': {'label': 'Becker, Olaf', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_21': {'label': 'Berg, Rainer', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_22': {'label': 'Berkhout, Pieter', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_23': {'label': 'Berns, Bernhard', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_24': {'label': 'Betz, Franz-Hartwig', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_25': {'label': 'Birken, Claus', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_26': {'label': 'Blessing, Helmut', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_27': {'label': 'Bohnet, Heinz G.', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_28': {'label': 'Boldt, Peter', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_29': {'label': 'Bone-Winkel, Thomas', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_30': {'label': 'Bongartz, Wolfgang', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_31': {'label': 'Bongartz, Heinz', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_32': {'label': 'Brasse, Hans-Dieter', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_33': {'label': 'Breman, Frank', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_34': {'label': 'Bremer, Harald C. H.', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_35': {'label': 'Bruns, Franz-Josef', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_36': {'label': 'Busch jun., Norbert', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_37': {'label': 'Butter, Georg', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_38': {'label': 'Butz-Scharf, Kerstin', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_39': {'label': 'Bös, Michael', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_40': {'label': 'Canis, Volker', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_41': {'label': 'Comberg, Alfred', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_42': {'label': 'de las Heras, Günther', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_43': {'label': 'Delkeskamp, Claus', 'type': 'Person', 'shape': 'dot', 'color': 'blue'}, 'person_44': {'label': 'Delkeskamp, Stefan', 'type': 'PersLine truncated
|
||||
"[{'from': 'person_1', 'to': 'company_1', 'label': 'Geschäftsführer'}, {'from': 'person_2', 'to': 'company_1', 'label': 'Prokurist'}, {'from': 'person_3', 'to': 'company_2', 'label': 'Kommanditist'}, {'from': 'person_4', 'to': 'company_2', 'label': 'Kommanditist'}, {'from': 'person_5', 'to': 'company_2', 'label': 'Kommanditist'}, {'from': 'person_6', 'to': 'company_2', 'label': 'Kommanditist'}, {'from': 'person_7', 'to': 'company_2', 'label': 'Kommanditist'}, {'from': 'person_8', 'to': 'company_2', 'label': 'Kommanditist'}, {'from': 'person_9', 'to': 'company_3', 'label': 'Kommanditist'}, {'from': 'person_10', 'to': 'company_3', 'label': 'Prokurist'}, {'from': 'person_1', 'to': 'company_4', 'label': 'Geschäftsführer'}, {'from': 'person_2', 'to': 'company_4', 'label': 'Prokurist'}, {'from': 'company_2213', 'to': 'company_5', 'label': 'Organisation'}, {'from': 'person_11', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_12', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_13', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_14', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_15', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_16', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_17', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_18', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_19', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_20', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_21', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_22', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_23', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_24', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_25', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_26', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_27', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_28', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_29', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_30', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_31', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_32', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_33', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_34', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_35', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_36', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_37', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_38', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_39', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_40', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_41', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_42', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_43', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_44', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_45', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_46', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_47', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_48', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_49', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_50', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_51', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_52', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_53', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_54', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_55', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_56', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_57', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_58', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_59', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_60', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_61', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_62', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_63', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_64', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_65', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_66', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_67', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_68', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_69', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_70', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_71', 'to': 'company_6', 'label': 'Kommanditist'}, {'from': 'person_72', 'to': 'company_6',Line truncated
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<style scoped>\n",
|
||||
" .dataframe tbody tr th:only-of-type {\n",
|
||||
" vertical-align: middle;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe tbody tr th {\n",
|
||||
" vertical-align: top;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe thead th {\n",
|
||||
" text-align: right;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
" <th></th>\n",
|
||||
" <th>index</th>\n",
|
||||
" <th>label</th>\n",
|
||||
" <th>type</th>\n",
|
||||
" <th>shape</th>\n",
|
||||
" <th>color</th>\n",
|
||||
" </tr>\n",
|
||||
" </thead>\n",
|
||||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>company_1</td>\n",
|
||||
" <td>0 10 24 Telefondienste GmbH</td>\n",
|
||||
" <td>Company</td>\n",
|
||||
" <td>dot</td>\n",
|
||||
" <td>#729b79ff</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>1</th>\n",
|
||||
" <td>person_1</td>\n",
|
||||
" <td>Tetau, Nicolas</td>\n",
|
||||
" <td>Person</td>\n",
|
||||
" <td>dot</td>\n",
|
||||
" <td>blue</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2</th>\n",
|
||||
" <td>person_2</td>\n",
|
||||
" <td>Dammast, Lutz</td>\n",
|
||||
" <td>Person</td>\n",
|
||||
" <td>dot</td>\n",
|
||||
" <td>blue</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3</th>\n",
|
||||
" <td>company_2</td>\n",
|
||||
" <td>1. Staiger Grundstücksverwaltung GmbH & Co. KG</td>\n",
|
||||
" <td>Company</td>\n",
|
||||
" <td>dot</td>\n",
|
||||
" <td>#729b79ff</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>4</th>\n",
|
||||
" <td>person_3</td>\n",
|
||||
" <td>Tutsch, Rosemarie</td>\n",
|
||||
" <td>Person</td>\n",
|
||||
" <td>dot</td>\n",
|
||||
" <td>blue</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>"
|
||||
],
|
||||
"text/plain": [
|
||||
" index label type shape \\\n",
|
||||
"0 company_1 0 10 24 Telefondienste GmbH Company dot \n",
|
||||
"1 person_1 Tetau, Nicolas Person dot \n",
|
||||
"2 person_2 Dammast, Lutz Person dot \n",
|
||||
"3 company_2 1. Staiger Grundstücksverwaltung GmbH & Co. KG Company dot \n",
|
||||
"4 person_3 Tutsch, Rosemarie Person dot \n",
|
||||
"\n",
|
||||
" color \n",
|
||||
"0 #729b79ff \n",
|
||||
"1 blue \n",
|
||||
"2 blue \n",
|
||||
"3 #729b79ff \n",
|
||||
"4 blue "
|
||||
]
|
||||
},
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from aki_prj23_transparenzregister.utils.enum_types import RelationTypeEnum\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def get_data():\n",
|
||||
" nodes = {}\n",
|
||||
" edges = []\n",
|
||||
" network_data = []\n",
|
||||
" edge_template = {\n",
|
||||
" \"from\": {\n",
|
||||
" \"name\": \"Hans Wurst\",\n",
|
||||
" \"type\": \"Person\",\n",
|
||||
" },\n",
|
||||
" \"to\": {\"name\": \"Atos :D\", \"type\": \"Company\"},\n",
|
||||
" \"type\": \"Vorstand\",\n",
|
||||
" }\n",
|
||||
" node_template = {\n",
|
||||
" \"id\": \"(company|person)_\\d\",\n",
|
||||
" \"label\": \"Name from entries\",\n",
|
||||
" \"type\": \"Company|Person\",\n",
|
||||
" \"shape\": \"dot\",\n",
|
||||
" \"color\": \"#729b79ff\",\n",
|
||||
" # TODO add title for hover effect in graph \"title\": \"\"\n",
|
||||
" }\n",
|
||||
" data = session.query(entities.Relation).all()\n",
|
||||
" for entry in data[:1000]:\n",
|
||||
" company = (\n",
|
||||
" session.query(entities.Company)\n",
|
||||
" .filter(entities.Company.id == entry.company_id)\n",
|
||||
" .first()\n",
|
||||
" )\n",
|
||||
" if (\"company_\" + str(company.id)) not in nodes:\n",
|
||||
" nodes[\"company_\" + str(company.id)] = {\n",
|
||||
" \"label\": company.name,\n",
|
||||
" \"type\": \"Company\",\n",
|
||||
" \"shape\": \"dot\",\n",
|
||||
" \"color\": \"#729b79ff\",\n",
|
||||
" }\n",
|
||||
" person_relations = (\n",
|
||||
" session.query(entities.PersonRelation)\n",
|
||||
" .filter(entities.PersonRelation.id == entry.id)\n",
|
||||
" .all()\n",
|
||||
" )\n",
|
||||
" for relation in person_relations:\n",
|
||||
" person = (\n",
|
||||
" session.query(entities.Person)\n",
|
||||
" .filter(entities.Person.id == relation.person_id)\n",
|
||||
" .first()\n",
|
||||
" )\n",
|
||||
" if (\"person_\" + str(person.id)) not in nodes:\n",
|
||||
" nodes[\"person_\" + str(person.id)] = {\n",
|
||||
" \"label\": f\"{person.surname}, {person.name}\",\n",
|
||||
" \"type\": \"Person\",\n",
|
||||
" \"shape\": \"dot\",\n",
|
||||
" \"color\": \"blue\",\n",
|
||||
" }\n",
|
||||
" edges.append(\n",
|
||||
" {\n",
|
||||
" \"from\": \"person_\" + str(person.id),\n",
|
||||
" \"to\": \"company_\" + str(company.id),\n",
|
||||
" # \"label\": int(entry.relation)\n",
|
||||
" \"label\": RelationTypeEnum.get_string_from_enum(entry.relation),\n",
|
||||
" }\n",
|
||||
" )\n",
|
||||
" company_relations = (\n",
|
||||
" session.query(entities.CompanyRelation)\n",
|
||||
" .filter(entities.CompanyRelation.id == entry.id)\n",
|
||||
" .all()\n",
|
||||
" )\n",
|
||||
" for relation in company_relations:\n",
|
||||
" company_2 = (\n",
|
||||
" session.query(entities.Company)\n",
|
||||
" .filter(entities.Company.id == relation.company2_id)\n",
|
||||
" .first()\n",
|
||||
" )\n",
|
||||
" if (\"company_\" + str(company_2.id)) not in nodes:\n",
|
||||
" nodes[\"company_\" + str(company_2.id)] = {\n",
|
||||
" \"label\": company_2.name,\n",
|
||||
" \"type\": \"Company\",\n",
|
||||
" \"shape\": \"dot\",\n",
|
||||
" \"color\": \"#729b79ff\",\n",
|
||||
" }\n",
|
||||
" edges.append(\n",
|
||||
" {\n",
|
||||
" \"from\": \"company_\" + str(company_2.id),\n",
|
||||
" \"to\": \"company_\" + str(company.id),\n",
|
||||
" \"label\": RelationTypeEnum.get_string_from_enum(entry.relation),\n",
|
||||
" }\n",
|
||||
" )\n",
|
||||
" return pd.DataFrame.from_dict(nodes, orient=\"index\").reset_index(), pd.DataFrame(\n",
|
||||
" edges\n",
|
||||
" )\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"nodes, edges = get_data()\n",
|
||||
"nodes.head()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<style scoped>\n",
|
||||
" .dataframe tbody tr th:only-of-type {\n",
|
||||
" vertical-align: middle;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe tbody tr th {\n",
|
||||
" vertical-align: top;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe thead th {\n",
|
||||
" text-align: right;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
" <th></th>\n",
|
||||
" <th>from</th>\n",
|
||||
" <th>to</th>\n",
|
||||
" <th>label</th>\n",
|
||||
" </tr>\n",
|
||||
" </thead>\n",
|
||||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>person_1</td>\n",
|
||||
" <td>company_1</td>\n",
|
||||
" <td>Geschäftsführer</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>1</th>\n",
|
||||
" <td>person_2</td>\n",
|
||||
" <td>company_1</td>\n",
|
||||
" <td>Prokurist</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2</th>\n",
|
||||
" <td>person_3</td>\n",
|
||||
" <td>company_2</td>\n",
|
||||
" <td>Kommanditist</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3</th>\n",
|
||||
" <td>person_4</td>\n",
|
||||
" <td>company_2</td>\n",
|
||||
" <td>Kommanditist</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>4</th>\n",
|
||||
" <td>person_5</td>\n",
|
||||
" <td>company_2</td>\n",
|
||||
" <td>Kommanditist</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>"
|
||||
],
|
||||
"text/plain": [
|
||||
" from to label\n",
|
||||
"0 person_1 company_1 Geschäftsführer\n",
|
||||
"1 person_2 company_1 Prokurist\n",
|
||||
"2 person_3 company_2 Kommanditist\n",
|
||||
"3 person_4 company_2 Kommanditist\n",
|
||||
"4 person_5 company_2 Kommanditist"
|
||||
]
|
||||
},
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"edges.head()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA+AAAAPbCAYAAADcmuETAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA2EElEQVR4nO3de5TXdZ348dcAMoNyU4Hh0ijh/QoGSmiuazs2nTwY20VWO4AsZiaaOscUvDAqq7ClHipRjmSLu5tBtuq6wcFsksqEUJDSI+AqKZx+DYolQ2jc5vP7o3Vq4iJfYF6APh7nfM/x+573+/t5fzkfkCef76WsKIoiAAAAgFbVZm9vAAAAAD4IBDgAAAAkEOAAAACQQIADAABAAgEOAAAACQQ4AAAAJBDgAAAAkECAAwAAQAIBDgAAAAkEOADsg/7+7/8+rrrqqr1y7IsuuiiGDRu2V44NAO9nAhwA/kZDQ0NceeWVceSRR0ZFRUVUVlbGGWecEffee2+8/fbbe3t7u2369OnRv3//6NixY3Tt2jVOOeWUmDRp0t7eFgC877Xb2xsAgH3JihUr4owzzoiuXbvG7bffHieddFKUl5fH888/H/fdd1/06dMnzjvvvG2u3bRpUxxwwAHJOy7Nd77znbjqqqvim9/8Zpx11lmxYcOG+PWvfx0vvPDC3t4aALzvuQIOAH/lsssui3bt2sWzzz4b559/fhx33HHRr1+/+PSnPx2zZ8+OoUOHNs8tKyuLe++9N84777w46KCD4rbbbostW7bEmDFj4sMf/nB06NAhjjnmmPjGN77R4hjvvsT7lltuie7du0fnzp3j0ksvjY0bN7aY19TUFNdee20ccsgh0bNnz7j55pt3+/k99thjcf7558eYMWPiyCOPjBNOOCEuuOCCuO2227aae8cdd0SvXr3i0EMPjbFjx8amTZuaf/Yf//EfMWjQoOjUqVP07NkzLrzwwnj99debfz5v3rwoKyuL2bNnx8knnxwVFRXx0Y9+dKvQf+qpp+LMM8+MDh06RFVVVXzlK1+J9evXN//8nnvuiaOOOqr5lQif+9zndvvXAAD2FgEOAP/nzTffjB/96EcxduzYOOigg7Y5p6ysrMX9m2++Of7xH/8xnn/++fjnf/7naGpqig996EPx0EMPxYsvvhgTJkyI66+/Pr7//e+3WFdfXx9Lly6NefPmxfe+9714+OGH45Zbbmkx54EHHoiDDjoofvnLX8bXvva1uPXWW+OJJ57YrefYs2fPWLBgQbz22ms7nPfkk0/GK6+8Ek8++WQ88MADMWPGjJgxY0bzzzdt2hQTJ06MX/3qV/Hoo4/Gq6++GhdddNFWj/PVr3417rzzznjmmWeie/fuMXTo0OaQf+WVV+KTn/xkfPazn41f//rXMWvWrHjqqafi8ssvj4iIZ599Nr7yla/ErbfeGsuXL4+5c+fG3/3d3+3W8weAvaoAAIqiKIoFCxYUEVE8/PDDLcYPPfTQ4qCDDioOOuig4tprr20ej4jiqquues/HHTt2bPHZz362+f6oUaOKQw45pFi/fn3z2L333lt07Nix2LJlS1EURXHWWWcVH/vYx1o8zqmnnlpcd911u/Tc3vX//t//Kz760Y8WEVEcffTRxahRo4pZs2Y1H/fd/R1++OHF5s2bm8c+//nPF8OHD9/u4z7zzDNFRBTr1q0riqIonnzyySIiipkzZzbPefPNN4sOHToUs2bNKoqiKMaMGVNccsklLR7n5z//edGmTZvinXfeKf7rv/6r6Ny5c9HY2LhbzxkA9hWugAPAe1i4cGEsWbIkTjjhhNiwYUOLnw0aNGir+VOnTo2BAwdG9+7do2PHjnHffffFypUrW8zp379/HHjggc33hwwZEn/84x9j1apVzWMnn3xyizW9evVq8TLvv/bzn/88Onbs2Hz77ne/u815vXr1ivnz58fzzz8fV155ZWzevDlGjRoVn/zkJ6Opqal53gknnBBt27bd7rEXLVoUQ4cOjcMOOyw6deoUZ511VkTEVs9zyJAhzf99yCGHxDHHHBNLly6NiIhf/epXMWPGjBb7rqmpiaampvjNb34T55xzThx++OHRr1+/GDFiRHz3u999X3wIHgAfXD6EDQD+z5FHHhllZWWxfPnyFuP9+vWLiIgOHTpsteZvX6o+c+bMuOaaa+LOO++MIUOGRKdOneLrX/96/PKXvyx5P3/7gW5lZWUtIvmvDRo0KJYsWdJ8v7KycoePfeKJJ8aJJ54Yl112WVx66aVx5plnxk9/+tM4++yz3/PY69evj5qamqipqYnvfve70b1791i5cmXU1NRs9T72HfnjH/8YX/rSl+IrX/nKVj877LDDon379rF48eKYN29e/OhHP4oJEybEzTffHM8880x07dp1p48DAPsKAQ4A/+fQQw+Nc845J+6+++644oortvs+8B35xS9+EaeffnpcdtllzWOvvPLKVvN+9atfxTvvvNMc9QsWLIiOHTtGVVXVLu29Q4cOceSRR+7S2uOPPz4iosWHn+3IsmXL4s0334zJkyc37/fZZ5/d5twFCxbEYYcdFhERf/jDH+Kll16K4447LiIiPvKRj8SLL764w323a9cuqquro7q6Ourq6qJr167xk5/8JD7zmc/s9PMDgH2Fl6ADwF+55557YvPmzTFo0KCYNWtWLF26NJYvXx7/+Z//GcuWLWvxsuxtOeqoo+LZZ5+Nxx9/PF566aW46aab4plnntlq3saNG2PMmDHx4osvxpw5c6Kuri4uv/zyaNOmdf/X/OUvfzkmTpwYv/jFL+K1116LBQsWxMiRI6N79+4tXi6+I+9enf7Wt74VK1asiMceeywmTpy4zbm33npr1NfXxwsvvBAXXXRRdOvWLYYNGxYREdddd108/fTTcfnll8eSJUvif//3f+O///u/mz+E7Yc//GF885vfjCVLlsRrr70W//7v/x5NTU1xzDHH7JFfCwDIJsAB4K8cccQR8dxzz0V1dXWMHz8++vfvH4MGDYpvfetbcc0112w3NN/1pS99KT7zmc/E8OHDY/DgwfHmm2+2uBr+rn/4h3+Io446Kv7u7/4uhg8fHuedd94e+Zqx91JdXR0LFiyIz3/+83H00UfHZz/72aioqIj6+vo49NBDd+oxunfvHjNmzIiHHnoojj/++Jg8eXLccccd25w7efLkuPLKK2PgwIHR0NAQ//M//xPt27ePiD+/x/2nP/1pvPTSS3HmmWfGKaecEhMmTIjevXtHRETXrl3j4Ycfjo9//ONx3HHHxbRp0+J73/tenHDCCXvmFwMAkpUVRVHs7U0AwAfJRRddFG+99VY8+uije3srrWbevHlx9tlnxx/+8Afv1waA/+MKOAAAACQQ4AAAAJDAS9ABAAAgQclXwH/2s5/F0KFDo3fv3lFWVrZT71+bN29efOQjH4ny8vI48sgjY8aMGbuwVQAAANh/lRzg69evj/79+8fUqVN3av5vfvObOPfcc+Pss8+OJUuWxFVXXRUXX3xxPP744yVvFgAAAPZXu/US9LKysnjkkUeav89zW6677rqYPXt2vPDCC81j//RP/xRvvfVWzJ07d1cPDQAAAPuVdq19gPnz50d1dXWLsZqamrjqqqu2u2bDhg2xYcOG5vtNTU3x+9//Pg499NAoKytrra0CAABAREQURRHr1q2L3r17R5s2e+bzy1s9wBsaGqKysrLFWGVlZTQ2NsY777wTHTp02GrNpEmT4pZbbmntrQEAAMAOrVq1Kj70oQ/tkcdq9QDfFePHj4/a2trm+2vXro3DDjssVq1aFZ07d96LOwMAAOCDoLGxMaqqqqJTp0577DFbPcB79uwZq1evbjG2evXq6Ny58zavfkdElJeXR3l5+VbjnTt3FuAAAACk2ZNvg94zL2TfgSFDhkR9fX2LsSeeeCKGDBnS2ocGAACAfUbJAf7HP/4xlixZEkuWLImIP3/N2JIlS2LlypUR8eeXj48cObJ5/qWXXhorVqyIa6+9NpYtWxb33HNPfP/734+rr756zzwDAAAA2A+UHODPPvtsnHLKKXHKKadERERtbW2ccsopMWHChIiI+N3vftcc4xERH/7wh2P27NnxxBNPRP/+/ePOO++Mb3/721FTU7OHngIAAADs+3bre8CzNDY2RpcuXWLt2rXeAw4AAECra40ObfX3gAMAAAACHAAAAFIIcAAAAEggwAEAACCBAAcAAIAEAhwAAAASCHAAAABIIMABAAAggQAHAACABAIcAAAAEghwAAAASCDAAQAAIIEABwAAgAQCHAAAABIIcAAAAEggwAEAACCBAAcAAIAEAhwAAAASCHAAAABIIMABAAAggQAHAACABAIcAAAAEghwAAAASCDAAQAAIIEABwAAgAQCHAAAABIIcAAAAEggwAEAACCBAAcAAIAEAhwAAAASCHAAAABIIMABAAAggQAHAACABAIcAAAAEghwAAAASCDAAQAAIIEABwAAgAQCHAAAABIIcAAAAEggwAEAACCBAAcAAIAEAhwAAAASCHAAAABIIMABAAAggQAHAACABAIcAAAAEghwAAAASCDAAQAAIIEABwAAgAQCHAAAABIIcAAAAEggwAEAACCBAAcAAIAEAhwAAAASCHAAAABIIMABAAAggQAHAACABAIcAAAAEghwAAAASCDAAQAAIIEABwAAgAQCHAAAABIIcAAAAEggwAEAACCBAAcAAIAEAhwAAAASCHAAAABIIMABAAAggQAHAACABAIcAAAAEghwAAAASCDAAQAAIIEABwAAgAQCHAAAABIIcAAAAEggwAEAACCBAAcAAIAEAhwAAAASCHAAAABIIMABAAAggQAHAACABAIcAAAAEghwAAAASCDAAQAAIIEABwAAgAQCHAAAABIIcAAAAEggwAEAACCBAAcAAIAEAhwAAAASCHAAAABIIMABAAAggQAHAACABAIcAAAAEghwAAALine truncated
|
||||
"text/plain": [
|
||||
"<Figure size 1200x1200 with 1 Axes>"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import networkx as nx\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"\n",
|
||||
"fig = plt.figure(figsize=(12, 12))\n",
|
||||
"ax = plt.subplot(111)\n",
|
||||
"ax.set_title(\"Graph - Shapes\", fontsize=10)\n",
|
||||
"\n",
|
||||
"# initiate graph\n",
|
||||
"graph = nx.MultiGraph()\n",
|
||||
"\n",
|
||||
"# create edges from dataframe\n",
|
||||
"graph = nx.from_pandas_edgelist(edges, source=\"from\", target=\"to\", edge_attr=\"label\")\n",
|
||||
"\n",
|
||||
"# update node attributes from dataframe\n",
|
||||
"nodes_attr = nodes.set_index(\"index\").to_dict(orient=\"index\")\n",
|
||||
"nx.set_node_attributes(graph, nodes_attr)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from pyvis.network import Network\n",
|
||||
"\n",
|
||||
"net = Network(\n",
|
||||
" directed=False, neighborhood_highlight=True, bgcolor=\"white\", font_color=\"black\"\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"# pass networkx graph to pyvis\n",
|
||||
"net.from_nx(graph)\n",
|
||||
"\n",
|
||||
"net.inherit_edge_colors(False)\n",
|
||||
"net.set_edge_smooth(\"dynamic\")\n",
|
||||
"\n",
|
||||
"net.repulsion()\n",
|
||||
"net.show_buttons()\n",
|
||||
"\n",
|
||||
"# save graph as HTML\n",
|
||||
"net.save_graph(\"./tmp.html\")"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "aki-prj23-transparenzregister-jVJfu35g-py3.11",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.11.3"
|
||||
},
|
||||
"orig_nbformat": 4
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
||||
@@ -0,0 +1,272 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<script src="lib/bindings/utils.js"></script>
|
||||
<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" />
|
||||
<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>
|
||||
|
||||
|
||||
<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>-->
|
||||
<link
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css"
|
||||
rel="stylesheet"
|
||||
integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
<script
|
||||
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.bundle.min.js"
|
||||
integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
|
||||
|
||||
<center>
|
||||
<h1></h1>
|
||||
</center>
|
||||
<style type="text/css">
|
||||
|
||||
#mynetwork {
|
||||
width: 100%;
|
||||
height: 600px;
|
||||
background-color: white;
|
||||
border: 1px solid lightgray;
|
||||
position: relative;
|
||||
float: left;
|
||||
}
|
||||
|
||||
|
||||
#loadingBar {
|
||||
position:absolute;
|
||||
top:0px;
|
||||
left:0px;
|
||||
width: 100%;
|
||||
height: 600px;
|
||||
background-color:rgba(200,200,200,0.8);
|
||||
-webkit-transition: all 0.5s ease;
|
||||
-moz-transition: all 0.5s ease;
|
||||
-ms-transition: all 0.5s ease;
|
||||
-o-transition: all 0.5s ease;
|
||||
transition: all 0.5s ease;
|
||||
opacity:1;
|
||||
}
|
||||
|
||||
#bar {
|
||||
position:absolute;
|
||||
top:0px;
|
||||
left:0px;
|
||||
width:20px;
|
||||
height:20px;
|
||||
margin:auto auto auto auto;
|
||||
border-radius:11px;
|
||||
border:2px solid rgba(30,30,30,0.05);
|
||||
background: rgb(0, 173, 246); /* Old browsers */
|
||||
box-shadow: 2px 0px 4px rgba(0,0,0,0.4);
|
||||
}
|
||||
|
||||
#border {
|
||||
position:absolute;
|
||||
top:10px;
|
||||
left:10px;
|
||||
width:500px;
|
||||
height:23px;
|
||||
margin:auto auto auto auto;
|
||||
box-shadow: 0px 0px 4px rgba(0,0,0,0.2);
|
||||
border-radius:10px;
|
||||
}
|
||||
|
||||
#text {
|
||||
position:absolute;
|
||||
top:8px;
|
||||
left:530px;
|
||||
width:30px;
|
||||
height:50px;
|
||||
margin:auto auto auto auto;
|
||||
font-size:22px;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
div.outerBorder {
|
||||
position:relative;
|
||||
top:400px;
|
||||
width:600px;
|
||||
height:44px;
|
||||
margin:auto auto auto auto;
|
||||
border:8px solid rgba(0,0,0,0.1);
|
||||
background: rgb(252,252,252); /* Old browsers */
|
||||
background: -moz-linear-gradient(top, rgba(252,252,252,1) 0%, rgba(237,237,237,1) 100%); /* FF3.6+ */
|
||||
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+ */
|
||||
background: -webkit-linear-gradient(top, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* Chrome10+,Safari5.1+ */
|
||||
background: -o-linear-gradient(top, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* Opera 11.10+ */
|
||||
background: -ms-linear-gradient(top, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* IE10+ */
|
||||
background: linear-gradient(to bottom, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* W3C */
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfcfc', endColorstr='#ededed',GradientType=0 ); /* IE6-9 */
|
||||
border-radius:72px;
|
||||
box-shadow: 0px 0px 10px rgba(0,0,0,0.2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#config {
|
||||
float: left;
|
||||
width: 400px;
|
||||
height: 600px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
<div class="card" style="width: 100%">
|
||||
|
||||
|
||||
<div id="mynetwork" class="card-body"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="loadingBar">
|
||||
<div class="outerBorder">
|
||||
<div id="text">0%</div>
|
||||
<div id="border">
|
||||
<div id="bar"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="config"></div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
// initialize global variables.
|
||||
var edges;
|
||||
var nodes;
|
||||
var allNodes;
|
||||
var allEdges;
|
||||
var nodeColors;
|
||||
var originalNodes;
|
||||
var network;
|
||||
var container;
|
||||
var options, data;
|
||||
var filter = {
|
||||
item : '',
|
||||
property : '',
|
||||
value : []
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 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([{"color": "#729b79ff", "font": {"color": "black"}, "id": "person_1", "label": "Tetau, Nicolas", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "company_1", "label": "0 10 24 Telefondienste GmbH", "shape": "dot", "size": 10, "type": "Company"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "company_4", "label": "01050.com GmbH", "shape": "dot", "size": 10, "type": "Company"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_2", "label": "Dammast, Lutz", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_3", "label": "Tutsch, Rosemarie", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "company_2", "label": "1. Staiger Grundst\u00fccksverwaltung GmbH \u0026 Co. KG", "shape": "dot", "size": 10, "type": "Company"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_4", "label": "Staiger, Marc", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_5", "label": "Staiger, Michaela", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_6", "label": "Staiger, Margarete", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_7", "label": "Staiger, Bruno", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_8", "label": "Hofmann, Nicole", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_9", "label": "Autenrieth, Steffen", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "company_3", "label": "1 A Autenrieth Kunststofftechnik GmbH \u0026 Co. KG", "shape": "dot", "size": 10, "type": "Company"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_10", "label": "Bischoff, Stefanie", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "company_2213", "label": "Multi-Center Warenvertriebs GmbH", "shape": "dot", "size": 10, "type": "Company"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "company_5", "label": "2. Schaper Objekt GmbH \u0026 Co. Kiel KG", "shape": "dot", "size": 10, "type": "Company"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_11", "label": "Achilles, Christel", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "company_6", "label": "AASP Filmproduktionsgesellschaft mbH \u0026 Co. Leonie KG", "shape": "dot", "size": 10, "type": "Company"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_12", "label": "Ackermann, Wilhelm", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_13", "label": "Ahrens, Harald", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_14", "label": "Al Sibai, Mohamed Maged", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_15", "label": "Al-Bazaz, Salim", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_16", "label": "Attawar, Marina", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_17", "label": "Babic-Pavicic, Ankica", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_18", "label": "Bak, Ingo", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_19", "label": "Becker, Christoph", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_20", "label": "Becker, Olaf", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_21", "label": "Berg, Rainer", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_22", "label": "Berkhout, Pieter", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_23", "label": "Berns, Bernhard", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_24", "label": "Betz, Franz-Hartwig", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_25", "label": "Birken, Claus", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "person_26", "label": "Blessing, Helmut", "shape": "dot", "size":Line truncated
|
||||
edges = new vis.DataSet([{"from": "person_1", "label": "Gesch\u00e4ftsf\u00fchrer", "to": "company_1", "width": 1}, {"from": "person_1", "label": "Gesch\u00e4ftsf\u00fchrer", "to": "company_4", "width": 1}, {"from": "company_1", "label": "Prokurist", "to": "person_2", "width": 1}, {"from": "person_2", "label": "Prokurist", "to": "company_4", "width": 1}, {"from": "person_3", "label": "Kommanditist", "to": "company_2", "width": 1}, {"from": "company_2", "label": "Kommanditist", "to": "person_4", "width": 1}, {"from": "company_2", "label": "Kommanditist", "to": "person_5", "width": 1}, {"from": "company_2", "label": "Kommanditist", "to": "person_6", "width": 1}, {"from": "company_2", "label": "Kommanditist", "to": "person_7", "width": 1}, {"from": "company_2", "label": "Kommanditist", "to": "person_8", "width": 1}, {"from": "person_9", "label": "Kommanditist", "to": "company_3", "width": 1}, {"from": "company_3", "label": "Prokurist", "to": "person_10", "width": 1}, {"from": "company_2213", "label": "Organisation", "to": "company_5", "width": 1}, {"from": "person_11", "label": "Kommanditist", "to": "company_6", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_12", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_13", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_14", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_15", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_16", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_17", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_18", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_19", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_20", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_21", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_22", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_23", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_24", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_25", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_26", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_27", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_28", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_29", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_30", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_31", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_32", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_33", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_34", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_35", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_36", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_37", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_38", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_39", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_40", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_41", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_42", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_43", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_44", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_45", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_46", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_47", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_48", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_49", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_50", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_51", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_52", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_53", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_54", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_55", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_56", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_57", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_58", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_59", "width": 1}, {"from": "company_6", "label": "Kommanditist", "tLine truncated
|
||||
|
||||
nodeColors = {};
|
||||
allNodes = nodes.get({ returnType: "Object" });
|
||||
for (nodeId in allNodes) {
|
||||
nodeColors[nodeId] = allNodes[nodeId].color;
|
||||
}
|
||||
allEdges = edges.get({ returnType: "Object" });
|
||||
// adding nodes and edges to the graph
|
||||
data = {nodes: nodes, edges: edges};
|
||||
|
||||
var options = {
|
||||
"configure": {
|
||||
"enabled": true
|
||||
},
|
||||
"edges": {
|
||||
"color": {
|
||||
"inherit": false
|
||||
},
|
||||
"smooth": {
|
||||
"enabled": true,
|
||||
"type": "dynamic"
|
||||
}
|
||||
},
|
||||
"interaction": {
|
||||
"dragNodes": true,
|
||||
"hideEdgesOnDrag": false,
|
||||
"hideNodesOnDrag": false
|
||||
},
|
||||
"physics": {
|
||||
"enabled": true,
|
||||
"repulsion": {
|
||||
"centralGravity": 0.2,
|
||||
"damping": 0.09,
|
||||
"nodeDistance": 100,
|
||||
"springConstant": 0.05,
|
||||
"springLength": 200
|
||||
},
|
||||
"solver": "repulsion",
|
||||
"stabilization": {
|
||||
"enabled": true,
|
||||
"fit": true,
|
||||
"iterations": 1000,
|
||||
"onlyDynamicEdges": false,
|
||||
"updateInterval": 50
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// if this network requires displaying the configure window,
|
||||
// put it in its div
|
||||
options.configure["container"] = document.getElementById("config");
|
||||
|
||||
|
||||
network = new vis.Network(container, data, options);
|
||||
|
||||
|
||||
network.on("click", neighbourhoodHighlight);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
network.on("stabilizationProgress", function(params) {
|
||||
document.getElementById('loadingBar').removeAttribute("style");
|
||||
var maxWidth = 496;
|
||||
var minWidth = 20;
|
||||
var widthFactor = params.iterations/params.total;
|
||||
var width = Math.max(minWidth,maxWidth * widthFactor);
|
||||
document.getElementById('bar').style.width = width + 'px';
|
||||
document.getElementById('text').innerHTML = Math.round(widthFactor*100) + '%';
|
||||
});
|
||||
network.once("stabilizationIterationsDone", function() {
|
||||
document.getElementById('text').innerHTML = '100%';
|
||||
document.getElementById('bar').style.width = '496px';
|
||||
document.getElementById('loadingBar').style.opacity = 0;
|
||||
// really clean the dom element
|
||||
setTimeout(function () {document.getElementById('loadingBar').style.display = 'none';}, 500);
|
||||
});
|
||||
|
||||
|
||||
return network;
|
||||
|
||||
}
|
||||
drawGraph();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,272 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<script src="lib/bindings/utils.js"></script>
|
||||
<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" />
|
||||
<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>
|
||||
|
||||
|
||||
<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>-->
|
||||
<link
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css"
|
||||
rel="stylesheet"
|
||||
integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
<script
|
||||
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.bundle.min.js"
|
||||
integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
|
||||
|
||||
<center>
|
||||
<h1></h1>
|
||||
</center>
|
||||
<style type="text/css">
|
||||
|
||||
#mynetwork {
|
||||
width: 100%;
|
||||
height: 600px;
|
||||
background-color: white;
|
||||
border: 1px solid lightgray;
|
||||
position: relative;
|
||||
float: left;
|
||||
}
|
||||
|
||||
|
||||
#loadingBar {
|
||||
position:absolute;
|
||||
top:0px;
|
||||
left:0px;
|
||||
width: 100%;
|
||||
height: 600px;
|
||||
background-color:rgba(200,200,200,0.8);
|
||||
-webkit-transition: all 0.5s ease;
|
||||
-moz-transition: all 0.5s ease;
|
||||
-ms-transition: all 0.5s ease;
|
||||
-o-transition: all 0.5s ease;
|
||||
transition: all 0.5s ease;
|
||||
opacity:1;
|
||||
}
|
||||
|
||||
#bar {
|
||||
position:absolute;
|
||||
top:0px;
|
||||
left:0px;
|
||||
width:20px;
|
||||
height:20px;
|
||||
margin:auto auto auto auto;
|
||||
border-radius:11px;
|
||||
border:2px solid rgba(30,30,30,0.05);
|
||||
background: rgb(0, 173, 246); /* Old browsers */
|
||||
box-shadow: 2px 0px 4px rgba(0,0,0,0.4);
|
||||
}
|
||||
|
||||
#border {
|
||||
position:absolute;
|
||||
top:10px;
|
||||
left:10px;
|
||||
width:500px;
|
||||
height:23px;
|
||||
margin:auto auto auto auto;
|
||||
box-shadow: 0px 0px 4px rgba(0,0,0,0.2);
|
||||
border-radius:10px;
|
||||
}
|
||||
|
||||
#text {
|
||||
position:absolute;
|
||||
top:8px;
|
||||
left:530px;
|
||||
width:30px;
|
||||
height:50px;
|
||||
margin:auto auto auto auto;
|
||||
font-size:22px;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
div.outerBorder {
|
||||
position:relative;
|
||||
top:400px;
|
||||
width:600px;
|
||||
height:44px;
|
||||
margin:auto auto auto auto;
|
||||
border:8px solid rgba(0,0,0,0.1);
|
||||
background: rgb(252,252,252); /* Old browsers */
|
||||
background: -moz-linear-gradient(top, rgba(252,252,252,1) 0%, rgba(237,237,237,1) 100%); /* FF3.6+ */
|
||||
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+ */
|
||||
background: -webkit-linear-gradient(top, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* Chrome10+,Safari5.1+ */
|
||||
background: -o-linear-gradient(top, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* Opera 11.10+ */
|
||||
background: -ms-linear-gradient(top, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* IE10+ */
|
||||
background: linear-gradient(to bottom, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* W3C */
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfcfc', endColorstr='#ededed',GradientType=0 ); /* IE6-9 */
|
||||
border-radius:72px;
|
||||
box-shadow: 0px 0px 10px rgba(0,0,0,0.2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#config {
|
||||
float: left;
|
||||
width: 400px;
|
||||
height: 600px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
<div class="card" style="width: 100%">
|
||||
|
||||
|
||||
<div id="mynetwork" class="card-body"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="loadingBar">
|
||||
<div class="outerBorder">
|
||||
<div id="text">0%</div>
|
||||
<div id="border">
|
||||
<div id="bar"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="config"></div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
// initialize global variables.
|
||||
var edges;
|
||||
var nodes;
|
||||
var allNodes;
|
||||
var allEdges;
|
||||
var nodeColors;
|
||||
var originalNodes;
|
||||
var network;
|
||||
var container;
|
||||
var options, data;
|
||||
var filter = {
|
||||
item : '',
|
||||
property : '',
|
||||
value : []
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 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([{"color": "blue", "font": {"color": "black"}, "id": "person_1", "label": "Tetau, Nicolas", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "company_1", "label": "0 10 24 Telefondienste GmbH", "shape": "dot", "size": 10, "type": "Company"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "company_4", "label": "01050.com GmbH", "shape": "dot", "size": 10, "type": "Company"}, {"color": "blue", "font": {"color": "black"}, "id": "person_2", "label": "Dammast, Lutz", "shape": "dot", "size": 10, "type": "Person"}, {"color": "blue", "font": {"color": "black"}, "id": "person_3", "label": "Tutsch, Rosemarie", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "company_2", "label": "1. Staiger Grundst\u00fccksverwaltung GmbH \u0026 Co. KG", "shape": "dot", "size": 10, "type": "Company"}, {"color": "blue", "font": {"color": "black"}, "id": "person_4", "label": "Staiger, Marc", "shape": "dot", "size": 10, "type": "Person"}, {"color": "blue", "font": {"color": "black"}, "id": "person_5", "label": "Staiger, Michaela", "shape": "dot", "size": 10, "type": "Person"}, {"color": "blue", "font": {"color": "black"}, "id": "person_6", "label": "Staiger, Margarete", "shape": "dot", "size": 10, "type": "Person"}, {"color": "blue", "font": {"color": "black"}, "id": "person_7", "label": "Staiger, Bruno", "shape": "dot", "size": 10, "type": "Person"}, {"color": "blue", "font": {"color": "black"}, "id": "person_8", "label": "Hofmann, Nicole", "shape": "dot", "size": 10, "type": "Person"}, {"color": "blue", "font": {"color": "black"}, "id": "person_9", "label": "Autenrieth, Steffen", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "company_3", "label": "1 A Autenrieth Kunststofftechnik GmbH \u0026 Co. KG", "shape": "dot", "size": 10, "type": "Company"}, {"color": "blue", "font": {"color": "black"}, "id": "person_10", "label": "Bischoff, Stefanie", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "company_2213", "label": "Multi-Center Warenvertriebs GmbH", "shape": "dot", "size": 10, "type": "Company"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "company_5", "label": "2. Schaper Objekt GmbH \u0026 Co. Kiel KG", "shape": "dot", "size": 10, "type": "Company"}, {"color": "blue", "font": {"color": "black"}, "id": "person_11", "label": "Achilles, Christel", "shape": "dot", "size": 10, "type": "Person"}, {"color": "#729b79ff", "font": {"color": "black"}, "id": "company_6", "label": "AASP Filmproduktionsgesellschaft mbH \u0026 Co. Leonie KG", "shape": "dot", "size": 10, "type": "Company"}, {"color": "blue", "font": {"color": "black"}, "id": "person_12", "label": "Ackermann, Wilhelm", "shape": "dot", "size": 10, "type": "Person"}, {"color": "blue", "font": {"color": "black"}, "id": "person_13", "label": "Ahrens, Harald", "shape": "dot", "size": 10, "type": "Person"}, {"color": "blue", "font": {"color": "black"}, "id": "person_14", "label": "Al Sibai, Mohamed Maged", "shape": "dot", "size": 10, "type": "Person"}, {"color": "blue", "font": {"color": "black"}, "id": "person_15", "label": "Al-Bazaz, Salim", "shape": "dot", "size": 10, "type": "Person"}, {"color": "blue", "font": {"color": "black"}, "id": "person_16", "label": "Attawar, Marina", "shape": "dot", "size": 10, "type": "Person"}, {"color": "blue", "font": {"color": "black"}, "id": "person_17", "label": "Babic-Pavicic, Ankica", "shape": "dot", "size": 10, "type": "Person"}, {"color": "blue", "font": {"color": "black"}, "id": "person_18", "label": "Bak, Ingo", "shape": "dot", "size": 10, "type": "Person"}, {"color": "blue", "font": {"color": "black"}, "id": "person_19", "label": "Becker, Christoph", "shape": "dot", "size": 10, "type": "Person"}, {"color": "blue", "font": {"color": "black"}, "id": "person_20", "label": "Becker, Olaf", "shape": "dot", "size": 10, "type": "Person"}, {"color": "blue", "font": {"color": "black"}, "id": "person_21", "label": "Berg, Rainer", "shape": "dot", "size": 10, "type": "Person"}, {"color": "blue", "font": {"color": "black"}, "id": "person_22", "label": "Berkhout, Pieter", "shape": "dot", "size": 10, "type": "Person"}, {"color": "blue", "font": {"color": "black"}, "id": "person_23", "label": "Berns, Bernhard", "shape": "dot", "size": 10, "type": "Person"}, {"color": "blue", "font": {"color": "black"}, "id": "person_24", "label": "Betz, Franz-Hartwig", "shape": "dot", "size": 10, "type": "Person"}, {"color": "blue", "font": {"color": "black"}, "id": "person_25", "label": "Birken, Claus", "shape": "dot", "size": 10, "type": "Person"}, {"color": "blue", "font": {"color": "black"}, "id": "person_26", "label": "Blessing, Helmut", "shape": "dot", "size": 10, "type": "Person"}, {"color": "blue", "font": {"color": "black"}, "id": "person_27", "label": "Bohnet, Heinz G.", "shape": "doLine truncated
|
||||
edges = new vis.DataSet([{"from": "person_1", "label": "Gesch\u00e4ftsf\u00fchrer", "to": "company_1", "width": 1}, {"from": "person_1", "label": "Gesch\u00e4ftsf\u00fchrer", "to": "company_4", "width": 1}, {"from": "company_1", "label": "Prokurist", "to": "person_2", "width": 1}, {"from": "person_2", "label": "Prokurist", "to": "company_4", "width": 1}, {"from": "person_3", "label": "Kommanditist", "to": "company_2", "width": 1}, {"from": "company_2", "label": "Kommanditist", "to": "person_4", "width": 1}, {"from": "company_2", "label": "Kommanditist", "to": "person_5", "width": 1}, {"from": "company_2", "label": "Kommanditist", "to": "person_6", "width": 1}, {"from": "company_2", "label": "Kommanditist", "to": "person_7", "width": 1}, {"from": "company_2", "label": "Kommanditist", "to": "person_8", "width": 1}, {"from": "person_9", "label": "Kommanditist", "to": "company_3", "width": 1}, {"from": "company_3", "label": "Prokurist", "to": "person_10", "width": 1}, {"from": "company_2213", "label": "Organisation", "to": "company_5", "width": 1}, {"from": "person_11", "label": "Kommanditist", "to": "company_6", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_12", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_13", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_14", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_15", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_16", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_17", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_18", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_19", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_20", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_21", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_22", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_23", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_24", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_25", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_26", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_27", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_28", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_29", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_30", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_31", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_32", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_33", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_34", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_35", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_36", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_37", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_38", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_39", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_40", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_41", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_42", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_43", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_44", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_45", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_46", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_47", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_48", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_49", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_50", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_51", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_52", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_53", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_54", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_55", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_56", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_57", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_58", "width": 1}, {"from": "company_6", "label": "Kommanditist", "to": "person_59", "width": 1}, {"from": "company_6", "label": "Kommanditist", "tLine truncated
|
||||
|
||||
nodeColors = {};
|
||||
allNodes = nodes.get({ returnType: "Object" });
|
||||
for (nodeId in allNodes) {
|
||||
nodeColors[nodeId] = allNodes[nodeId].color;
|
||||
}
|
||||
allEdges = edges.get({ returnType: "Object" });
|
||||
// adding nodes and edges to the graph
|
||||
data = {nodes: nodes, edges: edges};
|
||||
|
||||
var options = {
|
||||
"configure": {
|
||||
"enabled": true
|
||||
},
|
||||
"edges": {
|
||||
"color": {
|
||||
"inherit": false
|
||||
},
|
||||
"smooth": {
|
||||
"enabled": true,
|
||||
"type": "dynamic"
|
||||
}
|
||||
},
|
||||
"interaction": {
|
||||
"dragNodes": true,
|
||||
"hideEdgesOnDrag": false,
|
||||
"hideNodesOnDrag": false
|
||||
},
|
||||
"physics": {
|
||||
"enabled": true,
|
||||
"repulsion": {
|
||||
"centralGravity": 0.2,
|
||||
"damping": 0.09,
|
||||
"nodeDistance": 100,
|
||||
"springConstant": 0.05,
|
||||
"springLength": 200
|
||||
},
|
||||
"solver": "repulsion",
|
||||
"stabilization": {
|
||||
"enabled": true,
|
||||
"fit": true,
|
||||
"iterations": 1000,
|
||||
"onlyDynamicEdges": false,
|
||||
"updateInterval": 50
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// if this network requires displaying the configure window,
|
||||
// put it in its div
|
||||
options.configure["container"] = document.getElementById("config");
|
||||
|
||||
|
||||
network = new vis.Network(container, data, options);
|
||||
|
||||
|
||||
network.on("click", neighbourhoodHighlight);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
network.on("stabilizationProgress", function(params) {
|
||||
document.getElementById('loadingBar').removeAttribute("style");
|
||||
var maxWidth = 496;
|
||||
var minWidth = 20;
|
||||
var widthFactor = params.iterations/params.total;
|
||||
var width = Math.max(minWidth,maxWidth * widthFactor);
|
||||
document.getElementById('bar').style.width = width + 'px';
|
||||
document.getElementById('text').innerHTML = Math.round(widthFactor*100) + '%';
|
||||
});
|
||||
network.once("stabilizationIterationsDone", function() {
|
||||
document.getElementById('text').innerHTML = '100%';
|
||||
document.getElementById('bar').style.width = '496px';
|
||||
document.getElementById('loadingBar').style.opacity = 0;
|
||||
// really clean the dom element
|
||||
setTimeout(function () {document.getElementById('loadingBar').style.display = 'none';}, 500);
|
||||
});
|
||||
|
||||
|
||||
return network;
|
||||
|
||||
}
|
||||
drawGraph();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user