revert: "fix: switch graphviz to pngs as it is unusable now"

This reverts commit a5b6f8b128.
This commit is contained in:
Matej Focko 2023-09-07 17:59:11 +02:00
parent a5b6f8b128
commit 326612b3e2
Signed by: mfocko
GPG key ID: 7C47D46246790496
4 changed files with 30 additions and 30 deletions

View file

@ -86,8 +86,8 @@ As we could observe in the example above, `extend` iterates over all of the elem
Consider constructing of this list: Consider constructing of this list:
![Rendered construction of the list](/files/ib002/time-complexity/extend/construction_light.png#gh-light-mode-only) ![Rendered construction of the list](/files/ib002/time-complexity/extend/construction_light.svg#gh-light-mode-only)
![Rendered construction of the list](/files/ib002/time-complexity/extend/construction_dark.png#gh-dark-mode-only) ![Rendered construction of the list](/files/ib002/time-complexity/extend/construction_dark.svg#gh-dark-mode-only)
Let us assume that you extend the result with the list that you get from the recursive call. Let us assume that you extend the result with the list that you get from the recursive call.

View file

@ -55,8 +55,8 @@ my child would be colored red.
Example of a red-black tree that keeps count of black nodes on paths to the Example of a red-black tree that keeps count of black nodes on paths to the
leaves follows: leaves follows:
![Red-black tree with black height](/files/ib002/rb-trees/rules/rb_height_light.png#gh-light-mode-only) ![Red-black tree with black height](/files/ib002/rb-trees/rules/rb_height_light.svg#gh-light-mode-only)
![Red-black tree with black height](/files/ib002/rb-trees/rules/rb_height_dark.png#gh-dark-mode-only) ![Red-black tree with black height](/files/ib002/rb-trees/rules/rb_height_dark.svg#gh-dark-mode-only)
We mark the _black heights_ in superscript. You can see that all leaves have the We mark the _black heights_ in superscript. You can see that all leaves have the
black height equal to $1$. Let's take a look at some of the interesting cases: black height equal to $1$. Let's take a look at some of the interesting cases:
@ -140,15 +140,15 @@ accordingly.
| Usual algorithm with black root | Allowing red root | | Usual algorithm with black root | Allowing red root |
| :-----------------------------: | :---------------: | | :-----------------------------: | :---------------: |
| ![1ª insertion](/files/ib002/rb-trees/rules/red-root/br_0_light.png#gh-light-mode-only)![1ª insertion](/files/ib002/rb-trees/rules/red-root/br_0_dark.png#gh-dark-mode-only) | ![1ª insertion](/files/ib002/rb-trees/rules/red-root/rr_0_light.png#gh-light-mode-only)![1ª insertion](/files/ib002/rb-trees/rules/red-root/rr_0_dark.png#gh-dark-mode-only) | | ![1ª insertion](/files/ib002/rb-trees/rules/red-root/br_0_light.svg#gh-light-mode-only)![1ª insertion](/files/ib002/rb-trees/rules/red-root/br_0_dark.svg#gh-dark-mode-only) | ![1ª insertion](/files/ib002/rb-trees/rules/red-root/rr_0_light.svg#gh-light-mode-only)![1ª insertion](/files/ib002/rb-trees/rules/red-root/rr_0_dark.svg#gh-dark-mode-only) |
| ![2ª insertion](/files/ib002/rb-trees/rules/red-root/br_1_light.png#gh-light-mode-only)![2ª insertion](/files/ib002/rb-trees/rules/red-root/br_1_dark.png#gh-dark-mode-only) | ![2ª insertion](/files/ib002/rb-trees/rules/red-root/rr_1_light.png#gh-light-mode-only)![2ª insertion](/files/ib002/rb-trees/rules/red-root/rr_1_dark.png#gh-dark-mode-only) | | ![2ª insertion](/files/ib002/rb-trees/rules/red-root/br_1_light.svg#gh-light-mode-only)![2ª insertion](/files/ib002/rb-trees/rules/red-root/br_1_dark.svg#gh-dark-mode-only) | ![2ª insertion](/files/ib002/rb-trees/rules/red-root/rr_1_light.svg#gh-light-mode-only)![2ª insertion](/files/ib002/rb-trees/rules/red-root/rr_1_dark.svg#gh-dark-mode-only) |
| ![3ª insertion](/files/ib002/rb-trees/rules/red-root/br_2_light.png#gh-light-mode-only)![3ª insertion](/files/ib002/rb-trees/rules/red-root/br_2_dark.png#gh-dark-mode-only) | ![3ª insertion](/files/ib002/rb-trees/rules/red-root/rr_2_light.png#gh-light-mode-only)![3ª insertion](/files/ib002/rb-trees/rules/red-root/rr_2_dark.png#gh-dark-mode-only) | | ![3ª insertion](/files/ib002/rb-trees/rules/red-root/br_2_light.svg#gh-light-mode-only)![3ª insertion](/files/ib002/rb-trees/rules/red-root/br_2_dark.svg#gh-dark-mode-only) | ![3ª insertion](/files/ib002/rb-trees/rules/red-root/rr_2_light.svg#gh-light-mode-only)![3ª insertion](/files/ib002/rb-trees/rules/red-root/rr_2_dark.svg#gh-dark-mode-only) |
| ![4ª insertion](/files/ib002/rb-trees/rules/red-root/br_3_light.png#gh-light-mode-only)![4ª insertion](/files/ib002/rb-trees/rules/red-root/br_3_dark.png#gh-dark-mode-only) | ![4ª insertion](/files/ib002/rb-trees/rules/red-root/rr_3_light.png#gh-light-mode-only)![4ª insertion](/files/ib002/rb-trees/rules/red-root/rr_3_dark.png#gh-dark-mode-only) | | ![4ª insertion](/files/ib002/rb-trees/rules/red-root/br_3_light.svg#gh-light-mode-only)![4ª insertion](/files/ib002/rb-trees/rules/red-root/br_3_dark.svg#gh-dark-mode-only) | ![4ª insertion](/files/ib002/rb-trees/rules/red-root/rr_3_light.svg#gh-light-mode-only)![4ª insertion](/files/ib002/rb-trees/rules/red-root/rr_3_dark.svg#gh-dark-mode-only) |
| ![5ª insertion](/files/ib002/rb-trees/rules/red-root/br_4_light.png#gh-light-mode-only)![5ª insertion](/files/ib002/rb-trees/rules/red-root/br_4_dark.png#gh-dark-mode-only) | ![5ª insertion](/files/ib002/rb-trees/rules/red-root/rr_4_light.png#gh-light-mode-only)![5ª insertion](/files/ib002/rb-trees/rules/red-root/rr_4_dark.png#gh-dark-mode-only) | | ![5ª insertion](/files/ib002/rb-trees/rules/red-root/br_4_light.svg#gh-light-mode-only)![5ª insertion](/files/ib002/rb-trees/rules/red-root/br_4_dark.svg#gh-dark-mode-only) | ![5ª insertion](/files/ib002/rb-trees/rules/red-root/rr_4_light.svg#gh-light-mode-only)![5ª insertion](/files/ib002/rb-trees/rules/red-root/rr_4_dark.svg#gh-dark-mode-only) |
| ![6ª insertion](/files/ib002/rb-trees/rules/red-root/br_5_light.png#gh-light-mode-only)![6ª insertion](/files/ib002/rb-trees/rules/red-root/br_5_dark.png#gh-dark-mode-only) | ![6ª insertion](/files/ib002/rb-trees/rules/red-root/rr_5_light.png#gh-light-mode-only)![6ª insertion](/files/ib002/rb-trees/rules/red-root/rr_5_dark.png#gh-dark-mode-only) | | ![6ª insertion](/files/ib002/rb-trees/rules/red-root/br_5_light.svg#gh-light-mode-only)![6ª insertion](/files/ib002/rb-trees/rules/red-root/br_5_dark.svg#gh-dark-mode-only) | ![6ª insertion](/files/ib002/rb-trees/rules/red-root/rr_5_light.svg#gh-light-mode-only)![6ª insertion](/files/ib002/rb-trees/rules/red-root/rr_5_dark.svg#gh-dark-mode-only) |
| ![7ª insertion](/files/ib002/rb-trees/rules/red-root/br_6_light.png#gh-light-mode-only)![7ª insertion](/files/ib002/rb-trees/rules/red-root/br_6_dark.png#gh-dark-mode-only) | ![7ª insertion](/files/ib002/rb-trees/rules/red-root/rr_6_light.png#gh-light-mode-only)![7ª insertion](/files/ib002/rb-trees/rules/red-root/rr_6_dark.png#gh-dark-mode-only) | | ![7ª insertion](/files/ib002/rb-trees/rules/red-root/br_6_light.svg#gh-light-mode-only)![7ª insertion](/files/ib002/rb-trees/rules/red-root/br_6_dark.svg#gh-dark-mode-only) | ![7ª insertion](/files/ib002/rb-trees/rules/red-root/rr_6_light.svg#gh-light-mode-only)![7ª insertion](/files/ib002/rb-trees/rules/red-root/rr_6_dark.svg#gh-dark-mode-only) |
| ![8ª insertion](/files/ib002/rb-trees/rules/red-root/br_7_light.png#gh-light-mode-only)![8ª insertion](/files/ib002/rb-trees/rules/red-root/br_7_dark.png#gh-dark-mode-only) | ![8ª insertion](/files/ib002/rb-trees/rules/red-root/rr_7_light.png#gh-light-mode-only)![8ª insertion](/files/ib002/rb-trees/rules/red-root/rr_7_dark.png#gh-dark-mode-only) | | ![8ª insertion](/files/ib002/rb-trees/rules/red-root/br_7_light.svg#gh-light-mode-only)![8ª insertion](/files/ib002/rb-trees/rules/red-root/br_7_dark.svg#gh-dark-mode-only) | ![8ª insertion](/files/ib002/rb-trees/rules/red-root/rr_7_light.svg#gh-light-mode-only)![8ª insertion](/files/ib002/rb-trees/rules/red-root/rr_7_dark.svg#gh-dark-mode-only) |
| ![9ª insertion](/files/ib002/rb-trees/rules/red-root/br_8_light.png#gh-light-mode-only)![9ª insertion](/files/ib002/rb-trees/rules/red-root/br_8_dark.png#gh-dark-mode-only) | ![9ª insertion](/files/ib002/rb-trees/rules/red-root/rr_8_light.png#gh-light-mode-only)![9ª insertion](/files/ib002/rb-trees/rules/red-root/rr_8_dark.png#gh-dark-mode-only) | | ![9ª insertion](/files/ib002/rb-trees/rules/red-root/br_8_light.svg#gh-light-mode-only)![9ª insertion](/files/ib002/rb-trees/rules/red-root/br_8_dark.svg#gh-dark-mode-only) | ![9ª insertion](/files/ib002/rb-trees/rules/red-root/rr_8_light.svg#gh-light-mode-only)![9ª insertion](/files/ib002/rb-trees/rules/red-root/rr_8_dark.svg#gh-dark-mode-only) |
## 3ª Every leaf (`nil`) is black. ## 3ª Every leaf (`nil`) is black.
@ -157,8 +157,8 @@ some other way? Let's go through some of the possible ways I can look at this an
how would they affect the other rules and balancing. how would they affect the other rules and balancing.
We will experiment with the following tree: We will experiment with the following tree:
![](/files/ib002/rb-trees/rules/rb_light.png#gh-light-mode-only) ![](/files/ib002/rb-trees/rules/rb_light.svg#gh-light-mode-only)
![](/files/ib002/rb-trees/rules/rb_dark.png#gh-dark-mode-only) ![](/files/ib002/rb-trees/rules/rb_dark.svg#gh-dark-mode-only)
We should start by counting the black nodes from root to the `nil` leaves based We should start by counting the black nodes from root to the `nil` leaves based
on the rules. We have multiple similar paths, so we will pick only the interesting on the rules. We have multiple similar paths, so we will pick only the interesting
@ -232,15 +232,15 @@ import TabItem from '@theme/TabItem';
<Tabs> <Tabs>
<TabItem value="enforcing" label="Enforcing this rule"> <TabItem value="enforcing" label="Enforcing this rule">
![](/files/ib002/rb-trees/rules/red-node-black-children/correct_light.png#gh-light-mode-only) ![](/files/ib002/rb-trees/rules/red-node-black-children/correct_light.svg#gh-light-mode-only)
![](/files/ib002/rb-trees/rules/red-node-black-children/correct_dark.png#gh-dark-mode-only) ![](/files/ib002/rb-trees/rules/red-node-black-children/correct_dark.svg#gh-dark-mode-only)
</TabItem> </TabItem>
<TabItem value="omitting" label="Omitting this rule"> <TabItem value="omitting" label="Omitting this rule">
![](/files/ib002/rb-trees/rules/red-node-black-children/incorrect_light.png#gh-light-mode-only) ![](/files/ib002/rb-trees/rules/red-node-black-children/incorrect_light.svg#gh-light-mode-only)
![](/files/ib002/rb-trees/rules/red-node-black-children/incorrect_dark.png#gh-dark-mode-only) ![](/files/ib002/rb-trees/rules/red-node-black-children/incorrect_dark.svg#gh-dark-mode-only)
</TabItem> </TabItem>
</Tabs> </Tabs>

View file

@ -21,13 +21,13 @@ As we have talked on the seminar, if we construct from some vertex $u$ BFS tree
Consider the following graph: Consider the following graph:
![](/files/ib002/graphs/bfs-tree/bfs_graph_light.png#gh-light-mode-only) ![](/files/ib002/graphs/bfs-tree/bfs_graph_light.svg#gh-light-mode-only)
![](/files/ib002/graphs/bfs-tree/bfs_graph_dark.png#gh-dark-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: We run BFS from the vertex $a$ and obtain the following BFS tree:
![](/files/ib002/graphs/bfs-tree/bfs_tree_light.png#gh-light-mode-only) ![](/files/ib002/graphs/bfs-tree/bfs_tree_light.svg#gh-light-mode-only)
![](/files/ib002/graphs/bfs-tree/bfs_tree_dark.png#gh-dark-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: Let's consider pair of vertices $e$ and $h$. For them we can safely lay, from the BFS tree, following properties:
@ -42,8 +42,8 @@ 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! 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!
![](/files/ib002/graphs/bfs-tree/bfs_graph_with_additional_edge_light.png#gh-light-mode-only) ![](/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.png#gh-dark-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. 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.
@ -56,8 +56,8 @@ Do we need to run BFS after **every** change?
::: :::
![](/files/ib002/graphs/bfs-tree/bfs_tree_with_additional_edge_light.png#gh-light-mode-only) ![](/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.png#gh-dark-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. Oops, we have gotten a new BFS tree, that has a height difference of 1.

View file

@ -3,11 +3,11 @@
FONT="'Cascadia Code PL', 'JetBrains Mono', 'Iosevka', 'Fira Code', 'Hack', monospace" FONT="'Cascadia Code PL', 'JetBrains Mono', 'Iosevka', 'Fira Code', 'Hack', monospace"
for pic in $(find ./static/files -name '*.dot' -print); do for pic in $(find ./static/files -name '*.dot' -print); do
PNG_NAME=".$(echo $pic | cut -d'.' -f2)" SVG_NAME=".$(echo $pic | cut -d'.' -f2)"
# light mode # light mode
dot $pic -Tpng -Gfontname="$FONT" -Nfontname="$FONT" -Efontname="$FONT" > ${PNG_NAME}_light.png dot $pic -Tsvg -Gfontname="$FONT" -Nfontname="$FONT" -Efontname="$FONT" > ${SVG_NAME}_light.svg
# dark mode # dark mode
dot $pic -Tpng -Gfontname="$FONT" -Nfontname="$FONT" -Efontname="$FONT" -Gbgcolor="#1b1b1d" -Gcolor="white" -Gfontcolor="white" -Nfillcolor="none" -Ncolor="white" -Nfontcolor="white" -Efillcolor="none" -Ecolor="white" -Efontcolor="white" > ${PNG_NAME}_dark.png dot $pic -Tsvg -Gfontname="$FONT" -Nfontname="$FONT" -Efontname="$FONT" -Gbgcolor="#1b1b1d" -Gcolor="white" -Gfontcolor="white" -Nfillcolor="none" -Ncolor="white" -Nfontcolor="white" -Efillcolor="none" -Ecolor="white" -Efontcolor="white" > ${SVG_NAME}_dark.svg
done; done;