randomWalkWithRestart.run(new String[]{"--vertices", verticesFile.getAbsolutePath(),
"--edges", edgesFile.getAbsolutePath(), "--sourceVertexIndex", String.valueOf(2),
"--output", outputDir.getAbsolutePath(), "--numIterations", String.valueOf(2),
"--stayingProbability", String.valueOf(0.75), "--tempDir", tempDir.getAbsolutePath()});
Matrix expectedAdjacencyMatrix = new DenseMatrix(new double[][] {
{ 0, 1, 1, 0 },
{ 0, 1, 0, 1 },
{ 1, 1, 1, 1 },
{ 0, 1, 0, 0 } });
int numVertices = HadoopUtil.readInt(new Path(tempDir.getAbsolutePath(), AdjacencyMatrixJob.NUM_VERTICES), conf);
assertEquals(4, numVertices);
Matrix actualAdjacencyMatrix = MathHelper.readMatrix(conf, new Path(tempDir.getAbsolutePath(),
AdjacencyMatrixJob.ADJACENCY_MATRIX + "/part-r-00000"), numVertices, numVertices);
StringBuilder info = new StringBuilder();
info.append("\nexpected adjacency matrix\n\n");
info.append(MathHelper.nice(expectedAdjacencyMatrix));
info.append("\nactual adjacency matrix \n\n");
info.append(MathHelper.nice(actualAdjacencyMatrix));
info.append('\n');
log.info(info.toString());
Matrix expectedTransitionMatrix = new DenseMatrix(new double[][] {
{ 0, 0, 0.1875, 0 },
{ 0.375, 0.375, 0.1875, 0.75 },
{ 0.375, 0, 0.1875, 0 },
{ 0, 0.375, 0.1875, 0 } });