# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # <font color='orange'>   **Het Netwerk** </font>
#
#
# ### MIS NETWORK OPTIMIZATION of APC GRAPH
# ***
#
#
# **Graph Theory Eulerian Circuit Optimization https://www.datacamp.com/community/tutorials/networkx-python-graph-tutorial**
#

# +
import networkx as nx
import matplotlib.pyplot as plt
# %matplotlib inline
import psycopg2 
import pandas as pd 

# %config IPCompleter.greedy=True

# -

conn_1 = psycopg2.connect(user = "postgres",
                                  password = "",
                                  host = "",
                                  port = "",
                                  database = "")
cursor_1 = conn_1.cursor()
print (conn_1.get_dsn_parameters(),"\n")

# +
Ass_data = pd.read_sql_query(' SELECT "AssTitle", "PlaName" ,"ParName","IngNet","IngDate" FROM dbo."Part_InGameReport_1912" join dbo."Partner" on "ParId" = "IngParId"join dbo."Platform" on "PlaId" = "IngPlaId" join dbo."Asset" on "AssId" = "IngAssId" LIMIT 10',conn_1)

Ass_data.head()
# -

df = nx.from_pandas_edgelist(Ass_data, source='AssTitle', target='ParName', edge_attr=True)
        

df.nodes()

df.edges()

plt.figure(figsize=(12,8))
nx.draw_networkx(df, with_labels=True)

StarcoderdataJupyterScriptsDedupFiltered