graphviz is a cool software for automatic layout of graphs given their descriptions only:
https://graphviz.org/
Years ago somebody did compile graphviz to JavaScript using emscripten.
I used that to build GraphvizFiddle on my personal website:
https://stamm-wilbrandt.de/GraphvizFiddle/
No need to install graphviz software, just edit in GraphvizFiddle and click on "Draw" button for new layout in browser.
There are many sample links, link to .dot language user's guide and "Share" button.
When you click on "Share" button, the editor content gets urlencoded and appended to address bar URL.
You can bookmark that URL, or use on websites, in github README.md files or send via email.
Recently I made use of that mechanism to view a file in local filesystem.
GraphvizFiddle.py gist does all what is needed for that:
https://gist.github.com/Hermann-SW/ec9b ... 9c48286ad6
After some imports that is all:Use it:
I found out how to use GraphvizFiddle.py from a headless Linux computer as well.
One has to have that last line in .bashrc:
With that security is no obstacle anymore, after having opend the terminal with:
Good thing is that the browser that displays GraphvizFiddle runs locally on my Pi5:
After I installed chromium-browser on my x86_64 7950X CPU Ubuntu, it works with that browser as well.
Last, the best use is to visualize graphviz .dot files that just get created, without storing that file all all.
No problem with bash redirection:The messages only happened because I had no Firefox open on Pi5 before.
With this demo …
https://gist.github.com/Hermann-SW/99d1 ... id=4985753
… above command shows this in browser:
![Image]()
You can open that graph in your browser with this GraphvizFiddle "Share" link:
https://stamm-wilbrandt.de/GraphvizFidd ... 5%0A%7D%0A
I created it in address bar by clicking on GraphvizFiddle "Share" button.
For me a nice tool, I hope it can be for you as well.
Clean …
… with one warning disabled:
P.S:
More on "straight_line_graphviz.cpp" in new thread
"Boost provides free peer-reviewed portable C++ source libraries."
viewtopic.php?t=367391
https://graphviz.org/
Years ago somebody did compile graphviz to JavaScript using emscripten.
I used that to build GraphvizFiddle on my personal website:
https://stamm-wilbrandt.de/GraphvizFiddle/
No need to install graphviz software, just edit in GraphvizFiddle and click on "Draw" button for new layout in browser.
There are many sample links, link to .dot language user's guide and "Share" button.
When you click on "Share" button, the editor content gets urlencoded and appended to address bar URL.
You can bookmark that URL, or use on websites, in github README.md files or send via email.
Recently I made use of that mechanism to view a file in local filesystem.
GraphvizFiddle.py gist does all what is needed for that:
https://gist.github.com/Hermann-SW/ec9b ... 9c48286ad6
After some imports that is all:
Code:
...if len(sys.argv)<3: print("Format: "+sys.argv[0]+" browser dotfile")else: B=sys.argv[1] with open(sys.argv[2], encoding="utf-8") as f: s=urllib.parse.quote("".join(line for line in f)) T=str(int(time.time())) os.system(B+" https://stamm-wilbrandt.de/GraphvizFiddle/2.1.2/?"+T+"#"+s)
Code:
pi@raspberrypi5:~ $ cat hello.dot digraph G {Hello->World}pi@raspberrypi5:~ $ GraphvizFiddle.py chromium-browser hello.dot Opening in existing browser session.pi@raspberrypi5:~ $
I found out how to use GraphvizFiddle.py from a headless Linux computer as well.
One has to have that last line in .bashrc:
Code:
hermann@7950x:~$ tail -4 .bashrc fifiexport XAUTHORITY=$HOME/.Xauthorityhermann@7950x:~$
With that security is no obstacle anymore, after having opend the terminal with:
Code:
pi@raspberrypi5:~ $ ssh -X hermann@7950x
Good thing is that the browser that displays GraphvizFiddle runs locally on my Pi5:
Code:
hermann@7950x:~$ GraphvizFiddle.py firefox hello.dot
After I installed chromium-browser on my x86_64 7950X CPU Ubuntu, it works with that browser as well.
Last, the best use is to visualize graphviz .dot files that just get created, without storing that file all all.
No problem with bash redirection:
Code:
pi@raspberrypi5:~ $ GraphvizFiddle.py firefox <(./straight_line_graphviz)[GFX1-]: glxtest: DRM render node not clearly detectable. Falling back to using the only one that was found.
With this demo …
https://gist.github.com/Hermann-SW/99d1 ... id=4985753
Code:
pi@raspberrypi5:~ $ ./straight_line_graphviz | head -5graph { layout=neato node [shape=none] 0 [pos="0,0!"] 1 [pos="16,0!"]pi@raspberrypi5:~ $ ./straight_line_graphviz | tail -3 8--5 9--6}pi@raspberrypi5:~ $
… above command shows this in browser:
You can open that graph in your browser with this GraphvizFiddle "Share" link:
https://stamm-wilbrandt.de/GraphvizFidd ... 5%0A%7D%0A
I created it in address bar by clicking on GraphvizFiddle "Share" button.
For me a nice tool, I hope it can be for you as well.
Clean …
Code:
pi@raspberrypi5:~ $ pylint /usr/local/bin/GraphvizFiddle.py --------------------------------------------------------------------Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)pi@raspberrypi5:~ $
… with one warning disabled:
Code:
pi@raspberrypi5:~ $ head -3 /usr/local/bin/GraphvizFiddle.py #!/usr/bin/env python""" view graphviz file """# pylint: disable=C0103pi@raspberrypi5:~ $
P.S:
More on "straight_line_graphviz.cpp" in new thread
"Boost provides free peer-reviewed portable C++ source libraries."
viewtopic.php?t=367391
Statistics: Posted by HermannSW — Thu Mar 14, 2024 1:16 pm