Welcome to APGL’s documentation!

Another Python Graph Library is a simple, fast and easy to use graph library. The main characteristics are as follows:

  • Directed, undirected and multi-graphs using numpy and scipy matrices for fast linear algebra computations. The PySparseGraph and SparseGraph classes can scale up to 1,000,000s of vertices and edges on a standard PC.
  • Set operations including finding subgraphs, complements, unions, and intersections of graphs.
  • Graph properties such as diameter, geodesic distance, degree distributions, eigenvector betweenness, and eigenvalues.
  • Other algorithms: search, Floyd-Warshall, Dijkstra’s algorithm.
  • Configuration Model, Erdos-Renyi, Small-World, Albert-Barabasi and Kronecker graph generation
  • Write to Pajek and simple CSV files
  • Machine learning features - data preprocessing, kernels, PCA, KCCA, ABC, TreeRank.
  • Unit tested using the Python unittest framework

Downloading

Download for Windows, Linux or Mac OS using:

  • Sourceforge here
  • The Python Package Index (PyPI) here

To use this library, you must have Python, NumPy and SciPy. The code has been verified on Python 2.7.2, Numpy 1.5.1 and Scipy 0.9.0, but should work with other versions. The automatic testing routine requires Python 2.7 or later, or the unittest2 testing framework for Python 2.3-2.6 .

The source code repository is available here for those that want the bleeding edge, or are interested in development.

Installation

Ensure that pip is installed, and then install apgl in the following way:

pip install apgl

If installing from source unzip the apgl-x.y.z.tar.gz file and then run setup.py as follows:

python setup.py install

In order to test the library (recommended), using the following commands in python

import apgl
apgl.test()

and check that all tested pass.

User Guide

A short introduction to the main features of the library is available here. This is the best way to learn the key features of APGL. In the meanwhile, here is small example of how to create a graph using the SparseGraph class which is based on scipy.sparse matrices.

from apgl.graph import *
import numpy

numVertices = 10
vList = GeneralVertexList(numVertices)
sGraph = SparseGraph(vList)
sGraph[0,1] = 1
sGraph[0,2] = 3
sGraph.setVertex(0, "abc")
sGraph.setVertex(1, 123)

The SparseGraph is initialised with GeneralVertexList, which can take any values as the vertex labels. Edges are added between vertices (0, 1) and (0, 2). Following, the first and second vertices (indexed by 0 and 1 respectively) are initialised with “abc” and 123 respectively.

To learn more consult the reference documentation:

There is also a PDF version.

Support

For any questions or comments please email me at <my first name> at gmail dot com. Documentation and code improvements/additions are especially welcome. The mailing list is accessible here.

Indices and tables

Table Of Contents

Next topic

Class Documentation

This Page