~bfiedler/website

84d1a5d55e01c3aa886d5acbbe09f25110e1dc9e — Ben Fiedler 5 months ago 719820f
Use captions and alt tags appropriately
1 files changed, 6 insertions(+), 7 deletions(-)

M content/blog/solving-graph-problems-in-bash.md
M content/blog/solving-graph-problems-in-bash.md => content/blog/solving-graph-problems-in-bash.md +6 -7
@@ 51,10 51,9 @@ can we maybe use directories instead?
It turns out that this works nicely, but only when our graph is a *rooted
tree*. In a rooted tree we choose an arbitrary vertex as root and then list all
vertices ordered by their distance from the root: First comes the root itself,
then the root's neighbors, then the root's neighbors' neighbors, etc. Let
us have a look at an example, a tree rooted at vertex 0:
then the root's neighbors, then the root's neighbors' neighbors, etc.

{{< figure class="invertable resizable" src="/blog/img/rooted-tree.svg" alt="A tree with 7 vertices, rooted at vertex 0" >}}
{{< figure class="invertable resizable" src="/blog/img/rooted-tree.svg" caption="A tree with 7 vertices, rooted at vertex 0" >}}

We can easily translate this tree into a directory structure:



@@ 228,13 227,13 @@ can "point" to other directories, which can in turn point to other directories,
which can point to other directories, etc. We can create symlinks using the `ln`
command (incidentally also found in coreutils), by writing `ln -s <directory
point to> <name of the link>`. For each vertex we want to create a directory and
in that directory create symbolic links to all of its neighbors.  If you recall
in that directory create symbolic links to all of its neighbors. If you recall
the different forms of graph representation before this corresponds to adjacency
lists. Let us try this with a simple example:
lists. Let us try this with a simple example.

{{< figure class="invertable resizable" src="/blog/img/graph.svg" alt="A triangle with a three-armed star glued to one edge" >}}
{{< figure class="invertable resizable" src="/blog/img/graph.svg" alt="A triangle with a three-armed star, connected via one arm" caption="A triangle with a three-armed star, connected via one arm" >}}

We can create the graph as follows:
We can create this graph as follows:

```
% mkdir `seq 0 5`