networkx / networkx-metis

NetworkX Addon to allow graph partitioning with METIS
Other
79 stars 21 forks source link

NOTE: NetworkX-METIS isn't maintained actively, there won't be any new releases anytime soon. Please open an issue if you are interested in helping with maintaining this project.

NetworkX-METIS

Build Status Code Health Documentation Status

What is NetworkX-METIS?

NetworkX-METIS is a NetworkX addon that enables graph partitioning with METIS.

NetworkX is a Python package for the creation, manipulation and study of the structure, dynamics, and functions of complex networkx. METIS is a C library written for partitioning graphs, partitioning finite element meshes, and producing fill reducing orderings for sparse matrices. NetworkX-METIS uses Cython to wrap the METIS library to make it available in Python.

Documentation of NetworkX-METIS is available at http://networkx-metis.readthedocs.org/en/latest.

Installation

Linux/Mac

Requirements

pip install Cython

Installation from PyPI

pip install networkx-metis

Installation from GitHub

git clone https://github.com/networkx/networkx-metis.git
cd networkx-metis
python setup.py install

Windows

Installation on Windows is largely the same as on Linux/Mac except that no "platform compiler" is pre-installed. So, an extra --compiler flag may be necessary to specify a compiler. A simple guide for installing and setting up the compiler is available here.

Here is an example:

git clone https://github.com/networkx/networkx-metis.git
cd networkx-metis
python setup.py build --compiler=msvc
python setup.py install

provided that Cython and NetworkX have been installed as described in above sections.

Example

>>> import networkx as nx
>>> import nxmetis
>>> G = nx.complete_graph(10)
>>> nxmetis.partition(G, 2)
(25, [[0, 1, 2, 3, 6], [4, 5, 7, 8, 9]])

Contribute to NetworkX-METIS

For a summary of all the coding guidelines and development workflow, please refer to the Developer Guide of NetworkX.