// Path: src/main/java/org/apache/jena/grande/MemoryUtil.java
// public class MemoryUtil {
// 
// 	private static final Logger LOG = LoggerFactory.getLogger(MemoryUtil.class);
// 	
// 	public static long getUsedMemory() {
// 		System.gc() ;
// 		System.gc() ;
// 		System.gc() ;
// 		
// 		return ( Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory() ) / ( 1024 * 1024 ) ;
// 	}
// 	
// 	public static void printUsedMemory() {
// 		LOG.debug (String.format("memory used is %d MB", getUsedMemory())) ;
// 	}
// 	
// }


import java.io.BufferedReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.StringTokenizer;
import org.apache.jena.grande.MemoryUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.jena.grande.giraph.pagerank.memory;



public class PlainPageRank {

	private static final Logger LOG = LoggerFactory.getLogger(PlainPageRank.class);
	
	private Graph graph = new Graph() ;
	private Map<String, Double> pagerank_current = new HashMap<String, Double>() ; 
	private Map<String, Double> pagerank_new = new HashMap<String, Double>() ; 
	
	private double dumping_factor ;
	private int iterations ;
	
	public PlainPageRank ( BufferedReader in, double dumping_factor, int iterations ) {
		this.dumping_factor = dumping_factor ;
		this.iterations = iterations ;		
		
		try {
// Path: src/main/java/org/apache/jena/grande/MemoryUtil.java
// public class MemoryUtil {
// 
// 	private static final Logger LOG = LoggerFactory.getLogger(MemoryUtil.class);
// 	
// 	public static long getUsedMemory() {
// 		System.gc() ;
// 		System.gc() ;
// 		System.gc() ;
// 		
// 		return ( Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory() ) / ( 1024 * 1024 ) ;
// 	}
// 	
// 	public static void printUsedMemory() {
// 		LOG.debug (String.format("memory used is %d MB", getUsedMemory())) ;
// 	}
// 	
// }


// Path: src/main/java/org/apache/jena/grande/giraph/pagerank/memory/PlainPageRank.java
import java.io.BufferedReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.StringTokenizer;
import org.apache.jena.grande.MemoryUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.jena.grande.giraph.pagerank.memory;



public class PlainPageRank {

	private static final Logger LOG = LoggerFactory.getLogger(PlainPageRank.class);
	
	private Graph graph = new Graph() ;
	private Map<String, Double> pagerank_current = new HashMap<String, Double>() ; 
	private Map<String, Double> pagerank_new = new HashMap<String, Double>() ; 
	
	private double dumping_factor ;
	private int iterations ;
	
	public PlainPageRank ( BufferedReader in, double dumping_factor, int iterations ) {
		this.dumping_factor = dumping_factor ;
		this.iterations = iterations ;		
		
		try {
			MemoryUtil.printUsedMemory() ;