iterate over vertex wells correctly
This commit is contained in:
@@ -148,17 +148,23 @@ public class Simulator implements GraphModificationFunctions {
|
|||||||
}
|
}
|
||||||
betaVertices.forEach(graph::addVertex);
|
betaVertices.forEach(graph::addVertex);
|
||||||
//add edges
|
//add edges
|
||||||
for(Vertex alpha: alphaVertices){
|
for(Vertex a: alphaVertices) {
|
||||||
for(Vertex beta: betaVertices) {
|
for(Integer well: a.getRecord().getWells()) {
|
||||||
Set<Integer> sharedWells = alpha.getRecord().getWells();
|
for (Vertex b: betaVertices) {
|
||||||
sharedWells.retainAll(beta.getRecord().getWells());
|
if (b.getRecord().isInWell(well)) {
|
||||||
if(!sharedWells.isEmpty()) {
|
DefaultWeightedEdge edge = graph.getEdge(a, b);
|
||||||
DefaultWeightedEdge edge = graph.addEdge(alpha, beta);
|
if (edge == null) {
|
||||||
graph.setEdgeWeight(edge, sharedWells.size());
|
edge = graph.addEdge(a, b);
|
||||||
|
graph.setEdgeWeight(edge, 1.0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
double weight = graph.getEdgeWeight(edge);
|
||||||
|
graph.setEdgeWeight(edge, weight + 1.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(verbose){System.out.println("Graph created");}
|
if(verbose){System.out.println("Graph created");}
|
||||||
//stop timing
|
//stop timing
|
||||||
Instant stop = Instant.now();
|
Instant stop = Instant.now();
|
||||||
|
|||||||
Reference in New Issue
Block a user