Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4962

C/C++ • Re: Boost provides free peer-reviewed portable C++ source libraries.

$
0
0
Next I will figure out the input graph edges that were not added in between, and draw them bold …
I did that, and in addition the edges added get drawn dotted.

I added simple code to read input graph in LEDA format:

Code:

pi@raspberrypi5:~ $ echo -e "LEDA.GRAPH\nunsigned\nint\n4\n0\n0\n0\n0\n2\n1 2 0\n3 4 0"LEDA.GRAPHunsignedint4000021 2 03 4 0pi@raspberrypi5:~ $ 

Code:

pi@raspberrypi5:~ $ GraphvizFiddle.py chromium-browser <(./straight_line_graphviz <(echo -e "LEDA.GRAPH\nunsigned\nint\n4\n0\n0\n0\n0\n2\n1 2 0\n3 4 0"))pi@raspberrypi5:~ $ 
This shows up in GraphvizFiddle:
BGL.straight_line_graphviz.2b.png

30yo code that can generate maximal planar random graphs as well as other types, in this 2yo repo:
https://github.com/Hermann-SW/randomgraph

Code:

pi@raspberrypi5:~ $ randomgraph[3] Format: randomgraph n [-t type] [-o file.[u/bit/bit8/a]] [-s seed] [-no] [-r edges] [-n]( type in {cubic,cubic_Halin,maximal_planar,dual_of_cubic_Halin} ) pi@raspberrypi5:~ $ 
Based on technical report I wrote 30yo, the random graph generation was only a byproduct:
https://stamm-wilbrandt.de/en/IAI-TR-93-10.ps.pdf


This creates random maximal planar graph on 8 vertices (with 3*8-6=18 edges) and removes 12 edges randomly, as straight_line_graphviz input:

Code:

pi@raspberrypi5:~ $ GraphvizFiddle.py chromium-browser <(./straight_line_graphviz <(randomgraph 8 -o - -r 12 -s 123456))-------------------------------------malloc: 19   malloc-free: 0pi@raspberrypi5:~ $ 
(GraphvizFiddle share link for opening in browser)
BGL.straight_line_graphviz.3.50%.png


This creates random cubic Halin graph on 8 vertices, as straight_line_graphviz input, with random seed 123456:

Code:

pi@raspberrypi5:~ $ GraphvizFiddle.py chromium-browser <(./straight_line_graphviz <(randomgraph 8 -o - -t cubic_Halin -s 123456))-------------------------------------malloc: 23   malloc-free: 0pi@raspberrypi5:~ $ 
(GraphvizFiddle share link)
BGL.straight_line_graphviz.4.50%.png

I was curious where vertex 0 (that was not drawn) was placed in the temporary maximal planar graph of previous comment.
So I commented out the 3 continue statements temporarily just to see:
(GraphvizFiddle share link for opening in browser)
Image


New straight_line_graphviz.cpp gist:
https://gist.github.com/Hermann-SW/99d1 ... 79b2da26a8

Statistics: Posted by HermannSW — Fri Mar 15, 2024 7:54 pm



Viewing all articles
Browse latest Browse all 4962

Trending Articles