A demonstration page for multi-level Page Graphs.
Recall that all the nodes going out from `HERE` are drawn with this command:
LINKS HERE -> NODE
To start, let's create a link to Example Page 2 and start with this minimalist factory:
DOT strict digraph rankdir=LR LINKS HERE -> NODE
Because there's no `node` or `link` styling, the result looks like this:
DOT strict digraph rankdir=LR LINKS HERE -> NODE STATIC strict digraph {rankdir=LR "Example Page 1" -> "Page Graph" "Example Page 1" -> "Example Page 2" }
Adding the next layer looks like this:
DOT strict digraph rankdir=LR LINKS HERE -> NODE HERE LINKS HERE -> NODE STATIC strict digraph {rankdir=LR "Example Page 1" -> "Example Page 2" "Example Page 2" -> "Example Page 3"}
The changes are simple, just adding two lines:
LINKS HERE -> NODE HERE LINKS HERE -> NODE
How does that work?
The **indented** `HERE` on the second line means "for each `NODE` pointed to by a `LINK` from `HERE`, read that page. Then do whatever is **further indented** on the next lines, considering its `HERE` to be the just-read page.
Because the second `LINKS HERE -> NODE` is indented that way, it scours `Example Page 2` for links, finds `Example Page 3` and `Example Page 4`, and draws them.
I emphasize **indenting** because if you get it wrong, you may see bizarre results, like this:
DOT strict digraph rankdir=LR LINKS HERE -> NODE HERE LINKS HERE -> NODE STATIC strict digraph {rankdir=LR "Example Page 1" -> "Example Page 2" "Example Page 2" -> "Example Page 3" "Example Page 2" -> "Example Page 4"}
`Example Page 2` doesn't link to itself, so why is there an arrow from it to itself?
I can't explain exactly why, but I can explain the cause. The second `LINKS` line is indented wrong:
LINKS HERE -> NODE HERE LINKS HERE -> NODE
If you see impossible graphs, suspect indentation.