[Nauty] Help request: representation of non-binary matrices as graphs

Alexandre Bohyn alexandre.bohyn at kuleuven.be
Thu Apr 22 22:35:33 AEST 2021


Hello NAUTY users,

I hope you are all doing well in those troubled times.
I'm a PhD student in applied statistics and I'm working on design of experiments. I'm currently using NAUTY to enumerate non-isomorphic experimental designs.
As some of you may know, an experimental design can be represented as a matrix of size [cid:image002.png at 01D73784.BFEA8EF0]  where each row [cid:image004.png at 01D73784.BFEA8EF0]  (with [cid:image006.png at 01D73784.BFEA8EF0] ), represents an experimental run and each column [cid:image008.png at 01D73784.BFEA8EF0]  (with [cid:image010.png at 01D73784.BFEA8EF0] ) represents an experimental factor.
Since, in most designs, the factors only take two levels, the matrix is often binary ([cid:image012.png at 01D73784.BFEA8EF0] denotes the high-level of a factor while [cid:image014.png at 01D73784.BFEA8EF0]  denotes the low-level of a factor).

I currently have a C program that enumerates all matrices corresponding to a subset of those designs. I also have another C program (created by someone else) that turns those designs into graphs, using the following method:

  *   for a [cid:image002.png at 01D73784.BFEA8EF0]  design matrix [cid:image031.png at 01D73784.BFEA8EF0] , create an empty graph [cid:image032.png at 01D73784.BFEA8EF0]  with [cid:image033.png at 01D73784.BFEA8EF0]  vertices
  *   if [cid:image034.png at 01D73784.BFEA8EF0] , then it means that in the th experimental run ([cid:image004.png at 01D73784.BFEA8EF0]), the th factor ([cid:image008.png at 01D73784.BFEA8EF0]) is on the high-level (1), so we create an edge in [cid:image032.png at 01D73784.BFEA8EF0]  between vertex [cid:image004.png at 01D73784.BFEA8EF0]  and vertex [cid:image008.png at 01D73784.BFEA8EF0] .
The actual procedure uses the two NAUTY utility functions GRAPHROW and ADDELEMENT, in the following way (this is pseudo-code):

let D = [N x k] design matrix
let g = empty graph with N+k vertices
for i = 1 to N
     set_i = GRAPHROW(g,i)
     for j = 1 to k
           if D[i,j] = 1
                col_vertex = N + j
                set_j = GRAPHROW(g,col_vertex)
                ADDELEMENT(set_i,col_vertex)
                ADDELEMENT(set_j,i)
           endif
     endfor
endfor
writes6(outfile,g)

This graph is then written in the sparse6 format and I use the shortg procedure to find all isomorphs in those graphs, and thus getting the non-isomorphic designs.

My question is about adapting this procedure for mixed-level designs, i.e., designs where the factors might have other values than 0 or 1. For example I have a design matrix where the first column can take values of 0, 1, 2 or 3, and where the rest of the matrix is binary. How should I represent that matrix as a graph, to later feed it to the shortg procedure ?

I have a limited experience in C, so ideally,  I would want to adapt the current procedure that I have so that I don't have to re-write too much code.
I tried to adapt it myself but I keep running into errors, so any help would be welcome.

Best regards and take care,

Alexandre Bohyn
PhD Student
Division of Mechatronics, Biostatistics and Sensors (MeBioS)

[cid:image015.png at 01D73780.BC0F2650]

-------------- next part --------------
A non-text attachment was scrubbed...
Name: image015.png
Type: image/png
Size: 1182 bytes
Desc: image015.png
URL: <https://mailman.anu.edu.au/pipermail/nauty/attachments/20210422/a646c452/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 508 bytes
Desc: image002.png
URL: <https://mailman.anu.edu.au/pipermail/nauty/attachments/20210422/a646c452/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 320 bytes
Desc: image004.png
URL: <https://mailman.anu.edu.au/pipermail/nauty/attachments/20210422/a646c452/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image006.png
Type: image/png
Size: 526 bytes
Desc: image006.png
URL: <https://mailman.anu.edu.au/pipermail/nauty/attachments/20210422/a646c452/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image008.png
Type: image/png
Size: 341 bytes
Desc: image008.png
URL: <https://mailman.anu.edu.au/pipermail/nauty/attachments/20210422/a646c452/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image010.png
Type: image/png
Size: 499 bytes
Desc: image010.png
URL: <https://mailman.anu.edu.au/pipermail/nauty/attachments/20210422/a646c452/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image012.png
Type: image/png
Size: 257 bytes
Desc: image012.png
URL: <https://mailman.anu.edu.au/pipermail/nauty/attachments/20210422/a646c452/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image014.png
Type: image/png
Size: 306 bytes
Desc: image014.png
URL: <https://mailman.anu.edu.au/pipermail/nauty/attachments/20210422/a646c452/attachment-0007.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image031.png
Type: image/png
Size: 336 bytes
Desc: image031.png
URL: <https://mailman.anu.edu.au/pipermail/nauty/attachments/20210422/a646c452/attachment-0008.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image032.png
Type: image/png
Size: 358 bytes
Desc: image032.png
URL: <https://mailman.anu.edu.au/pipermail/nauty/attachments/20210422/a646c452/attachment-0009.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image033.png
Type: image/png
Size: 473 bytes
Desc: image033.png
URL: <https://mailman.anu.edu.au/pipermail/nauty/attachments/20210422/a646c452/attachment-0010.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image034.png
Type: image/png
Size: 508 bytes
Desc: image034.png
URL: <https://mailman.anu.edu.au/pipermail/nauty/attachments/20210422/a646c452/attachment-0011.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image039.png
Type: image/png
Size: 269 bytes
Desc: image039.png
URL: <https://mailman.anu.edu.au/pipermail/nauty/attachments/20210422/a646c452/attachment-0012.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image040.png
Type: image/png
Size: 292 bytes
Desc: image040.png
URL: <https://mailman.anu.edu.au/pipermail/nauty/attachments/20210422/a646c452/attachment-0013.png>


More information about the Nauty mailing list