summaryrefslogtreecommitdiff
path: root/graph
diff options
context:
space:
mode:
authorPaul Jungeblut <paul.jungeblut@gmail.com>2016-10-02 19:07:44 +0200
committerPaul Jungeblut <paul.jungeblut@gmail.com>2016-10-02 19:07:44 +0200
commit32f50710052fdb6f260c668ae9ebd649b010ac88 (patch)
tree3bab0b9fcb34862df62d9c21e7a30984d70b5211 /graph
parent90c000fb569c803ee656ee674230f6665c097dd5 (diff)
Deleted useless sentence for minimum spanning trees.
Diffstat (limited to 'graph')
-rw-r--r--graph/graph.tex20
-rw-r--r--graph/kruskal.cpp5
2 files changed, 8 insertions, 17 deletions
diff --git a/graph/graph.tex b/graph/graph.tex
index 4a617a8..a3ae298 100644
--- a/graph/graph.tex
+++ b/graph/graph.tex
@@ -1,8 +1,6 @@
\section{Graphen}
\subsection{Minimale Spannbäume}
-% Add an implementation.
-Benutze Algorithmus von \textsc{Kruskal} oder Algorithmus von \textsc{Prim}.
\paragraph{Schnitteigenschaft}
Für jeden Schnitt $C$ im Graphen gilt:
@@ -53,18 +51,14 @@ Erkennt negative Zyklen.
\item Der Code unten läuft in Linearzeit.
Wenn das nicht notwenidg ist (oder bestimmte Sortierungen verlangt werden), gehts mit einem \lstinline{set} einfacher.
\end{itemize}
-\begin{figure}[h]
- \begin{lstlisting}
- VISIT(v):
- forall e=(v,w) in E
- delete e from E
- VISIT(w)
- print e
- \end{lstlisting}
- \caption{Idee für Eulerzyklen}
-\end{figure}
+\begin{lstlisting}
+VISIT(v):
+ forall e=(v,w) in E
+ delete e from E
+ VISIT(w)
+ print e
+\end{lstlisting}
\lstinputlisting{graph/euler.cpp}
-\paragraph{Achtung:}
\begin{itemize}
\item Die Ausgabe erfolgt in falscher Reihenfolge.
\item Algorithmus schlägt nicht fehl, falls kein Eulerzyklus existiert.
diff --git a/graph/kruskal.cpp b/graph/kruskal.cpp
index 4703c45..124c8bb 100644
--- a/graph/kruskal.cpp
+++ b/graph/kruskal.cpp
@@ -1,6 +1,3 @@
-typedef pair<int,int> ii;
-typedef vector<pair<int,ii>> graph;
-
//Takes a Graph g (EdgeList!!!) with N nodes and computes the MST and Cost of it. Runtime: O(|E|*log(|E|))
//Requires UnionFind-Datastructure!!!
pair<graph,int> buildMST(int N, graph& g) {
@@ -15,4 +12,4 @@ pair<graph,int> buildMST(int N, graph& g) {
}
}
return make_pair(mst,mst_cost);
-} \ No newline at end of file
+}