\documentclass{bschlangaul-aufgabe} \bLadePakete{graph} \begin{document} \bAufgabenMetadaten{ Titel = {Aufgabe 8}, Thematik = {favtutor.com}, Referenz = AUD.Graphen.Tiefen-Breitensuche.favtutor.com, RelativerPfad = Module/30_AUD/90_Graphen/30_Tiefen-Breitensuche/Aufgabe_favtutor.com.tex, BearbeitungsStand = unbekannt, Korrektheit = unbekannt, Ueberprueft = {unbekannt}, Stichwoerter = {Tiefensuche}, } \index{Tiefensuche} \bFussnoteUrl{https://favtutor.com/blogs/depth-first-search-java} \begin{bGraphenFormat} 0: 0 0 1: 1 0 2: 0 2 3: 2 2 4: 2 0 5: 3 0 0 -- 1 0 -- 2 1 -> 3 2 -> 3 3 -- 4 3 -- 5 \end{bGraphenFormat} \begin{tikzpicture}[li graph] \node (0) at (0,0) {0}; \node (1) at (1,0) {1}; \node (2) at (0,2) {2}; \node (3) at (2,2) {3}; \node (4) at (2,0) {4}; \node (5) at (3,0) {5}; \path (0) edge node {} (1); \path (0) edge node {} (2); \path[->] (1) edge node {} (3); \path[->] (2) edge node {} (3); \path (3) edge node {} (4); \path (3) edge node {} (5); \end{tikzpicture} Following is Depth First Traversal: 0 1 3 4 5 2 \end{document}