From 48eb5d0266cd5859b632d5a6d6ff65be5293da3e Mon Sep 17 00:00:00 2001 From: Konrad Krauth <2120694@stud.hs-mannheim.de> Date: Tue, 15 Oct 2024 10:32:38 +0200 Subject: [PATCH] mehrere Verbesserungen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - "Fulkersen" zu "Fulkerson" - "Flüsse zurücksetzen"-funktion - farbliche Markierungen in Ansicht "Kapazitäten und Flüsse". --- ford-fulkerson.html | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/ford-fulkerson.html b/ford-fulkerson.html index 7f33eb0..35fd506 100644 --- a/ford-fulkerson.html +++ b/ford-fulkerson.html @@ -94,7 +94,7 @@ function draw(){ } }else if(shownEdges=="capacity_and_flows"){ if(edgesCapacity[vertex.name][otherVertex.name]>0){ - drawEdge(vertex,otherVertex,getEdge(edgesFlow,vertex.name,otherVertex.name)+"/"+edgesCapacity[vertex.name][otherVertex.name],"black","white"); + drawEdge(vertex,otherVertex,getEdge(edgesFlow,vertex.name,otherVertex.name)+"/"+edgesCapacity[vertex.name][otherVertex.name],"black",edgesFlow[vertex.name][otherVertex.name]>0?(edgesFlow[vertex.name][otherVertex.name]==edgesCapacity[vertex.name][otherVertex.name]?"#ff88ff":"#8888ff"):"white"); } } } @@ -189,6 +189,21 @@ function parseGraph(){ }; draw(); } +function resetFlows(){ + done=false; + iterations=0; + totalFlow=0; + for(let vertex in verticesMap){ + edgesFlow[vertex]={}; + } + calculatePossibleNextSteps(); + draw(); + statusSim.innerText="Graph zurückgesetzt"; + if(bfs()==undefined){ + statusSim.innerText+="- Es gibt von Anfang an keinen augmentierenden Pfad, der Algorithmus braucht nicht angewandt zu werden."; + done=true; + }; +} function bfs(){ let searches=[["s"]]; let visitedVertices=["s"]; @@ -388,7 +403,7 @@ body {
-