graph.addEdge(2, 3);
graph.addEdge(2, 5);
graph.addEdge(2, 7);
graph.addEdge(3, 6);
double[] weights = new double[] { 1, 1, 10, 3.4, 1, 1, 1, 1 };
IntDoublePair[] nodesAsPairs = new IntDoublePair[8];
for (int i = 0; i < nodesAsPairs.length; i++) {
nodesAsPairs[i] = new IntDoublePair(i, weights[i]);
}