public double fordFulkerson(Node from, Node to) {
		G g = new G(this); /*G flow = new G();
		for (Node n: nodes) flow.add(n);
		for (Node f: nodes) for (Node t: edges.get(f).keySet()) flow.add(f, t, 0, false);*/
		double total = 0;
		while (true) {
			State p = g.bfs(from, to); if (p == null) break;
			LinkedList<Node> l = p.backtrack();
			double min = Double.MAX_VALUE;
			for (int i = 1; i < l.size(); i++) min = Math.min(min, g.edge(l.get(i-1), l.get(i)));
			for (int i = 1; i < l.size(); i++) {
				Node f = l.get(i-1), t = l.get(i);
				double ft = (g.has(f, t) ? g.edge(f, t) : 0) - min;
				double tf = (g.has(t, f) ? g.edge(t, f) : 0) + min;
				if (ft == 0) g.remove(f, t); else g.edge(f, t, ft);
				if (tf == 0) g.remove(t, f); else g.edge(t, f, tf);
				//flow.edge(f, t, flow.edge(f, t) + min);
				//flow.edge(t, f, flow.edge(t, f) - min);
			}
			total += min;
		}
		return total;
		//return flow;
	}