This commit is contained in:
2022-02-22 22:10:09 -06:00
parent f8167b0774
commit a7afeb6119
3 changed files with 15 additions and 10 deletions

View File

@@ -4,6 +4,7 @@ import org.jgrapht.graph.SimpleWeightedGraph;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
public abstract class GraphModificationFunctions { public abstract class GraphModificationFunctions {
@@ -18,9 +19,11 @@ public abstract class GraphModificationFunctions {
Integer weight = (int) graph.getEdgeWeight(e); Integer weight = (int) graph.getEdgeWeight(e);
Integer[] edge = {source, target, weight}; Integer[] edge = {source, target, weight};
removedEdges.add(edge); removedEdges.add(edge);
graph.removeEdge(e);
} }
} }
for (Integer[] edge : removedEdges) {
graph.removeEdge(edge[0], edge[1]);
}
return removedEdges; return removedEdges;
} }
@@ -41,9 +44,11 @@ public abstract class GraphModificationFunctions {
Integer weight = (int) graph.getEdgeWeight(e); Integer weight = (int) graph.getEdgeWeight(e);
Integer[] edge = {source, target, weight}; Integer[] edge = {source, target, weight};
removedEdges.add(edge); removedEdges.add(edge);
graph.removeEdge(e);
} }
} }
for (Integer[] edge : removedEdges) {
graph.removeEdge(edge[0], edge[1]);
}
return removedEdges; return removedEdges;
} }
@@ -66,9 +71,11 @@ public abstract class GraphModificationFunctions {
Integer intWeight = (int) graph.getEdgeWeight(e); Integer intWeight = (int) graph.getEdgeWeight(e);
Integer[] edge = {source, target, intWeight}; Integer[] edge = {source, target, intWeight};
removedEdges.add(edge); removedEdges.add(edge);
graph.removeEdge(e);
} }
} }
for (Integer[] edge : removedEdges) {
graph.removeEdge(edge[0], edge[1]);
}
return removedEdges; return removedEdges;
} }

View File

@@ -277,11 +277,9 @@ public class InteractiveInterface {
assert graphFilename != null; assert graphFilename != null;
//check if this is the same graph we already have in memory. //check if this is the same graph we already have in memory.
GraphWithMapData data; GraphWithMapData data;
if(!(graphFilename.equals(BiGpairSEQ.getGraphFilename()) || BiGpairSEQ.getGraph() == null)) { if(!(graphFilename.equals(BiGpairSEQ.getGraphFilename())) || BiGpairSEQ.getGraph() == null) {
BiGpairSEQ.clearGraph(); BiGpairSEQ.clearGraph();
//read object data from file //read object data from file
System.out.println("Reading graph data from file. This may take some time");
System.out.println("File I/O time is not included in results");
GraphDataObjectReader dataReader = new GraphDataObjectReader(graphFilename); GraphDataObjectReader dataReader = new GraphDataObjectReader(graphFilename);
data = dataReader.getData(); data = dataReader.getData();
//set new graph in memory and new filename //set new graph in memory and new filename

View File

@@ -249,13 +249,13 @@ public class Simulator {
double pairingErrorRate = (double) falseCount / (trueCount + falseCount); double pairingErrorRate = (double) falseCount / (trueCount + falseCount);
BigDecimal pairingErrorRateTrunc = new BigDecimal(pairingErrorRate, mc); BigDecimal pairingErrorRateTrunc = new BigDecimal(pairingErrorRate, mc);
//get list of well concentrations //get list of well concentrations
List<Integer> wellPopulations = Arrays.asList(data.getWellConcentrations()); Integer[] wellPopulations = data.getWellConcentrations();
//make string out of concentrations list //make string out of concentrations list
StringBuilder populationsStringBuilder = new StringBuilder(); StringBuilder populationsStringBuilder = new StringBuilder();
populationsStringBuilder.append(wellPopulations.remove(0).toString()); populationsStringBuilder.append(wellPopulations[0].toString());
for(Integer i: wellPopulations){ for(int i = 1; i < wellPopulations.length; i++){
populationsStringBuilder.append(", "); populationsStringBuilder.append(", ");
populationsStringBuilder.append(i.toString()); populationsStringBuilder.append(wellPopulations[i].toString());
} }
String wellPopulationsString = populationsStringBuilder.toString(); String wellPopulationsString = populationsStringBuilder.toString();
//total simulation time //total simulation time