private PotentialPair calculateBestNeighbor(Set<FunctionNode> aNeighbors,
			Set<FunctionNode> bNeighbors, double confResult) {
		ArrayList<PotentialPair> potentialPairs = new ArrayList<PotentialPair>();
		PotentialPair bestPair = PotentialPair.EMPTY_PAIR;
		int bestCount = 0;			// Number of pairs with the same (currently) best score

		// CRITICAL LOOP
		for (FunctionNode relative : aNeighbors) {						// For every function in the source neighborhood
			if (relative.isAcceptedMatch()) {
				continue;
			}
			double bestAdjustedScore = 0;								// Best score you're seeing for just this relative.
			double relSum = 0;											// Sum of relative's scores for associates...for normalizing.
			double bestOriginalScore = 0;								// So that we can recover the entry without computation.
			FunctionNode bestRelAssoc = null;							// The highest scoring associate
			// CRITICAL INNER LOOP
			Iterator<Entry<FunctionNode, FunctionPair>> iter = relative.getAssociateIterator();
			while (iter.hasNext()) {									// Run through every putative match to -relative-
				Entry<FunctionNode, FunctionPair> entry = iter.next();
				final FunctionNode associate = entry.getKey();
				final double value = entry.getValue().getConfResult();
				if (bNeighbors.contains(associate)) {					// Does the dest side of the match lie in dest neighborhood
					double entryAdjusted = adjustConfidenceScore(value, relative, associate);
					relSum += entryAdjusted;							// Keep track of score sum for normalization
					if (entryAdjusted >= bestAdjustedScore) {			// Keep track of highest scoring pair
						bestAdjustedScore = entryAdjusted;
						bestRelAssoc = associate;
						bestOriginalScore = value;
					}
				}
			}

			if (relSum > 0) {
				// Compute a final score that takes into account the dimensions of the neighborhoods
				// and scores of other potential pairs across the neighborhoods
				double tempMax = bNeighbors.size() * (bestOriginalScore + confResult) *
					bestAdjustedScore / relSum;

				PotentialPair newPair = new PotentialPair(relative, bestRelAssoc, tempMax);
				potentialPairs.add(newPair);
				if (tempMax > bestPair.getScore()) {				// We have seen a new maximum.
					bestPair = newPair;								// Keep track of the new best
					bestCount = 1;									// Restart the counter
				}
				else if (tempMax == bestPair.getScore()) {			// A tie score with the current best
					bestCount += 1;
				}

			}
		}

		if (bestCount == 0 || bestPair.getScore() == 0) {
			return PotentialPair.EMPTY_PAIR;		// The default null object passed for nothing found.
		}

		if (bestCount == 1) {						// There is a unique best entry.  Use it.
			return bestPair;
		}

		return findFirstUnconflictedPair(potentialPairs);		// The best pair is a tie, we need to go deeper into the list
	}
Given matching neighborhoods, look at "matrix" of scores for pairs across them.
Return the most likely pair.
@param aNeighbors is the first neighborhood
@param bNeighbors is the second neighborhood
@param confResult is the confidence score associated with the accepted match
@return the most likely pair as a PotentialPair
Ghidra/Features/VersionTrackingBSim/src/main/java/ghidra/feature/vt/api/BSimProgramCorrelatorMatching.java