Skip to content

Commit

Permalink
updatet framework and implemented push-relabel algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
sischi committed Jan 15, 2014
1 parent bd7cd00 commit fbf67aa
Show file tree
Hide file tree
Showing 9 changed files with 441 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="lib" path="libs/jung-graph-impl-2.0.1.jar"/>
<classpathentry kind="lib" path="libs/jung-api-2.0.1.jar"/>
<classpathentry kind="lib" path="libs/vigral_plugins_framework.jar"/>
<classpathentry kind="lib" path="libs/vigral_plugins_framework_v0.2.1.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
# Package Files #
*.war
*.ear
/bin
Binary file removed libs/vigral_plugins_framework.jar
Binary file not shown.
Binary file added libs/vigral_plugins_framework_v0.2.1.jar
Binary file not shown.
Binary file added libs/vigral_plugins_framework_v0.2.jar
Binary file not shown.
6 changes: 5 additions & 1 deletion src/BlaAlgorithm.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import java.util.ArrayList;

import de.chiller.vigral.algorithm.AbstractAlgorithm;
import de.chiller.vigral.graph.Edge;
import de.chiller.vigral.graph.ElementType;
import de.chiller.vigral.graph.GraphElement;
import de.chiller.vigral.util.Pair;
Expand All @@ -21,7 +22,10 @@ public ArrayList<Pair<ElementType, String>> getRequirements() {
@Override
public void perform() {
System.out.println("jetz mach ich hier die übelste Welle!");

for(Edge e : mGraph.getEdges()) {
e.setCustomLabel("hallo");
addStep();
}
}

@Override
Expand Down
14 changes: 13 additions & 1 deletion src/DepthFirstSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ public void setRequirements(ArrayList<GraphElement> requirements) {

@Override
public void perform() {

/*
* error state
for(Edge e : mGraph.getEdges()) {
if(!e.isDirected()) {
addStep("this algorithm just works on directed graphs!");
return;
}
}
*/


for(Vertex v : mGraph.getVertices()) {
v.setState(ElementState.UNVISITED);
}
Expand All @@ -52,7 +64,7 @@ public void perform() {
dfb = new HashMap<Vertex, Integer>();
dfe = new HashMap<Vertex, Integer>();
mD = new ArrayList<Edge>();
System.out.println("starte tiefensuche mit Vertex "+ mStartVertex);
System.out.println("start depthfirstsearch with vertex "+ mStartVertex);
depthFirstSearch(mStartVertex);
addStep("red = Tree Edge\ngreen = Back Edge\nblue = Cross Edge\nyellow = Forward Edge");
}
Expand Down
4 changes: 0 additions & 4 deletions src/Dijkstra.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public class Dijkstra extends AbstractAlgorithm {
@Override
public ArrayList<Pair<ElementType, String>> getRequirements() {
ArrayList<Pair<ElementType, String>> requires = new ArrayList<Pair<ElementType, String>>();

requires.add(new Pair<ElementType, String>(ElementType.VERTEX, "Source Vertex"));
requires.add(new Pair<ElementType, String>(ElementType.OPTIONAL_VERTEX, "Destination Vertex"));

Expand Down Expand Up @@ -86,7 +85,6 @@ public void perform() {
showShortestPath();
addStep("show the shortest path");

System.out.println("FINISHED!");
}


Expand All @@ -101,9 +99,7 @@ private void initialize() {
mDistAndPrev.put(v, new Pair<Vertex, Double>(null, Double.POSITIVE_INFINITY));
updateLabel(v);
mQ.add(v);
System.out.println(v.getLabel());
}
System.out.println(mQ);
}


Expand Down
Loading

0 comments on commit fbf67aa

Please sign in to comment.