final PriorityQueue<EdgePair> pq =
new PriorityQueue<EdgePair>(numComparisons);
Object key = WORK_QUEUE.registerTaskGroup(graph.order());
IntIterator iter1 = graph.vertices().iterator();
while (iter1.hasNext()) {
final int v1 = iter1.nextInt();
WORK_QUEUE.add(key, new Runnable() {
public void run() {
veryVerbose(LOGGER, "Computing similarities for " +
"vertex %d", v1);
//Set<E> adjList = graph.getAdjacencyList(v1);
IntSet neighbors = graph.getNeighbors(v1);
// Create a thread-local PriorityQueue that will hold
// the edge similarities for this vertex. Once all the
// simialrites have been computed, we can update the
// thread-shared queue with minimal locking
PriorityQueue<EdgePair> localQ =
new PriorityQueue<EdgePair>(neighbors.size());
IntIterator it1 = neighbors.iterator();
// for (E e1 : adjList) {
while (it1.hasNext()) {
// int v2 = (e1.to() == v1) ? e1.from() : e1.to();
int v2 = it1.nextInt();
IntIterator it2 = neighbors.iterator();
// for (Edge e2 : graph.getAdjacencyList(v1)) {
while (it2.hasNext()) {
int v3 = it2.nextInt();
if (v2 == v3)
break;
// if (e1.equals(e2))
// break;
// int v3 = (e2.to() == v1) ? e2.from() : e2.to();