Rejecting isomorphisms from collection of graphs

前端 未结 6 1444
刺人心
刺人心 2020-12-30 03:06

I have a collection of 15M (Million) DAGs (directed acyclic graphs - directed hypercubes actually) that I would like to remove isomorphisms from. What is the common algorith

6条回答
  •  独厮守ぢ
    2020-12-30 04:01

    Maybe you can just use McKay's implementation? It is found here now: http://pallini.di.uniroma1.it/

    You can convert your 15M graphs to the compact graph6 format (or sparse6) which nauty uses and then run the nauty tool labelg to generate the canonical labels (also in graph6 format).

    For example - removing isomorphic graphs from a set of random graphs:

    #gnp.py
    import networkx as nx
    for i in range(100000):
        graph = nx.gnp_random_graph(10,0.1)
        print nx.generate_graph6(graph,header=False)
    
    
    [nauty25r9]$ python gnp.py > gnp.g6
    [nauty25r9]$ cat gnp.g6 |./labelg |sort |uniq -c |wc -l
    >A labelg
    >Z  10000 graphs labelled from stdin to stdout in 0.05 sec.
    710
    

提交回复
热议问题