ascherer / cwebbin

Literate Programming in C/C++
https://github.com/ascherer/cweb
MIT License
28 stars 5 forks source link

SOMAP example Stanford Graphbase Files in .gb Format #81

Closed EdV2 closed 6 months ago

EdV2 commented 6 months ago

Hi - I am working on mathematical art projects with several CS students at Rose Hulman Institute of Technology and we would very much like to plot SOMAP2.gb from https://www-cs-faculty.stanford.edu/~knuth/sgb.html

We have read through the list with verbose explanation - https://www-cs-faculty.stanford.edu/~knuth/somap-list.txt and also downloaded and installed CWEB.

We still have not figured out how to plot .gb files. An explanation of how the node list and arc list interact would be very helpful if possible.

Thank you very much for taking the time to consider our query. Our mathematical art project(s) will be submitted to Bridges Eindhoven 2025 (https://www.bridgesmathart.org/) and we would certainly include you as a contributor

Best regards, Edward Vogel

ascherer commented 6 months ago

It's been almost thirty years since I last worked with The Stanford GraphBase (apart from hacking the C code). Don Knuth's book describing the SGB system contains several graphics, some of which are available on the internet:

Otherwise, there is no direct way to plot *.gb files, least in CWEB.

ascherer commented 6 months ago

You can restore_graph("somap2.gb"), as for example in ham.w. Clone both my sgb and my cwebtest projects (next to each other). Then try something like this:

cd sgb
make tests
cd ../cwebtest
ctangle ham.w
gcc -I../sgb -L../sgb -lgb ham.c -o ham
./ham somap2.gb

This gives the following output for me:

 2 5 3 2 2 3 4 1 1 2 1 4 3 5 5 5 6 5 4 3 4 4 3 4 4 5 3 3 2 4 3 2 3 2 3 3 3 3 4 6 5 4 6 4 2 4 3 3
 2 2 1 0 1 2 2 0 2 0 3 1 1 1 3 0 3 5 1 4 4 6 3 3 5 3 3 2 1 0 1 1 0 1 2 1 1 0 3 3 3 3 2 2 1 3 2 3
 3 2 3 3 3 1 2 2 3 2 3 5 5 7 6 4 6 2 3 2 1 2 3 3 5 6 3 5 4 3 2 2 4 3 3 2 2 4 4 2 2 3 2 2 1 2 2 2
 3 3 4 5 5 4 4 5 5 2 1 2 1 2 0 2 1 2 1 2 1 2 3 2 2 2 3 5 3 3 5 4 2 2 3 1 1 1 2 2 3 1 2 1 0 1 1 1
 3 3 3 4 4 3 2 1 1 2 1 4 3 3 4 4 3 1 0 0 1 1 0 1 0 2 2 1 0 1 2 1 1 1 2 2 0 4 3 4 3 1 2 4 2 2 2 2
The minimum degree is 0 (vertex #4158)!

Other SGB programs may also give useful results for the SOMAP graph.

EdV2 commented 6 months ago

Hi - one of my student collaborators was working this portion and won't be available again until summer research.   I have a copy of  "The Stanford GraphBase: A Platform for Combinatorial Computing" coming in the mail to help me get up to speed ahead the summer projects.  I am finding "https://github.com/ascherer/sgb/blob/master/gb_graph.w" helpful in understanding the file structure and node, arc relationship.  Thank you very much for taking the time to help me.  I think Knuth's analysis of Conway, Guy and Guy's SOMAP will make for great mathematical art projects this summer.   Best regards,                     Edward Vogel                     763-442-6083

On Tuesday, April 23, 2024 at 12:57:24 PM CDT, Andreas Scherer ***@***.***> wrote:  

You can restore_graph("somap2.gb"), as for example in ham.w. Clone both my sgb and my cwebtest projects (next to each other). Then try something like this: cd sgb make tests cd ../cwebtest ctangle ham.w gcc -I../sgb -L../sgb -lgb ham.c -o ham ./ham somap2.gb

This gives the following output for me: 2 5 3 2 2 3 4 1 1 2 1 4 3 5 5 5 6 5 4 3 4 4 3 4 4 5 3 3 2 4 3 2 3 2 3 3 3 3 4 6 5 4 6 4 2 4 3 3 2 2 1 0 1 2 2 0 2 0 3 1 1 1 3 0 3 5 1 4 4 6 3 3 5 3 3 2 1 0 1 1 0 1 2 1 1 0 3 3 3 3 2 2 1 3 2 3 3 2 3 3 3 1 2 2 3 2 3 5 5 7 6 4 6 2 3 2 1 2 3 3 5 6 3 5 4 3 2 2 4 3 3 2 2 4 4 2 2 3 2 2 1 2 2 2 3 3 4 5 5 4 4 5 5 2 1 2 1 2 0 2 1 2 1 2 1 2 3 2 2 2 3 5 3 3 5 4 2 2 3 1 1 1 2 2 3 1 2 1 0 1 1 1 3 3 3 4 4 3 2 1 1 2 1 4 3 3 4 4 3 1 0 0 1 1 0 1 0 2 2 1 0 1 2 1 1 1 2 2 0 4 3 4 3 1 2 4 2 2 2 2 The minimum degree is 0 (vertex #4158)!

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

ascherer commented 6 months ago

I have a copy of "The Stanford GraphBase: A Platform for Combinatorial Computing" coming in the mail to help me get up to speed ahead the summer projects.

I suggest to also get Don Knuth's The Art of Computer Programming, Vol. 4B. From Fascicle 5c I surmise that Section 7.2.2.1 broadly covers "cuboids".