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.
pip install Cython
pip install networkx-metis
git clone https://github.com/networkx/networkx-metis.git
cd networkx-metis
python setup.py install
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.
>>> 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]])
For a summary of all the coding guidelines and development workflow, please refer to the Developer Guide of NetworkX.
- Report Bugs and Issues
- Resolve Bugs and Issues
- Write tutorials, examples and documentation