package flow;

import java.util.Collection;
import java.util.HashMap;

import util.Log;
import graph.Arc;
import graph.Graph;
import graph.GraphReader;
import graph.GraphUtil;
import graph.Vertex;

/**
 * The Class Main.
 */
public class Main {
	
	/**
	 * The main method.
	 *
	 * @param args the arguments
	 */
	public static void main(String[] args) {
		
		int n = args.length;
		if (0 == n || n > 2) {
			Log.p("Usage: java -jar vmaxflow.jar <filename> <outputfilename>");
			return;
		}
		
		String fileName = args[0];
		String output = "maxflow.txt";
		if (2 == n) {
			output = args[1];
		}
		
		GraphReader gr = new GraphReader();
		gr.readFile(fileName);
		Graph g = gr.getGraph();
		Vertex s = gr.getSource();
		Vertex t = gr.getSink();
		Log.p(g.toString());
		
		PushRelabelAlgo algo = new PushRelabelAlgo(g, s, t);
		HashMap<Arc, Double> flow = algo.computeMaxFlow();
		Log.ps("\nMax flow = " + algo.getMaxFlowValue());
		
		Log.p("");
		GraphUtil.writeOutputFile(output, g, flow);
	}
	
}

@@ -12,81 +12,8 @@
 w;%0A%0A
-import java.util.Collection;%0Aimport java.util.HashMap;%0A%0Aimport util.Log;%0A
 impo
@@ -118,16 +118,61 @@
 ertex;%0A%0A
+import java.util.HashMap;%0A%0Aimport util.Log;%0A%0A
 /**%0A * T

Update import in Main