[Nauty] Fw: Filters graphs with diameters greater than 2 and less than 4

keith.briggs at bt.com keith.briggs at bt.com
Fri Sep 29 17:26:10 AEST 2023


The line.replace statement won't do anything, since you throw away the result.

Keith

________________________________
From: Nauty <nauty-bounces at anu.edu.au> on behalf of lczhangmath <lczhangmath at 163.com>
Sent: Friday, September 29, 2023 6:37:51 am
To: nauty <nauty at anu.edu.au>
Subject: [Nauty] Fw: Filters graphs with diameters greater than 2 and less than 4

[
---- Forwarded Message ----
| From | lczhangmath<lczhangmath at 163.com> |
| Date | 09/29/2023 13:08 |
| To | Brendan McKay<brendan.mckay at anu.edu.au> |
| Subject | Re:Re: [Nauty] Filters graphs with diameters greater than 2 and less than 4 |
Dear  Prof. Brendan,


Thank you for informing me of the overlooked option. Before you informed me, I wrote a Python script. Of course, this script can combine some parameter filtering, a bit like the SageMath call. But I am very looking forward to your handling in C language.




Python script:


import subprocess
import sys
import networkx  as nx
completed_process = subprocess.run(['geng', '9', '8', '-b', '-c'], stdout=subprocess.PIPE, text=True)
output_lines = completed_process.stdout.splitlines()
count = 0
for line in output_lines:
    line=line.strip()
    #Eliminate the impact of escape characters
    line.replace("\\", "\\\\")
    G = nx.from_graph6_bytes(line.encode())
    if nx.diameter(G)<=4 and  nx.radius(G)>=2:
        count=count+1
        sg=nx.to_graph6_bytes(G)
        cleaned_g6string = sg[10:-1].decode()
        print(cleaned_g6string)
print(count,"graphs written to stdout")




Best wishes,
Licheng Zhang.











在 2023-09-28 20:19:36,"Brendan McKay" <Brendan.McKay at anu.edu.au> 写道:
>Hi Licheng,
>
>geng -c 7 | pickg -Z2:4
>
>You can use a range like that for all numerical parameters.  You can
>also use -Z:4 for <=4 and -Z2: for >=2.
>
>I'll answer your earlier question tomorrow.
>
>Brendan.
>
>On 28/9/2023 9:43 pm, lczhangmath wrote:
>> Hello,
>>
>>
>> The second question in my email, titled "matching number and operations between parameters", contains this question, and I recount it in detail here.
>>
>>
>> As with equations, we sometimes need to filter for cases that satisfy a parametric inequality. For example, I
>> would like to get all 7-vertex  graphs with diameter k where k is greater than or equal to 2 and less than or equal to 4.
>>
>>
>> At this time, either I use the external script (e.g. sagemath) or I run the following shell script, but the sctipt always repeats the execution of geng, so the efficiency is not high.
>>
>>
>> for i in {2..4}
>> do
>>      echo "Running geng 7 -c | pickg -V -Z$i"
>>      geng 7 -c | pickg -Z$i >> output.txt
>> done
>>
>>
>>   I don't know where I can change the source code to achieve this.
>>
>>
>>
>>
>> Best regards,
>> Licheng Zhang
>> _______________________________________________
>> Nauty mailing list
>> Nauty at anu.edu.au
>> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.anu.edu.au%2Fmailman%2Flistinfo%2Fnauty&data=05%7C01%7Ckeith.briggs%40bt.com%7C99e07c1b3fac49b7f7b308dbc0ae36a5%7Ca7f356889c004d5eba4129f146377ab0%7C0%7C0%7C638315626714540227%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=l55NjJSdBPmgVq9W2vulGj5HU6rrKFMZFsoExrdElxM%3D&reserved=0<https://mailman.anu.edu.au/mailman/listinfo/nauty>
>
>_______________________________________________
>Nauty mailing list
>Nauty at anu.edu.au
>https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.anu.edu.au%2Fmailman%2Flistinfo%2Fnauty&data=05%7C01%7Ckeith.briggs%40bt.com%7C99e07c1b3fac49b7f7b308dbc0ae36a5%7Ca7f356889c004d5eba4129f146377ab0%7C0%7C0%7C638315626714540227%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=l55NjJSdBPmgVq9W2vulGj5HU6rrKFMZFsoExrdElxM%3D&reserved=0<https://mailman.anu.edu.au/mailman/listinfo/nauty>
_______________________________________________
Nauty mailing list
Nauty at anu.edu.au
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.anu.edu.au%2Fmailman%2Flistinfo%2Fnauty&data=05%7C01%7Ckeith.briggs%40bt.com%7C99e07c1b3fac49b7f7b308dbc0ae36a5%7Ca7f356889c004d5eba4129f146377ab0%7C0%7C0%7C638315626714540227%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=l55NjJSdBPmgVq9W2vulGj5HU6rrKFMZFsoExrdElxM%3D&reserved=0<https://mailman.anu.edu.au/mailman/listinfo/nauty>



More information about the Nauty mailing list