Here you can find the source of loadQueryNodeInfo(String input_file)
public static String loadQueryNodeInfo(String input_file) throws Exception
//package com.java2s; /*********************************************************************** PEGASUS: Peta-Scale Graph Mining System Authors: U Kang, Duen Horng Chau, and Christos Faloutsos This software is licensed under 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.//from w w w . ja v a 2s.c om ------------------------------------------------------------------------- File: PegasusUtils.java - Common utility classes and functions Version: 2.0 ***********************************************************************/ import java.io.*; public class Main { public static String loadQueryNodeInfo(String input_file) throws Exception { String cur_line = ""; int query_count = 0; long[] query_nodes = null; double[] query_weights = null; double sum_weights = 0; String query_str = ""; try { BufferedReader in = new BufferedReader(new InputStreamReader( new FileInputStream(input_file), "UTF8")); while (cur_line != null) { cur_line = in.readLine(); if (cur_line.length() > 0) { String[] tokens = cur_line.split("\t"); query_nodes[query_count] = Long.parseLong(tokens[0]); query_weights[query_count] = Double .parseDouble(tokens[1]); sum_weights += query_weights[query_count]; query_count++; } } } catch (UnsupportedEncodingException e) { } catch (IOException e) { } System.out.println("loadQueryNodeInfo: total " + query_count + " queries read."); // normalize for (int i = 0; i < query_count; i++) { query_weights[i] /= sum_weights; query_str += ("" + query_nodes[i] + " " + query_weights[i]); if (i != query_count - 1) query_str += " "; } return query_str; } }