int depthFirstCutValue(Edge edge, int count) {
		Node n = getTreeTail(edge);
		setTreeMin(n, count);
		int cutvalue = 0;
		int multiplier = (edge.target == n) ? 1 : -1;
		EdgeList list;

		list = n.outgoing;
		Edge e;
		for (int i = 0; i < list.size(); i++) {
			e = list.getEdge(i);
			if (e.tree && e != edge) {
				count = depthFirstCutValue(e, count);
				cutvalue += (e.cut - e.weight) * multiplier;
			} else {
				cutvalue -= e.weight * multiplier;
			}
		}
		list = n.incoming;
		for (int i = 0; i < list.size(); i++) {
			e = list.getEdge(i);
			if (e.tree && e != edge) {
				count = depthFirstCutValue(e, count);
				cutvalue -= (e.cut - e.weight) * multiplier;
			} else {
				cutvalue += e.weight * multiplier;
			}
		}

		edge.cut = cutvalue;
		if (cutvalue < 0)
			spanningTree.add(edge);
		setTreeMax(n, count);
		return count + 1;
	}