// Path: src/main/java/com/maxdemarzi/processing/NodeCounter.java
// public class NodeCounter {
//     public int getNodeCount(GraphDatabaseService db) {
//         Result result = db.execute( "MATCH (n) RETURN max(id(n)) AS maxId" );
//         return ((Number) result.next().get( "maxId" )).intValue() + 1;
// 
//     }
//     public int getRelationshipCount(GraphDatabaseService db) {
//         Result result = db.execute( "MATCH ()-[r]->() RETURN max(id(r)) AS maxId" );
//         return ((Number) result.next().get( "maxId" )).intValue() + 1;
//     }
// }


import com.maxdemarzi.processing.NodeCounter;
import it.unimi.dsi.fastutil.longs.Long2DoubleMap;
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap;
import it.unimi.dsi.fastutil.longs.Long2LongMap;
import it.unimi.dsi.fastutil.longs.Long2LongOpenHashMap;
import org.neo4j.graphdb.*;
package com.maxdemarzi.processing.pagerank;


/**
 * @author mh
 * @since 28.03.15
 */
public class PageRankMapStorage implements PageRank {
    private final GraphDatabaseService db;
    private final int nodes;
    private Long2DoubleMap dstMap;

    public PageRankMapStorage(GraphDatabaseService db) {
        this.db = db;
// Path: src/main/java/com/maxdemarzi/processing/NodeCounter.java
// public class NodeCounter {
//     public int getNodeCount(GraphDatabaseService db) {
//         Result result = db.execute( "MATCH (n) RETURN max(id(n)) AS maxId" );
//         return ((Number) result.next().get( "maxId" )).intValue() + 1;
// 
//     }
//     public int getRelationshipCount(GraphDatabaseService db) {
//         Result result = db.execute( "MATCH ()-[r]->() RETURN max(id(r)) AS maxId" );
//         return ((Number) result.next().get( "maxId" )).intValue() + 1;
//     }
// }


// Path: src/main/java/com/maxdemarzi/processing/pagerank/PageRankMapStorage.java
import com.maxdemarzi.processing.NodeCounter;
import it.unimi.dsi.fastutil.longs.Long2DoubleMap;
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap;
import it.unimi.dsi.fastutil.longs.Long2LongMap;
import it.unimi.dsi.fastutil.longs.Long2LongOpenHashMap;
import org.neo4j.graphdb.*;

package com.maxdemarzi.processing.pagerank;


/**
 * @author mh
 * @since 28.03.15
 */
public class PageRankMapStorage implements PageRank {
    private final GraphDatabaseService db;
    private final int nodes;
    private Long2DoubleMap dstMap;

    public PageRankMapStorage(GraphDatabaseService db) {
        this.db = db;
        this.nodes = new NodeCounter().getNodeCount(db);