Here you can find the source of loadRealDataGraphFromEmbers(String fileName, String splitter)
public static HashMap<String, Double> loadRealDataGraphFromEmbers(String fileName, String splitter)
//package com.java2s; //License from project: Open Source License import java.io.*; import java.util.*; public class Main { public static HashMap<String, Double> loadRealDataGraphFromEmbers(String fileName, String splitter) { HashMap<String, Double> graph = new HashMap<String, Double>(); BufferedReader br = null; try {/*from w ww . java 2 s . c o m*/ String sCurrentLine; br = new BufferedReader(new FileReader(fileName)); while ((sCurrentLine = br.readLine()) != null) { String[] str = sCurrentLine.split(splitter); String edgeName = str[0]; Double distance = Double.parseDouble(str[1]); graph.put(edgeName, distance); } if (!graph.isEmpty()) { System.out.println("total number of the graph edges is : " + graph.size()); } else { System.out.println("there does not exist any information in the file!!"); System.exit(0); } } catch (IOException e) { e.printStackTrace(); } finally { try { if (br != null) br.close(); } catch (IOException ex) { ex.printStackTrace(); } } return graph; } }