package org.psjava.ds.graph;

public class TestGraphFactory {

	// TODO rename createDirectedWeighted
	public static MutableDirectedWeightedGraph<Integer, Integer> create(int[][] edata) { 
		MutableDirectedWeightedGraph<Integer, Integer> g = new MutableDirectedWeightedGraph<Integer, Integer>();
		for (int[] e : edata) {
			g.insertVertex(e[0]);
			g.insertVertex(e[1]);
			g.addEdge(e[0], e[1], e[2]);
		}
		return g;
	}

	public static Graph<String, DirectedEdge<String>> createDirected(String[][] edata) {
		MutableDirectedGraph<String> g = MutableDirectedGraph.create();
		for (String[] e : edata) {
			g.insertVertex(e[0]);
			g.insertVertex(e[1]);
			g.addEdge(e[0], e[1]);
		}
		return g;
	}

}

@@ -185,17 +185,16 @@
 edata) %7B
- 
 %0D%0A%09%09Muta
@@ -718,11 +718,373 @@
 %0D%0A%09%7D%0D%0A%0D%0A
+%09public static Graph%3CString, CapacityEdge%3CString, Integer%3E%3E createCapacityGraph(Object%5B%5D%5B%5D edata) %7B%0D%0A%09%09MutableCapacityGraph%3CString, Integer%3E g = MutableCapacityGraph.create();%0D%0A%09%09for (Object%5B%5D e : edata) %7B%0D%0A%09%09%09g.insertVertex((String) e%5B0%5D);%0D%0A%09%09%09g.insertVertex((String) e%5B1%5D);%0D%0A%09%09%09g.addEdge((String) e%5B0%5D, (String) e%5B1%5D, (Integer) e%5B2%5D);%0D%0A%09%09%7D%0D%0A%09%09return g;%0D%0A%09%7D%0D%0A%0D%0A
 %7D%0D%0A

add a test util method