import java.util.*; public class Node implements Comparable { int id; double value; Node via; ArrayList edges; public Node(int id) { this.id = id; this.value = Double.MAX_VALUE; this.via = null; this.edges = new ArrayList(); } public int compareTo(Object o) { if (! (o instanceof Node)) throw new IllegalArgumentException("Node needed"); Node x = (Node)o; return (this.value > x.value)? 1 : ((this.value < x.value)? (-1) : 0); } public String toString() { return "node#"+id+"["+((via==null)? "null":via.id)+","+value+"]"; } public static String toString(Node[] a) { StringBuilder sb = new StringBuilder(); sb.append("["); for (int i=0; i