SQLite Forum

Breadth-first graph traversal
Login
FYI, this forum now has a feature called [Pikchr][1] which lets you create inline diagrams with an easily-learned language. Except for very simple cases, it's easier than working out the ASCII art equivalent.

In your particular case, the result actually communicates what you're after better, because your ASCII DAG isn't "directed":

``` pikchr toggle
    scale = 0.6
C1: circle "1" fit
    arrow right 50%
C2: circle same "2"
    arrow same
C4: circle same "4"
    arrow same
C5: circle same "5"
    arrow same
C7: circle same "7"
C3: circle same "3" at 1cm above C2
C6: circle same "6" at 1cm above C5
    arrow from C1 to C3 chop
    arrow from C3 to C4 chop
    arrow from C4 to C6 chop
    arrow from C6 to C7 chop
```

There's a feature on every Fossil repository called [`/pikchrshow`][2] that provides a sandbox where you can construct these things before copy-pasting them into your post.

Click the diagram to see what the source text for the diagram looks like, or click the `[source]` link above to see the raw text of the whole post, so you can see how I injected the diagram into the post.

That diagram is based on the first one [in this article][3]. Point being, if you know where you can find a suitably-close Pikchr, you can rework it to purpose faster than crafting it from scratch.


[1]: https://www.fossil-scm.org/pikchr/
[2]: https://sqlite.org/forum/pikchrshow
[3]: https://fossil-scm.org/fossil/doc/trunk/www/rebaseharm.md