Skip to content

Commit

Permalink
method bottleNecks completed
Browse files Browse the repository at this point in the history
  • Loading branch information
BuZZ-dEE committed Jan 27, 2011
1 parent c233368 commit ee28673
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions DiePaten.java
Expand Up @@ -41,36 +41,38 @@ protected void handle_flow() {
System.err.println("flow");
Edge nextEdge = null;

nextEdge = bottleNecks();
//nextEdge = bottleNecks();
// nextEdge=maxcapacity();

// Send final reply indicating that we won't change our mind any more.
sendReply(nextEdge, true);
}


// Engstellen im Graphen finden
// Kapazitaeten auf eins setzten und dann den Mincut finden
private Edge bottleNecks() {
Edge nextEdge = null;
int zero = 0;
int groesse = this.capacityMatrix.length;
int tempMatrix[][] = new int[groesse][groesse];
/**
* method to find the bottlenecks in the graph. every edge is set to 1 before
* @return nextEges, the list with the bottlenecks-edges
*/
private ArrayList<Edge> bottleNecks() {
ArrayList<Edge> nextEdges = null;

int tempMatrix[][] = new int[size][size];

for (int l = 0; l < groesse; l++) {
for (int k = 0; k < groesse; k++) {
for (int l = 0; l < size; l++) {
for (int k = 0; k < size; k++) {
int temp = Integer.parseInt(capacityMatrix[l][k]);
if (temp > 0 && adjacencyMatrix[l][k] == UNSELECTED_EDGE) {
tempMatrix[l][k] = 1;
} else {
tempMatrix[l][k] = 0;
}
}
}
}

//tempMatrix, getMincut
nextEdges = minCut();

return nextEdge;
return nextEdges;
}

private Edge maxcapacity() {
Expand Down Expand Up @@ -166,6 +168,7 @@ public ArrayList<Integer> sinkSet() {
return sink_Set;
}


/**
* determine the edges from source_set to sink_set
* @return the min-cut
Expand Down

0 comments on commit ee28673

Please sign in to comment.