diff options
| author | pjungeblut <paul.jungeblut@gmail.com> | 2014-10-30 19:26:30 +0100 |
|---|---|---|
| committer | pjungeblut <paul.jungeblut@gmail.com> | 2014-10-30 19:26:30 +0100 |
| commit | 07a1c4f87dcccbfe2ca4fbbc100a07c9be801502 (patch) | |
| tree | b69d372db88dadb7cb755ca4cdaccc7000d2c9c3 /maxFlow | |
| parent | 0550627fade1c01d6b90907de198ca13d34db9d9 (diff) | |
SCCS added, seperated from 2-SAT
Diffstat (limited to 'maxFlow')
| -rw-r--r-- | maxFlow/edmondsKarp.cpp | 34 | ||||
| -rw-r--r-- | maxFlow/maxFlow.tex | 4 | ||||
| -rw-r--r-- | maxFlow/q.log | 25 |
3 files changed, 0 insertions, 63 deletions
diff --git a/maxFlow/edmondsKarp.cpp b/maxFlow/edmondsKarp.cpp deleted file mode 100644 index ccfb1d2..0000000 --- a/maxFlow/edmondsKarp.cpp +++ /dev/null @@ -1,34 +0,0 @@ -int s, t, f; //source, target, single flow -int res[MAX_V][MAX_V]; //adj-matrix -vector< vector<int> > adjList; -int p[MAX_V]; //bfs spanning tree - -void augment(int v, int minEdge) { - if (v == s) { f = minEdge; return; } - else if (p[v] != -1) { - augment(p[v], min(minEdge, res[p[v]][v])); - res[p[v]][v] -= f; res[v][p[v]] += f; -}} - -nt maxFlow() { //first inititalize res, adjList, s and t - int mf = 0; - while (true) { - f = 0; - bitset<MAX_V> vis; vis[s] = true; - queue<int> q; q.push(s); - memset(p, -1, sizeof(p)); - while (!q.empty()) { //BFS - int u = q.front(); q.pop(); - if (u == t) break; - for (int j = 0; j < (int)adjList[u].size(); j++) { - int v = adjList[u][j]; - if (res[u][v] > 0 && !vis[v]) { - vis[v] = true; q.push(v); p[v] = u; - }}} - - augment(t, INF); //add found path to max flow - if (f == 0) break; - mf += f; - } - return maxFlow; -}
\ No newline at end of file diff --git a/maxFlow/maxFlow.tex b/maxFlow/maxFlow.tex deleted file mode 100644 index a88e5ff..0000000 --- a/maxFlow/maxFlow.tex +++ /dev/null @@ -1,4 +0,0 @@ -\section{Max Flows} -\subsection{\textsc{Edmonds-Karp}-Algorithmus} - -\lstinputlisting{maxFlow/edmondsKarp.cpp}
\ No newline at end of file diff --git a/maxFlow/q.log b/maxFlow/q.log deleted file mode 100644 index 2a742c3..0000000 --- a/maxFlow/q.log +++ /dev/null @@ -1,25 +0,0 @@ -This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) (format=pdflatex 2014.5.4) 25 OCT 2014 13:42 -entering extended mode - restricted \write18 enabled. - %&-line parsing enabled. -**tcr.tex -(/usr/share/texlive/texmf-dist/tex/latex/tools/q.tex -LaTeX2e <2011/06/27> -Babel <3.9h> and hyphenation patterns for 7 languages loaded. -File ignored -) -! Emergency stop. -<*> tcr.tex - -*** (job aborted, no legal \end found) - - -Here is how much of TeX's memory you used: - 7 strings out of 494976 - 248 string characters out of 6179138 - 46219 words of memory out of 5000000 - 3331 multiletter control sequences out of 15000+600000 - 3640 words of font info for 14 fonts, out of 8000000 for 9000 - 14 hyphenation exceptions out of 8191 - 5i,0n,1p,87b,8s stack positions out of 5000i,500n,10000p,200000b,80000s -! ==> Fatal error occurred, no output PDF file produced! |
