Bipartite Graphen als Matrizen

Fortgeschrittene Netzwerkanalyse in Python

Eric Ma

Data Carpentry instructor and author of nxviz package

Matrixdarstellung

  • Zeilen: Knoten einer Partition
  • Spalten: Knoten der anderen Partition
  • Zellen: 1 bei Kante, sonst 0
Fortgeschrittene Netzwerkanalyse in Python

Matrixdarstellung

ch2-2.006.png

Fortgeschrittene Netzwerkanalyse in Python

Beispielcode

cust_nodes = [n for n in G.nodes() if G.nodes[n]
                 ['bipartite'] == 'customers']
prod_nodes = [n for n in G.nodes() if G.nodes[n]
                 ['bipartite'] == 'products']

mat = nx.bipartite.biadjacency_matrix(G, row_order=cust_nodes, column_order=prod_nodes)
mat
<3x2 sparse matrix of type '<class 'numpy.int64'>'
with 3 stored elements in Compressed Sparse Row format>
Fortgeschrittene Netzwerkanalyse in Python

Matrixprojektion

  • Projektion per Matrixmultiplikation berechenbar

ch2-2.014.png

Fortgeschrittene Netzwerkanalyse in Python

Matrixprojektion

  • Projektion per Matrixmultiplikation berechenbar

ch2-2.015.png

Fortgeschrittene Netzwerkanalyse in Python

Matrixprojektion

  • Projektion per Matrixmultiplikation berechenbar

ch2-2.016.png

Fortgeschrittene Netzwerkanalyse in Python

Matrixprojektion

  • Projektion per Matrixmultiplikation berechenbar

ch2-2.017.png

Fortgeschrittene Netzwerkanalyse in Python

Matrixprojektion

  • Projektion per Matrixmultiplikation berechenbar

ch2-2.018.png

Fortgeschrittene Netzwerkanalyse in Python

Matrixprojektion

  • Projektion per Matrixmultiplikation berechenbar

ch2-2.019.png

Fortgeschrittene Netzwerkanalyse in Python

Matrixprojektion

  • Projektion per Matrixmultiplikation berechenbar

ch2-2.020.png

Fortgeschrittene Netzwerkanalyse in Python

Matrixprojektion

  • Projektion per Matrixmultiplikation berechenbar

ch2-2.021.png

Fortgeschrittene Netzwerkanalyse in Python

Matrixprojektion

  • Projektion per Matrixmultiplikation berechenbar

ch2-2.022.png

Fortgeschrittene Netzwerkanalyse in Python

Matrixprojektion

  • Projektion per Matrixmultiplikation berechenbar

ch2-2.023.png

Fortgeschrittene Netzwerkanalyse in Python

Matrixprojektion

  • Projektion per Matrixmultiplikation berechenbar

ch2-2.024.png

Fortgeschrittene Netzwerkanalyse in Python

Matrixprojektion

  • Projektion per Matrixmultiplikation berechenbar

ch2-2.025.png

Fortgeschrittene Netzwerkanalyse in Python

Matrixmultiplikation in Python

mat @ mat.T
<5x5 sparse matrix of type '<class 'numpy.int64'>'
 with 23 stored elements in Compressed Sparse Row format>
mat.T @ mat
<10x10 sparse matrix of type '<class 'numpy.int64'>'
 with 50 stored elements in Compressed Sparse Column format>
Fortgeschrittene Netzwerkanalyse in Python

Lass uns üben!

Fortgeschrittene Netzwerkanalyse in Python

Preparing Video For Download...