import java.util.ArrayList;
import java.io.*;
import graph.*;
public class PrintWeights {
    public static void main(String argv[]) {
	Graph graph = null;
	int K = 0;
	if (argv.length < 1) {
	    System.out.println("usage: java PrintWeights filename");
	    return;
	} else {
	    try {
		graph = new Graph(new FileInputStream(argv[0]),"n","e");
	    } catch (Exception e) {
		System.out.println(e);
		return;
	    }
	}
	ArrayList nodes = graph.getNodes();
	ArrayList edges = graph.getEdges();
	
	System.out.println("Graph with " + nodes.size() + 
			   " nodes and " + edges.size() + " edges");
	System.out.println("edge weights:");

	for (int i=0; i < edges.size(); i++) {
	    Edge e = (Edge)edges.get(i); 
	    System.out.println(e.label() + " " + e.getInt("weight"));
	}
    }
}
