diff options
| author | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2016-03-21 16:34:06 +0100 |
|---|---|---|
| committer | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2016-03-21 16:34:06 +0100 |
| commit | c03d794605cc158f6e0df2c44b5a014c9aa66e5d (patch) | |
| tree | cfe155587d78881be67d36038cc5d7731815b427 /main | |
| parent | 8511b3af4778da926634742941d7893b46697c51 (diff) | |
| parent | 9cb19346dadb23e81a89cec151d43aa5fa33dc15 (diff) | |
Merge branch 'master' of github.com:manzerbredes/routage-optimiste into develop
Diffstat (limited to 'main')
| -rw-r--r-- | main/Main.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/main/Main.java b/main/Main.java index 51e3c59..c1a4e1c 100644 --- a/main/Main.java +++ b/main/Main.java @@ -5,6 +5,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Set; +import org.graphstream.graph.Edge; import org.graphstream.graph.Graph; import org.graphstream.graph.implementations.SingleGraph; @@ -21,11 +22,14 @@ public class Main { Graph graph = new SingleGraph("Tutorial 1"); graph.addAttribute("ui.stylesheet", "url('resources/style.css')"); + ArrayList<Router> grid=g.getGrid(); for(Router r : grid){ graph.addNode(r.name); } + + ArrayList<Integer> bestLink=g.getLinks().get(g.getBestLinkIndex()); for(Router r : grid){ String current=r.name; HashMap<Router, Integer> relier=r.getLinks(); @@ -36,8 +40,17 @@ public class Main { String currentRouterName=currentRouter.name; try{ //graph.addEdge(current+currentRouter, current, currentRouter).addAttribute("ui.style", "fill-color: rgb(0,100,255);"); - graph.addEdge(current+currentRouterName, current, currentRouterName).setAttribute("ui.label", relier.get(currentRouter)); + + if(g.isEdgeOfLink(bestLink, r, currentRouter)){ + Edge toAdd=graph.addEdge(current+currentRouterName, current, currentRouterName); + toAdd.setAttribute("ui.label", relier.get(currentRouter)); + toAdd.setAttribute("ui.style", "fill-color:red;"); + + }else{ + graph.addEdge(current+currentRouterName, current, currentRouterName).setAttribute("ui.label", relier.get(currentRouter)); + } + } @@ -48,6 +61,8 @@ public class Main { } } + g.printLinkWeight(); + graph.display(); } } |
