Skip to content

Commit

Permalink
Added clean.
Browse files Browse the repository at this point in the history
First release
  • Loading branch information
besil committed Mar 26, 2015
1 parent 09cbe69 commit 90dc855
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/main/java/com/besil/neo4jsna/engine/GraphAlgoEngine.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.besil.neo4jsna.engine;

import java.util.logging.Level;
import java.util.logging.Logger;

import org.neo4j.cypher.javacompat.ExecutionEngine;
Expand All @@ -16,7 +17,7 @@
import com.besil.neo4jsna.utils.Timer;

public class GraphAlgoEngine {
private final Logger log = Logger.getLogger(GraphAlgoEngine.class.getName());
private Logger log = Logger.getLogger(GraphAlgoEngine.class.getName());
protected GraphDatabaseService graph;
protected ExecutionEngine engine;

Expand Down Expand Up @@ -98,5 +99,9 @@ public void clean(VertexAlgorithm algo) {
tx.success();
}
}


public void disableLogging() {
this.log.setLevel(Level.OFF);
}

}
7 changes: 5 additions & 2 deletions src/main/java/com/besil/neo4jsna/main/Neo4jSNAMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@

public class Neo4jSNAMain {
public static void main(String[] args) {
String cinea = "data/tmp/cineasts";
String database = args.length > 0 ? args[0] : "data/tmp/cineasts";

String path = cinea;
String path = database;
long nodeCount, relsCount;

// Open a database instance
Expand All @@ -41,6 +41,8 @@ public static void main(String[] args) {

// Declare the GraphAlgoEngine on the database instance
GraphAlgoEngine engine = new GraphAlgoEngine(g);
if( args.length > 1 && args[1].equals("off") )
engine.disableLogging();

LabelPropagation lp = new LabelPropagation();
// Starts the algorithm on the given graph g
Expand Down Expand Up @@ -68,6 +70,7 @@ public static void main(String[] args) {
PageRank pr = new PageRank(g);
engine.execute(pr);
Long2DoubleMap ranks = pr.getResult();
engine.clean(pr);
Optional<Double> res = ranks.values().parallelStream().reduce( (x, y) -> x + y );
System.out.println("Check PageRank sum is 1.0: "+ res.get());

Expand Down

0 comments on commit 90dc855

Please sign in to comment.