Package org.nlpub.watset.graph
Class MarkovClusteringBinaryRunner<V,E>
- java.lang.Object
-
- org.nlpub.watset.graph.MarkovClusteringBinaryRunner<V,E>
-
- Type Parameters:
V- the type of nodes in the graphE- the type of edges in the graph
- All Implemented Interfaces:
Clustering<V>
public class MarkovClusteringBinaryRunner<V,E> extends Object implements Clustering<V>
A wrapper for the official implementation of the Markov Clustering (MCL) algorithm in C.This is a weird thing. The official implementation of MCL is very fast, but is distributed under GPL. In order to use it we need to run the separate process and speak to it over standard input/output redirection.
- See Also:
- van Dongen (2000)
-
-
Constructor Summary
Constructors Constructor Description MarkovClusteringBinaryRunner(org.jgrapht.Graph<V,E> graph, Path mcl, double r)Create an instance of the Markov Clustering algorithm wrapper.MarkovClusteringBinaryRunner(org.jgrapht.Graph<V,E> graph, Path mcl, double r, int threads)Create an instance of the Markov Clustering algorithm wrapper.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfit()Run the algorithm to induce the parameters of the clusters.Collection<Collection<V>>getClusters()Return a collection of clusters, each cluster is a collection of objects.static <V,E>
Function<org.jgrapht.Graph<V,E>,Clustering<V>>provider(Path mcl, double r)A factory function that sets up the algorithm for the given graph.static <V,E>
Function<org.jgrapht.Graph<V,E>,Clustering<V>>provider(Path mcl, double r, int threads)A factory function that sets up the algorithm for the given graph.
-
-
-
Constructor Detail
-
MarkovClusteringBinaryRunner
public MarkovClusteringBinaryRunner(org.jgrapht.Graph<V,E> graph, Path mcl, double r, int threads)
Create an instance of the Markov Clustering algorithm wrapper.- Parameters:
graph- the graphmcl- the path to the MCL binaryr- the inflation parameterthreads- the number of threads
-
-
Method Detail
-
provider
public static <V,E> Function<org.jgrapht.Graph<V,E>,Clustering<V>> provider(Path mcl, double r, int threads)
A factory function that sets up the algorithm for the given graph.- Type Parameters:
V- the type of nodes in the graphE- the type of edges in the graph- Parameters:
mcl- the path to the MCL binaryr- the inflation parameterthreads- the number of threads- Returns:
- a factory function that sets up the algorithm for the given graph
-
provider
public static <V,E> Function<org.jgrapht.Graph<V,E>,Clustering<V>> provider(Path mcl, double r)
A factory function that sets up the algorithm for the given graph.- Type Parameters:
V- the type of nodes in the graphE- the type of edges in the graph- Parameters:
mcl- the path to the MCL binaryr- the inflation parameter- Returns:
- a factory function that sets up the algorithm for the given graph
-
getClusters
public Collection<Collection<V>> getClusters()
Description copied from interface:ClusteringReturn a collection of clusters, each cluster is a collection of objects. Usually this method is called after theClustering.fit()method.- Specified by:
getClustersin interfaceClustering<V>- Returns:
- clusters
-
fit
public void fit()
Description copied from interface:ClusteringRun the algorithm to induce the parameters of the clusters.- Specified by:
fitin interfaceClustering<V>
-
-