Sort vertex lists by vertex label before making adjacency matrix

This commit is contained in:
eugenefischer
2022-09-25 15:54:28 -05:00
parent 4f2fa4cbbe
commit 475bbf3107
2 changed files with 8 additions and 1 deletions

View File

@@ -105,6 +105,7 @@ public class Simulator implements GraphModificationFunctions {
Vertex alphaVertex = new Vertex(SequenceType.CDR3_ALPHA, seq, alphaWellCounts.get(seq), plateAtoVMap.get(seq));
alphaVertices.add(alphaVertex);
}
Collections.sort(alphaVertices);
graphGenerator.first(alphaVertices);
//the list of beta vertices
//List<Integer> betaVertices = new ArrayList<>(plateVtoBMap.keySet());//This will work because LinkedHashMap preserves order of entry
@@ -113,6 +114,7 @@ public class Simulator implements GraphModificationFunctions {
Vertex betaVertex = new Vertex(SequenceType.CDR3_BETA, seq, betaWellCounts.get(seq), plateBtoVMap.get(seq));
betaVertices.add(betaVertex);
}
Collections.sort(betaVertices);
graphGenerator.second(betaVertices);
//use adjacency matrix of weight created previously
graphGenerator.weights(weights);

View File

@@ -1,6 +1,6 @@
import java.io.Serializable;
public class Vertex implements Serializable {
public class Vertex implements Serializable, Comparable<Vertex> {
private SequenceType type;
private Integer vertexLabel;
private Integer sequence;
@@ -89,4 +89,9 @@ public class Vertex implements Serializable {
return sb.toString();
}
@Override
public int compareTo(Vertex other) {
return this.vertexLabel - other.getVertexLabel();
}
}