@@ -0,0 +1,1614 @@
+package codesquad;%0A%0Aimport java.util.HashMap;%0A%0Apublic class SimpleGraph %7B%0A%09%0A%09private HashMap%3CInteger, Edge%3E vertexList;%0A%09%0A%09public SimpleGraph() %7B%0A%09%09vertexList = new HashMap%3CInteger, Edge%3E();%0A%09%7D%0A%09%0A%09public void createVertex(int value) %7B%0A%09%09Edge edge = new Edge(value,0);%0A%09%09vertexList.put(value, edge);%0A%09%7D%0A%09%0A%09public void insertEdge(int v1, int v2, double weight) %7B%0A        //TODO implement%0A%09%09Edge curr = vertexList.get(v1);%0A%09%09Edge prev = curr;%0A%09%09while (curr != null )%0A%09%09%7B%0A%09%09%09if (curr.value == v2) %7B%0A%09%09%09%09curr.weight = weight;%0A%09%09%09%09return;%0A%09%09%09%7D%0A%09%09%09prev = curr;%0A%09%09%09curr = curr.next;%09%09%09%0A%0A%09%09%7D%0A%09%09%0A%09%09Edge newEdge = new Edge(v2, weight);%0A%09%09prev.next = newEdge;%0A%09%09%0A%09%7D%0A%09%0A%09public boolean removeEdge(int v1, int v2) %7B%0A%09%09//TODO: implement%0A%09%09return false;%0A%09%7D%0A%09%0A%09public void printList(int value) %7B%0A        Edge curr = vertexList.get(value).next;%0A        System.out.print(value + %22: %22);%0A        %0A        while(curr != null) %7B%0A        %09%09System.out.printf(%22%25d (%25.2f), %22,curr.value, curr.weight);%0A        %09%09curr = curr.next;%0A        %7D%0A        System.out.println();%0A%09%7D%0A%09%0A%09class Edge %7B%0A%09%09int value; //vertex%0A%09%09boolean visited;%0A%09%09double weight;%0A%09%09Edge next = null;%0A%09%09%0A%09%09Edge(int v, double w) %7B%0A%09%09%09this.value = v;%0A%09%09%09this.weight = w;%0A%09%09%7D%0A%09%7D%0A%09%0A%09public static void main(String%5B%5D args) %7B%0A%09%09SimpleGraph graph = new SimpleGraph();%0A%09%09for (int i = 1; i %3C= 5; i++) %7B%0A%09%09%09graph.createVertex(i);%0A%09%09%7D%0A%09%09graph.insertEdge(1, 2, 1.0);%0A%09%09graph.insertEdge(2, 3, 1.0);%0A%09%09graph.insertEdge(2, 5, 3.2);%0A%09%09graph.insertEdge(3, 4, 4.5);%0A%09%09graph.insertEdge(3, 4, 4.5);%0A%09%09graph.insertEdge(4, 1, 2.8);%0A%09%0A%09%09for (int i = 1; i %3C= 5; i++) %7B%0A%09%09%09graph.printList(i);%09%0A%09%09%7D%0A%09%7D%0A%7D

Add SimpleGraph