Progress.setDisplayName(progressTicket, "MCL Clustering");
HashMap<Integer, Node> nodeMap = new HashMap<Integer, Node>();
HashMap<Node, Integer> intMap = new HashMap<Node, Integer>();
Graph graph = graphModel.getGraphVisible();
graph.readLock();
//Load matrix
SparseMatrix matrix = new SparseMatrix();
int nodeId = 0;
for (Edge e : graph.getEdges()) {
Node source = e.getSource();
Node target = e.getTarget();
Integer sourceId;
Integer targetId;
if ((sourceId = intMap.get(source)) == null) {
sourceId = nodeId++;
intMap.put(source, sourceId);
nodeMap.put(sourceId, source);
}
if ((targetId = intMap.get(target)) == null) {
targetId = nodeId++;
intMap.put(target, targetId);
nodeMap.put(targetId, target);
}
double weight = e.getWeight();
matrix.add(sourceId, targetId, weight);
if (cancelled) {
graph.readUnlockAll();
return;
}
}
graph.readUnlock();
matrix = matrix.transpose();
matrix = run(matrix, maxResidual, gammaExp, loopGain, zeroMax);
if (cancelled) {