GithubHelp home page GithubHelp logo

python_mcl's Introduction

MCL algorithm

This module implements the Markov Cluster algorithm created by Stijn van Dongen and described in http://www.library.uu.nl/digiarchief/dip/diss/1895620/inhoud.htm.

This implementation is still in beta and is not yet optimized for large networks.

This implementation was updated for Python 3.X as part of a submission for the 2016 Riot Games API Challenge.

![example] (example.png)

##Installation

python setup.py install

##Usage

###Command line

Usage: mcl_clustering.py [options] <input_matrix>

Options
  -h, --help            show this help message and exit
  -e EXPAND_FACTOR, --expand_factor=EXPAND_FACTOR
                        expand factor (default: 2)
  -i INFLATE_FACTOR, --inflate_factor=INFLATE_FACTOR
                        inflate factor (default: 2)
  -m MULT_FACTOR, --mult_factor=MULT_FACTOR
                        multiply factor (default: 2)
  -l MAX_LOOP, --max_loops=MAX_LOOP
                        max loops (default: 60)
  -o FILE, --output=FILE
                        output (default: stdout)
  -v, --verbose         verbose (default: True)
  -d, --draw-graph      show graph with networkx (default: False)

The input matrix must be as comma-separated value file representing the adjacency matrix.

An example is the file example.csv in examples dir.

try: mcl_clustering.py -d -e 3 <example_path>/example.csv

###Code

####Using numpy adjacency matrix

from mcl_clustering import mcl

A = <your matrix>

M, clusters = mcl(A, expand_factor = <expand_factor>,
                   inflate_factor = <inflate_factor>,
                   max_loop = <max_loop>,
                   mult_factor = <mult_factor>)

####Using a networkx graph

from mcl_clustering import networkx_mcl

G = <your graph>

M, clusters = networkx_mcl(G, expand_factor = <expand_factor>,
                   inflate_factor = <inflate_factor>,
                   max_loop = <max_loop>,
                   mult_factor = <mult_factor>)


Output
    M = otuput matrix
    clusters = dict with keys = [<cluster id>] values = [<vertex id>]

##Requirements

numpy
networkx

##References

license

MIT

python_mcl's People

Contributors

crtheisen avatar koteth avatar yellow-beard avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.