public static void dij(Graph g, Vertex v) {

		Comparator<Vertex> rules = new Comparator<Vertex>() {

			public int compare(Vertex v1, Vertex v2) {
				double a = v1.value;
				double b = v2.value;
				if (a >= b)
					return 1;
				else
					return -1;
			}
		};
		PriorityQueue<Vertex> q = new PriorityQueue<Vertex>(5, rules);
		ArrayList<Vertex> node = g.getVertex();
		for (int i = 0; i < node.size(); i++) {
			q.add(node.get(i));
			node.get(i).prev = null;
		}

		ArrayList<Vertex> output = new ArrayList<Vertex>();
		while (!q.isEmpty()) {
			Vertex u = q.remove();
			output.add(u);
			ArrayList<Vertex> vertexs = findVertex(u, g.edges);
			for (int i = 0; i < vertexs.size(); i++) {
				Vertex vs = vertexs.get(i);
				double len = getDistance(u, vs, g.edges);
				if (vs.value > u.value + len) {
					vs.value = u.value + len;
					vs.prev = u;
				}
			}
		}

		for (int i = 0; i < output.size(); i++) {
			Vertex n = output.get(i);
			System.out.print("vertex:" + n.id + " weight " + n.value + "");
			if (n.prev != null) {
				System.out.print(" prev:"+n.prev.id  );
			}
			System.out.println();
		}
	}