commit ff7aec28776c246a357ccc8db45f0c91d843aafd
parent e72ca8acd5b1a6400f5792dfb3e4ddf636afe6f8
Author: miksa <milutin@popovic.xyz>
Date: Mon, 20 Jun 2022 12:40:37 +0200
small fix in script
Diffstat:
6 files changed, 124 insertions(+), 0 deletions(-)
diff --git a/nodes_edges/Popovic_12_06.zip b/nodes_edges/Popovic_12_06.zip
Binary files differ.
diff --git a/nodes_edges/Popovic_19_06.zip b/nodes_edges/Popovic_19_06.zip
Binary files differ.
diff --git a/nodes_edges/Popovic_19_06_final.zip b/nodes_edges/Popovic_19_06_final.zip
Binary files differ.
diff --git a/pres/script.md b/pres/script.md
@@ -0,0 +1,50 @@
+# FILM SCRIPT
+
+Welcome, my name is Milutin Popović and I will introduce you to a project I
+have been working on in this semester involving Networks and Python.
+
+Python is known to be an easy to use, simple to learn programming language
+used by hobbyists, software developers, scientists and students like me. To
+save time and all in all make our lives easier while coding, we fall back to
+using what are called python packages. These packages are essentially already
+written out code by a group of people or one person and mostly made available
+for the public to use without any actual restrictions. This allows us to use
+well thought out and optimized code without actually needing to write it
+ourselves.
+
+
+So, if we were to write a python program and use some of these packages, we
+would call our program dependent on these packages. On the other hand the
+package that we are using is not dependent on the program we are writing it,
+at least not yet. And like our dummy program every single package might also
+depend on some other package or multiple packages.
+
+To get dependency information of each package we resort to the Python Package
+Index, which is the official repository for python packages. Mapping packages
+as nodes and their dependency information as directional links to these nodes
+we can represent this information in a complex network/graph with nodes and
+directional links. The network layout is structured in a pyramid scheme in such
+a way that the nodes with high degree are at the top, while low degree nodes
+are tend to the bottom.
+
+Like most complex networks on the internet this is a scale
+free network where a lot of the times ''rich get richer'' scenario comes into
+play. Older, and more popular packages tend to be used frequently than newly
+created ones. Never the less this does not not restrict us from finding new information
+
+With a little bit of creative thinking we can reconstruct time dependent
+data. By this I mean we can reconstruct the same exact network for each and
+every month from the date the Package Index was created, around 2005
+to this year 2022. An interesting thing to look here are the rising
+stars, created in last few years that have gained a large number of
+in dependencies/in degrees in a short period of time. These are shown in the picture here.
+Some of these packages are already well recognized in the data science/
+machine learning community like keras and torch, and some other packages
+are tending to replace older packages showing a logarithmically flattening
+curve. An example of this would be 'hpptx'. Now we can take a look how over
+the years they have quite quickly risen through the levels of our network
+layout to being the top nodes.
+
+Indeed you might want to keep an eye on these packages, since they can quite
+easily replace some of the older flattening packages in the community and
+represent based on the analysis that we have done, all in all quite solid projects.
diff --git a/src/__pycache__/export_vr.cpython-310.pyc b/src/__pycache__/export_vr.cpython-310.pyc
Binary files differ.
diff --git a/src/export_vr.py b/src/export_vr.py
@@ -0,0 +1,74 @@
+#!/usr/bin/env python3.10
+
+import networkx as nx
+import numpy as np
+
+import matplotlib.cm as cm
+
+def export_data_vr(G:nx.DiGraph, posG3D, chosen_nodes, path='./', step=None):
+ node_color = {node: [1, 1, 1] for node in G.nodes}
+
+ lx = [x for x,y,z in posG3D.values()]
+ ly = [y for x,y,z in posG3D.values()]
+ lz = [z for x,y,z in posG3D.values()]
+
+ min_x = min(lx)
+ max_x = max(lx)
+ min_y = min(ly)
+ max_y = max(ly)
+ min_z = min(lz)
+ max_z = max(lz)
+
+ if step != None:
+ f = open(path + f'nodes_{step}.csv','w')
+ else:
+ f = open(path + f'nodes.csv','w')
+
+ d_node_rowID = {}
+ cc = 0
+# for node, xyz in sorted(posG3D.items()):
+ for node in G.nodes():
+ d_node_rowID[node] = cc
+ x = posG3D[node][0]
+ y = posG3D[node][1]
+ z = posG3D[node][2]
+
+ xn = (x-min_x)/(max_x-min_x)
+ yn = (y-min_y)/(max_y-min_y)
+ zn = (z-min_z)/(max_z-min_z)
+
+ if str(node) in chosen_nodes:
+ r = int(255)
+ g = int(0)
+ b = int(0)
+ alpha = 200
+ else:
+ r = int(255*node_color[node][0])
+ g = int(255*node_color[node][1])
+ b = int(255*node_color[node][2])
+ alpha = 100
+
+ name = str(node)
+ f.write('%s,%s,%s,%s,%s,%s,%s,%s\n' %(xn,yn,zn,r,g,b,alpha,name))
+ cc += 1
+
+ f.close()
+
+ if step != None:
+ f = open(path + f'edges_{step}.csv','w')
+ else:
+ f = open(path + f'edges.csv','w')
+
+ cc = 0
+ for u,v in G.edges():
+ row_u = d_node_rowID[u]
+ row_v = d_node_rowID[v]
+
+ edge_color = '#999999'
+ r = int(255*node_color[node][0])
+ g = int(255*node_color[node][1])
+ b = int(255*node_color[node][2])
+
+ f.write('%s,%s,%s,%s,%s,%s\n' %(row_u,row_v,r,g,b,100))
+
+ f.close()