Java tutorial
//package com.java2s; import java.util.Map; public class Main { public static void dumpWeightedGraph(Map<Integer, Map<Integer, Integer>> weightedGraph) { System.out.println("Start of dumping weighted graph... graphSize: " + weightedGraph.size()); for (int vertexId : weightedGraph.keySet()) { // System.out.println("vertexId: " + vertexId); Map<Integer, Integer> weightedNeighbors = weightedGraph.get(vertexId); for (int neighborId : weightedNeighbors.keySet()) { if (weightedNeighbors.get(neighborId) > 1) { System.out.println( "w(" + vertexId + ", " + neighborId + "): " + weightedNeighbors.get(neighborId)); } } } System.out.println("End of dumping weighted graph..."); } }