* val g = new MatrixD ((12, 12), 0.
* val g = new MatrixD ((12, 12), 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.)
println ("-----------------------------------------------------------") println ("g = " + g) val mg = new MarkovClustering (g) mg.addSelfLoops () mg.normalize () println ("result = " + mg.processMatrix ()) println ("cluster = " + mg.cluster ())
// Test the MCL Algorithm on a Markov transition matrix.
val t = new MatrixD ((12, 12), 0.2, 0.25, 0.0, 0.0, 0.0, 0.333, 0.25, 0.0, 0.0, 0.25, 0.0, 0.0, 0.2, 0.25, 0.25, 0.0, 0.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.25, 0.25, 0.2, 0.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.25, 0.2, 0.0, 0.0, 0.0, 0.2, 0.2, 0.0, 0.2, 0.0, 0.0, 0.25, 0.25, 0.0, 0.2, 0.0, 0.25, 0.2, 0.0, 0.0, 0.0, 0.0, 0.2, 0.0, 0.0, 0.0, 0.0, 0.333, 0.0, 0.0, 0.0, 0.25, 0.0, 0.0, 0.2, 0.0, 0.0, 0.0, 0.2, 0.0, 0.25, 0.0, 0.0, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2, 0.2, 0.0, 0.0, 0.2, 0.2, 0.0, 0.2, 0.0, 0.0, 0.0, 0.0, 0.2, 0.0, 0.0, 0.0, 0.2, 0.2, 0.0, 0.2, 0.333, 0.2, 0.0, 0.0, 0.0, 0.0, 0.333, 0.25, 0.0, 0.0, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2, 0.0, 0.0, 0.0, 0.2, 0.2, 0.0, 0.2, 0.333, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2, 0.0, 0.2, 0.333)
println ("-----------------------------------------------------------") println ("t = " + t) val mt = new MarkovClustering (t) println ("result = " + mt.processMatrix ()) println ("cluster = " + mt.cluster ())
// Test the MCL Algorithm on a graph represented as a sparse adjacency matrix.
val x = new SparseMatrixD (12, 0.0) x(0) = ListMap ((1, 1.0), (5, 1.0), (6, 1.0), (9, 1.0)) x(1) = ListMap ((0, 1.0), (2, 1.0), (4, 1.0)) x(2) = ListMap ((1, 1.0), (3, 1.0), (4, 1.0)) x(3) = ListMap ((2, 1.0), (7, 1.0), (8, 1.0), (10, 1.0)) x(4) = ListMap ((1, 1.0), (2, 1.0), (6, 1.0), (7, 1.0)) x(5) = ListMap ((0, 1.0), (9, 1.0)) x(6) = ListMap ((0, 1.0), (4, 1.0), (9, 1.0)) x(7) = ListMap ((3, 1.0), (4, 1.0), (8, 1.0), (10, 1.0)) x(8) = ListMap ((3, 1.0), (7, 1.0), (10, 1.0), (11, 1.0)) x(9) = ListMap ((0, 1.0), (5, 1.0), (6, 1.0)) x(10) = ListMap ((3, 1.0), (7, 1.0), (8, 1.0), (11, 1.0)) x(11) = ListMap ((8, 1.0))
println ("-----------------------------------------------------------") println ("x = " + x) val mx = new MarkovClustering (x) mx.addSelfLoops () mx.normalize () println ("result = " + mx.processMatrix ()) println ("cluster = " + mx.cluster ()) *
The
MarkovClusteringTest
object is used to test theMarkovClustering
class.www.cs.ucsb.edu/~xyan/classes/CS595D-2009winter/MCL_Presentation2.pdf