1
0
Fork 0
mirror of https://github.com/mfocko/blog.git synced 2025-05-08 20:32:57 +02:00

fix: revert the ‹ThemedSVG› shite

Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2023-09-06 19:41:01 +02:00
parent b5fbddb8c9
commit 85cda31779
Signed by: mfocko
GPG key ID: 7C47D46246790496
3 changed files with 32 additions and 30 deletions
ib002/10-graphs

View file

@ -10,8 +10,6 @@ last_update:
date: 2022-04-30
---
import ThemedSVG from "@site/src/components/ThemedSVG";
## Introduction
As we have talked on the seminar, if we construct from some vertex $u$ BFS tree on an undirected graph, we can obtain:
@ -23,11 +21,13 @@ As we have talked on the seminar, if we construct from some vertex $u$ BFS tree
Consider the following graph:
<ThemedSVG source="/files/ib002/graphs/bfs-tree/bfs_graph" />
![](/files/ib002/graphs/bfs-tree/bfs_graph_light.svg#gh-light-mode-only)
![](/files/ib002/graphs/bfs-tree/bfs_graph_dark.svg#gh-dark-mode-only)
We run BFS from the vertex $a$ and obtain the following BFS tree:
<ThemedSVG source="/files/ib002/graphs/bfs-tree/bfs_tree" />
![](/files/ib002/graphs/bfs-tree/bfs_tree_light.svg#gh-light-mode-only)
![](/files/ib002/graphs/bfs-tree/bfs_tree_dark.svg#gh-dark-mode-only)
Let's consider pair of vertices $e$ and $h$. For them we can safely lay, from the BFS tree, following properties:
@ -42,7 +42,9 @@ Let's keep the same graph, but break the lower bound, i.e. I have gotten a lower
Now the more important question, is there a shorter path in that graph? The answer is no, there's no shorter path than the one with length $2$. So what can we do about it? We'll add an edge to have a shorter path. Now we have gotten a lower bound of $2$, which means the only shorter path we can construct has $1$ edge and that is $e, h$ (no intermediary vertices). Let's do this!
<ThemedSVG source="/files/ib002/bfs-tree/bfs_graph_with_additional_edge" />
![](/files/ib002/graphs/bfs-tree/bfs_graph_with_additional_edge_light.svg#gh-light-mode-only)
![](/files/ib002/graphs/bfs-tree/bfs_graph_with_additional_edge_dark.svg#gh-dark-mode-only)
Okay, so we have a graph that breaks the rule we have laid. However, we need to run BFS to obtain the new BFS tree, since we have changed the graph.
@ -54,7 +56,8 @@ Do we need to run BFS after **every** change?
:::
<ThemedSVG source="/files/ib002/bfs-tree/bfs_tree_with_additional_edge" />
![](/files/ib002/graphs/bfs-tree/bfs_tree_with_additional_edge_light.svg#gh-light-mode-only)
![](/files/ib002/graphs/bfs-tree/bfs_tree_with_additional_edge_dark.svg#gh-dark-mode-only)
Oops, we have gotten a new BFS tree, that has a height difference of 1.