Another Python Graph Library is a simple, fast and easy to use graph library. The main characteristics are as follows:
Download for Windows, Linux or Mac OS using:
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.
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.
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.