private void fillGraph(double[][] graph, BisectionModel model,
			BisectionInput input, BisectionOutput correct, double lossWeight) {
		int size = input.size();
		for (int paper1 = 0; paper1 < size; ++paper1) {
			for (int paper2 = 0; paper2 < size; ++paper2) {
				// Compute edge weight.
				double w = getEdgeWeight(model, input, paper1, paper2);

				if (Double.isNaN(w)) {
					// Skip inexistent edges.
					graph[paper1][paper2] = w;
					continue;
				}

				// Add margin for incorrect edges.
				if (correct != null
						&& lossWeight != 0d
						&& (correct.isConfirmed(paper1) != correct
								.isConfirmed(paper2))) {
					if (paper1 != 0 && paper2 != 0)
						w += lossWeight;
					else
						/*
						 * Add special margin for incorrect edge to the
						 * artificial DELETED paper.
						 */
						w += lossWeight * deletedPaperLossFactor;
				}

				graph[paper1][paper2] = w;
			}
		}
	}