Fix Bellman-Ford example [closes #60]
This commit is contained in:
		
							parent
							
								
									ee525dd431
								
							
						
					
					
						commit
						c8d45c39f4
					
				|  | @ -53,17 +53,17 @@ works in the following graph: | |||
| \node[draw, circle] (2) at (4,3) {2}; | ||||
| \node[draw, circle] (3) at (1,1) {3}; | ||||
| \node[draw, circle] (4) at (4,1) {4}; | ||||
| \node[draw, circle] (5) at (6,2) {5}; | ||||
| \node[draw, circle] (5) at (6,2) {6}; | ||||
| \node[color=red] at (1,3+0.55) {$0$}; | ||||
| \node[color=red] at (4,3+0.55) {$\infty$}; | ||||
| \node[color=red] at (1,1-0.55) {$\infty$}; | ||||
| \node[color=red] at (4,1-0.55) {$\infty$}; | ||||
| \node[color=red] at (6,2-0.55) {$\infty$}; | ||||
| \path[draw,thick,-] (1) -- node[font=\small,label=above:2] {} (2); | ||||
| \path[draw,thick,-] (1) -- node[font=\small,label=above:5] {} (2); | ||||
| \path[draw,thick,-] (1) -- node[font=\small,label=left:3] {} (3); | ||||
| \path[draw,thick,-] (3) -- node[font=\small,label=below:$-2$] {} (4); | ||||
| \path[draw,thick,-] (3) -- node[font=\small,label=below:1] {} (4); | ||||
| \path[draw,thick,-] (2) -- node[font=\small,label=left:3] {} (4); | ||||
| \path[draw,thick,-] (2) -- node[font=\small,label=above:5] {} (5); | ||||
| \path[draw,thick,-] (2) -- node[font=\small,label=above:2] {} (5); | ||||
| \path[draw,thick,-] (4) -- node[font=\small,label=below:2] {} (5); | ||||
| \path[draw,thick,-] (1) -- node[font=\small,label=above:7] {} (4); | ||||
| \end{tikzpicture} | ||||
|  | @ -82,15 +82,15 @@ First, all edges from node 1 reduce distances: | |||
| \node[draw, circle] (4) at (4,1) {4}; | ||||
| \node[draw, circle] (5) at (6,2) {5}; | ||||
| \node[color=red] at (1,3+0.55) {$0$}; | ||||
| \node[color=red] at (4,3+0.55) {$2$}; | ||||
| \node[color=red] at (4,3+0.55) {$5$}; | ||||
| \node[color=red] at (1,1-0.55) {$3$}; | ||||
| \node[color=red] at (4,1-0.55) {$7$}; | ||||
| \node[color=red] at (6,2-0.55) {$\infty$}; | ||||
| \path[draw,thick,-] (1) -- node[font=\small,label=above:2] {} (2); | ||||
| \path[draw,thick,-] (1) -- node[font=\small,label=above:5] {} (2); | ||||
| \path[draw,thick,-] (1) -- node[font=\small,label=left:3] {} (3); | ||||
| \path[draw,thick,-] (3) -- node[font=\small,label=below:$-2$] {} (4); | ||||
| \path[draw,thick,-] (3) -- node[font=\small,label=below:1] {} (4); | ||||
| \path[draw,thick,-] (2) -- node[font=\small,label=left:3] {} (4); | ||||
| \path[draw,thick,-] (2) -- node[font=\small,label=above:5] {} (5); | ||||
| \path[draw,thick,-] (2) -- node[font=\small,label=above:2] {} (5); | ||||
| \path[draw,thick,-] (4) -- node[font=\small,label=below:2] {} (5); | ||||
| \path[draw,thick,-] (1) -- node[font=\small,label=above:7] {} (4); | ||||
| 
 | ||||
|  | @ -110,15 +110,15 @@ reduce distances: | |||
| \node[draw, circle] (4) at (4,1) {4}; | ||||
| \node[draw, circle] (5) at (6,2) {5}; | ||||
| \node[color=red] at (1,3+0.55) {$0$}; | ||||
| \node[color=red] at (4,3+0.55) {$2$}; | ||||
| \node[color=red] at (4,3+0.55) {$5$}; | ||||
| \node[color=red] at (1,1-0.55) {$3$}; | ||||
| \node[color=red] at (4,1-0.55) {$1$}; | ||||
| \node[color=red] at (4,1-0.55) {$4$}; | ||||
| \node[color=red] at (6,2-0.55) {$7$}; | ||||
| \path[draw,thick,-] (1) -- node[font=\small,label=above:2] {} (2); | ||||
| \path[draw,thick,-] (1) -- node[font=\small,label=above:5] {} (2); | ||||
| \path[draw,thick,-] (1) -- node[font=\small,label=left:3] {} (3); | ||||
| \path[draw,thick,-] (3) -- node[font=\small,label=below:$-2$] {} (4); | ||||
| \path[draw,thick,-] (3) -- node[font=\small,label=below:1] {} (4); | ||||
| \path[draw,thick,-] (2) -- node[font=\small,label=left:3] {} (4); | ||||
| \path[draw,thick,-] (2) -- node[font=\small,label=above:5] {} (5); | ||||
| \path[draw,thick,-] (2) -- node[font=\small,label=above:2] {} (5); | ||||
| \path[draw,thick,-] (4) -- node[font=\small,label=below:2] {} (5); | ||||
| \path[draw,thick,-] (1) -- node[font=\small,label=above:7] {} (4); | ||||
| 
 | ||||
|  | @ -135,15 +135,15 @@ Finally, there is one more change: | |||
| \node[draw, circle] (4) at (4,1) {4}; | ||||
| \node[draw, circle] (5) at (6,2) {5}; | ||||
| \node[color=red] at (1,3+0.55) {$0$}; | ||||
| \node[color=red] at (4,3+0.55) {$2$}; | ||||
| \node[color=red] at (4,3+0.55) {$5$}; | ||||
| \node[color=red] at (1,1-0.55) {$3$}; | ||||
| \node[color=red] at (4,1-0.55) {$1$}; | ||||
| \node[color=red] at (6,2-0.55) {$3$}; | ||||
| \path[draw,thick,-] (1) -- node[font=\small,label=above:2] {} (2); | ||||
| \node[color=red] at (4,1-0.55) {$4$}; | ||||
| \node[color=red] at (6,2-0.55) {$6$}; | ||||
| \path[draw,thick,-] (1) -- node[font=\small,label=above:5] {} (2); | ||||
| \path[draw,thick,-] (1) -- node[font=\small,label=left:3] {} (3); | ||||
| \path[draw,thick,-] (3) -- node[font=\small,label=below:$-2$] {} (4); | ||||
| \path[draw,thick,-] (3) -- node[font=\small,label=below:1] {} (4); | ||||
| \path[draw,thick,-] (2) -- node[font=\small,label=left:3] {} (4); | ||||
| \path[draw,thick,-] (2) -- node[font=\small,label=above:5] {} (5); | ||||
| \path[draw,thick,-] (2) -- node[font=\small,label=above:2] {} (5); | ||||
| \path[draw,thick,-] (4) -- node[font=\small,label=below:2] {} (5); | ||||
| \path[draw,thick,-] (1) -- node[font=\small,label=above:7] {} (4); | ||||
| 
 | ||||
|  | @ -169,15 +169,15 @@ the following path: | |||
| \node[draw, circle] (4) at (4,1) {4}; | ||||
| \node[draw, circle] (5) at (6,2) {5}; | ||||
| \node[color=red] at (1,3+0.55) {$0$}; | ||||
| \node[color=red] at (4,3+0.55) {$2$}; | ||||
| \node[color=red] at (4,3+0.55) {$5$}; | ||||
| \node[color=red] at (1,1-0.55) {$3$}; | ||||
| \node[color=red] at (4,1-0.55) {$1$}; | ||||
| \node[color=red] at (6,2-0.55) {$3$}; | ||||
| \path[draw,thick,-] (1) -- node[font=\small,label=above:2] {} (2); | ||||
| \node[color=red] at (4,1-0.55) {$4$}; | ||||
| \node[color=red] at (6,2-0.55) {$6$}; | ||||
| \path[draw,thick,-] (1) -- node[font=\small,label=above:5] {} (2); | ||||
| \path[draw,thick,-] (1) -- node[font=\small,label=left:3] {} (3); | ||||
| \path[draw,thick,-] (3) -- node[font=\small,label=below:$-2$] {} (4); | ||||
| \path[draw,thick,-] (3) -- node[font=\small,label=below:1] {} (4); | ||||
| \path[draw,thick,-] (2) -- node[font=\small,label=left:3] {} (4); | ||||
| \path[draw,thick,-] (2) -- node[font=\small,label=above:5] {} (5); | ||||
| \path[draw,thick,-] (2) -- node[font=\small,label=above:2] {} (5); | ||||
| \path[draw,thick,-] (4) -- node[font=\small,label=below:2] {} (5); | ||||
| \path[draw,thick,-] (1) -- node[font=\small,label=above:7] {} (4); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue