Getting started

scikit-network is an open-source python package for the analysis of large graphs.

Installation

Install scikit-network:

$ pip install scikit-network

Import scikit-network in a Python project:

import sknetwork as skn

Data format

Each graph is represented by its adjacency matrix, either as a dense numpy array or a sparse scipy CSR matrix. A bipartite graph can be represented by its biadjacency matrix, in the same format.

Documentation

We use the following notations in the documentation:

Graphs

For undirected graphs:

  • \(A\) is the adjacency matrix of the graph (dimension \(n\times n\))

  • \(d = A1\) is the vector of node weights (node degrees if the matrix \(A\) is binary)

  • \(D = \text{diag}(d)\) the diagonal matrix of node weights

Digraphs

For directed graphs:

  • \(A\) is the adjacency matrix of the graph (dimension \(n\times n\))

  • \(d^+ = A1\) and \(d^- = A^T1\) are the vectors of out-weights and in-weights of nodes (out-degrees and in-degrees if the matrix \(A\) is binary)

  • \(D^+ = \text{diag}(d^+)\) and \(D^- = \text{diag}(d^-)\) are the diagonal matrices of out-weights and in-weights

Bigraphs

For bipartite graphs:

  • \(B\) is the biadjacency matrix of the graph (dimension \(n_1\times n_2\))

  • \(d_1 = B1\) and \(d_2 = B^T1\) are the vectors of weights (rows and columns)

  • \(D_1 = \text{diag}(d_1)\) and \(D_2 = \text{diag}(d_2)\) are the diagonal matrices of weights.

Notes

  • Adjacency and biadjacency matrices have non-negative entries (the weights of the edges).

  • Bipartite graphs are undirected but have a special structure that is exploited by some algorithms. These algorithms are identified with the prefix Bi.