*****************************************************************************
*       www.FindStat.org - The Combinatorial Statistic Finder               *
*                                                                           *
*       Copyright (C) 2019 The FindStatCrew <info@findstat.org>             *
*                                                                           *
*    This information is distributed in the hope that it will be useful,    *
*    but WITHOUT ANY WARRANTY; without even the implied warranty of         *
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                   *
*****************************************************************************

-----------------------------------------------------------------------------
Statistic identifier: St001060

-----------------------------------------------------------------------------
Collection: Graphs

-----------------------------------------------------------------------------
Description: The distinguishing index of a graph.

This is the smallest number of colours such that there is a colouring of the edges which is not preserved by any automorphism.

If the graph has a connected component which is a single edge, or at least two isolated vertices, this statistic is undefined.

-----------------------------------------------------------------------------
References: [1]   Kalinowski, Rafał, Pilśniak, M. Distinguishing graphs by edge-colourings [[MathSciNet:3286626]]

-----------------------------------------------------------------------------
Code:
def statistic(G):
    """the smallest number of colours such that there is a colouring of
    the edges which is not preserved by any automorphism.

    sage: [statistic(graphs.CycleGraph(r)) for r in range(3,7)]
    [3, 3, 3, 2]

    sage: [statistic(graphs.CompleteGraph(r)) for r in range(3,8)]
    [3, 3, 3, 2, 2]

    sage: [statistic(graphs.CompleteBipartiteGraph(1,r)) for r in range(3,8)]
    [3, 4, 5, 6, 7]
    """
    G = G.copy(immutable=False)
    for c in range(G.num_edges()+1):
        # try to find a colouring
        V = G.edges(labels=False)
        # partition the set of edges into c parts
        for colouring in SetPartitions(V, c):
            for i, block in enumerate(colouring):
                for u, v in block:
                    G.set_edge_label(u,v,i)
            if G.automorphism_group(edge_labels=True, order=True)[1] == 1:
                return c

-----------------------------------------------------------------------------
Statistic values:

([(0,2),(1,2)],3)                                                                               => 2
([(0,1),(0,2),(1,2)],3)                                                                         => 3
([(1,3),(2,3)],4)                                                                               => 2
([(0,3),(1,3),(2,3)],4)                                                                         => 3
([(0,3),(1,2),(2,3)],4)                                                                         => 2
([(1,2),(1,3),(2,3)],4)                                                                         => 3
([(0,3),(1,2),(1,3),(2,3)],4)                                                                   => 2
([(0,2),(0,3),(1,2),(1,3)],4)                                                                   => 3
([(0,2),(0,3),(1,2),(1,3),(2,3)],4)                                                             => 2
([(0,1),(0,2),(0,3),(1,2),(1,3),(2,3)],4)                                                       => 3
([(1,4),(2,4),(3,4)],5)                                                                         => 3
([(0,4),(1,4),(2,4),(3,4)],5)                                                                   => 4
([(1,4),(2,3),(3,4)],5)                                                                         => 2
([(0,4),(1,4),(2,3),(3,4)],5)                                                                   => 2
([(1,4),(2,3),(2,4),(3,4)],5)                                                                   => 2
([(0,4),(1,4),(2,3),(2,4),(3,4)],5)                                                             => 2
([(1,3),(1,4),(2,3),(2,4)],5)                                                                   => 3
([(0,4),(1,2),(1,3),(2,4),(3,4)],5)                                                             => 2
([(1,3),(1,4),(2,3),(2,4),(3,4)],5)                                                             => 2
([(0,4),(1,3),(2,3),(2,4),(3,4)],5)                                                             => 2
([(0,4),(1,3),(1,4),(2,3),(2,4),(3,4)],5)                                                       => 2
([(0,3),(0,4),(1,3),(1,4),(2,3),(2,4)],5)                                                       => 2
([(0,3),(0,4),(1,3),(1,4),(2,3),(2,4),(3,4)],5)                                                 => 2
([(0,4),(1,3),(2,3),(2,4)],5)                                                                   => 2
([(0,3),(1,2),(1,4),(2,4),(3,4)],5)                                                             => 2
([(0,3),(0,4),(1,2),(1,4),(2,4),(3,4)],5)                                                       => 2
([(0,3),(0,4),(1,2),(1,4),(2,3)],5)                                                             => 3
([(0,1),(0,4),(1,3),(2,3),(2,4),(3,4)],5)                                                       => 2
([(0,3),(0,4),(1,2),(1,4),(2,3),(2,4),(3,4)],5)                                                 => 2
([(0,4),(1,2),(1,3),(2,3),(2,4),(3,4)],5)                                                       => 2
([(1,2),(1,3),(1,4),(2,3),(2,4),(3,4)],5)                                                       => 3
([(0,4),(1,2),(1,3),(1,4),(2,3),(2,4),(3,4)],5)                                                 => 2
([(0,3),(0,4),(1,2),(1,3),(1,4),(2,3),(2,4),(3,4)],5)                                           => 2
([(0,3),(0,4),(1,2),(1,3),(1,4),(2,3),(2,4)],5)                                                 => 2
([(0,2),(0,3),(0,4),(1,2),(1,3),(1,4),(2,4),(3,4)],5)                                           => 2
([(0,2),(0,3),(0,4),(1,2),(1,3),(1,4),(2,3),(2,4),(3,4)],5)                                     => 2
([(0,1),(0,2),(0,3),(0,4),(1,2),(1,3),(1,4),(2,3),(2,4),(3,4)],5)                               => 3
([(1,5),(2,5),(3,5),(4,5)],6)                                                                   => 4
([(0,5),(1,5),(2,5),(3,5),(4,5)],6)                                                             => 5
([(1,5),(2,5),(3,4),(4,5)],6)                                                                   => 2
([(0,5),(1,5),(2,5),(3,4),(4,5)],6)                                                             => 3
([(1,5),(2,5),(3,4),(3,5),(4,5)],6)                                                             => 2
([(0,5),(1,5),(2,5),(3,4),(3,5),(4,5)],6)                                                       => 3
([(0,5),(1,5),(2,4),(3,4)],6)                                                                   => 3
([(1,5),(2,3),(2,4),(3,5),(4,5)],6)                                                             => 2
([(0,5),(1,5),(2,3),(3,4),(4,5)],6)                                                             => 2
([(1,5),(2,4),(3,4),(3,5),(4,5)],6)                                                             => 2
([(0,5),(1,5),(2,4),(3,4),(4,5)],6)                                                             => 3
([(0,5),(1,5),(2,3),(2,4),(3,5),(4,5)],6)                                                       => 2
([(1,5),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                                       => 2
([(0,5),(1,5),(2,4),(3,4),(3,5),(4,5)],6)                                                       => 2
([(0,5),(1,5),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                                 => 2
([(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)],6)                                                       => 2
([(0,5),(1,4),(2,4),(2,5),(3,4),(3,5)],6)                                                       => 2
([(0,5),(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)],6)                                                 => 2
([(1,4),(1,5),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                                 => 2
([(0,5),(1,4),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                                 => 2
([(0,5),(1,4),(1,5),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                           => 2
([(0,4),(0,5),(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)],6)                                           => 3
([(0,4),(0,5),(1,4),(1,5),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                     => 3
([(1,5),(2,4),(3,4),(3,5)],6)                                                                   => 2
([(0,5),(1,4),(2,3),(3,5),(4,5)],6)                                                             => 2
([(1,4),(2,3),(2,5),(3,5),(4,5)],6)                                                             => 2
([(0,4),(1,5),(2,3),(2,5),(3,5),(4,5)],6)                                                       => 2
([(1,4),(1,5),(2,3),(2,5),(3,5),(4,5)],6)                                                       => 2
([(0,5),(1,4),(1,5),(2,3),(2,5),(3,5),(4,5)],6)                                                 => 2
([(1,4),(1,5),(2,3),(2,5),(3,4)],6)                                                             => 3
([(0,5),(1,4),(2,3),(2,4),(3,5),(4,5)],6)                                                       => 2
([(1,2),(1,5),(2,4),(3,4),(3,5),(4,5)],6)                                                       => 2
([(0,5),(1,2),(1,4),(2,3),(3,5),(4,5)],6)                                                       => 2
([(1,5),(2,3),(2,4),(3,4),(3,5),(4,5)],6)                                                       => 2
([(0,5),(1,4),(2,3),(3,4),(3,5),(4,5)],6)                                                       => 2
([(0,5),(1,2),(1,5),(2,4),(3,4),(3,5),(4,5)],6)                                                 => 1
([(0,5),(1,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                                 => 1
([(1,4),(1,5),(2,3),(2,5),(3,4),(3,5),(4,5)],6)                                                 => 2
([(0,5),(1,4),(1,5),(2,3),(2,5),(3,4),(3,5),(4,5)],6)                                           => 2
([(0,5),(1,4),(2,3),(2,4),(3,5)],6)                                                             => 2
([(0,5),(1,5),(2,3),(2,4),(3,4)],6)                                                             => 3
([(0,4),(1,2),(1,3),(2,5),(3,5),(4,5)],6)                                                       => 2
([(0,4),(1,2),(1,5),(2,5),(3,4),(3,5)],6)                                                       => 2
([(0,4),(1,2),(2,5),(3,4),(3,5),(4,5)],6)                                                       => 1
([(0,4),(1,4),(2,3),(2,5),(3,5),(4,5)],6)                                                       => 2
([(0,3),(0,4),(1,2),(1,5),(2,5),(3,5),(4,5)],6)                                                 => 2
([(0,3),(1,4),(1,5),(2,4),(2,5),(3,5),(4,5)],6)                                                 => 2
([(0,4),(1,2),(1,5),(2,5),(3,4),(3,5),(4,5)],6)                                                 => 2
([(0,1),(0,5),(1,5),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                           => 2
([(0,5),(1,5),(2,3),(2,4),(3,4),(3,5),(4,5)],6)                                                 => 2
([(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                                 => 2
([(0,5),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                           => 2
([(0,1),(0,5),(1,4),(2,4),(2,5),(3,4),(3,5)],6)                                                 => 2
([(0,3),(0,5),(1,3),(1,5),(2,4),(2,5),(3,4),(4,5)],6)                                           => 2
([(0,3),(1,4),(1,5),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                           => 2
([(0,5),(1,4),(1,5),(2,3),(2,4),(3,4),(3,5),(4,5)],6)                                           => 1
([(0,1),(0,5),(1,4),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                           => 2
([(0,4),(0,5),(1,4),(1,5),(2,3),(2,5),(3,4),(3,5),(4,5)],6)                                     => 2
([(0,5),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5)],6)                                           => 2
([(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                           => 2
([(0,5),(1,4),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                           => 2
([(0,5),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                     => 2
([(0,4),(0,5),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5)],6)                                     => 2
([(0,4),(0,5),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                               => 2
([(0,5),(1,3),(1,4),(2,3),(2,4),(3,5),(4,5)],6)                                                 => 2
([(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5)],6)                                                 => 2
([(0,5),(1,3),(1,4),(2,3),(2,4),(2,5),(3,5),(4,5)],6)                                           => 2
([(1,3),(1,4),(1,5),(2,3),(2,4),(2,5),(3,5),(4,5)],6)                                           => 2
([(0,5),(1,3),(1,4),(1,5),(2,3),(2,4),(2,5),(3,5),(4,5)],6)                                     => 2
([(0,4),(0,5),(1,2),(1,3),(2,5),(3,4)],6)                                                       => 2
([(0,3),(0,5),(1,2),(1,5),(2,4),(3,4),(4,5)],6)                                                 => 2
([(0,5),(1,2),(1,4),(2,3),(3,4),(3,5),(4,5)],6)                                                 => 2
([(0,1),(0,2),(1,5),(2,4),(3,4),(3,5),(4,5)],6)                                                 => 2
([(0,5),(1,4),(2,3),(2,4),(2,5),(3,4),(3,5)],6)                                                 => 2
([(0,5),(1,3),(1,4),(2,4),(2,5),(3,4),(3,5)],6)                                                 => 1
([(0,1),(0,5),(1,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                           => 1
([(0,4),(1,3),(1,5),(2,3),(2,4),(2,5),(3,5),(4,5)],6)                                           => 1
([(0,4),(0,5),(1,3),(1,5),(2,3),(2,4),(3,5),(4,5)],6)                                           => 2
([(0,4),(0,5),(1,3),(1,5),(2,3),(2,4),(2,5),(3,5),(4,5)],6)                                     => 2
([(0,5),(1,2),(1,3),(1,4),(2,3),(2,4),(3,5),(4,5)],6)                                           => 2
([(0,4),(0,5),(1,2),(1,3),(1,5),(2,4),(2,5),(3,4),(3,5)],6)                                     => 2
([(0,4),(0,5),(1,2),(1,3),(1,5),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                               => 2
([(0,5),(1,2),(1,3),(1,4),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                     => 2
([(1,3),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                     => 2
([(0,5),(1,3),(1,4),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                     => 2
([(0,5),(1,3),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                               => 2
([(0,4),(0,5),(1,2),(1,4),(2,3),(2,5),(3,4),(3,5),(4,5)],6)                                     => 1
([(0,4),(0,5),(1,3),(1,5),(2,3),(2,4),(3,4),(3,5),(4,5)],6)                                     => 2
([(0,4),(0,5),(1,3),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                               => 2
([(0,4),(0,5),(1,3),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                         => 2
([(0,4),(0,5),(1,3),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5)],6)                               => 2
([(0,4),(0,5),(1,2),(1,3),(2,3),(4,5)],6)                                                       => 4
([(0,2),(1,4),(1,5),(2,3),(3,4),(3,5),(4,5)],6)                                                 => 2
([(0,1),(0,5),(1,5),(2,3),(2,4),(3,4),(4,5)],6)                                                 => 2
([(0,1),(0,5),(1,5),(2,3),(2,4),(3,4),(3,5),(4,5)],6)                                           => 2
([(0,1),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                           => 2
([(0,1),(0,5),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                     => 2
([(0,4),(0,5),(1,2),(1,3),(2,3),(2,5),(3,4),(4,5)],6)                                           => 2
([(0,4),(0,5),(1,2),(1,3),(1,4),(2,3),(2,5),(3,5),(4,5)],6)                                     => 2
([(0,3),(1,2),(1,4),(1,5),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                     => 2
([(0,3),(0,5),(1,2),(1,4),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                     => 2
([(0,1),(0,5),(1,4),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                     => 2
([(0,3),(0,5),(1,2),(1,4),(1,5),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                               => 2
([(0,3),(0,4),(0,5),(1,2),(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)],6)                               => 2
([(0,3),(0,4),(0,5),(1,2),(1,4),(1,5),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                         => 2
([(0,4),(0,5),(1,3),(1,5),(2,3),(2,4),(2,5),(3,4)],6)                                           => 2
([(0,1),(0,5),(1,4),(2,3),(2,4),(2,5),(3,4),(3,5)],6)                                           => 2
([(0,3),(0,4),(1,2),(1,4),(1,5),(2,3),(2,5),(3,5),(4,5)],6)                                     => 2
([(0,3),(0,4),(0,5),(1,2),(1,4),(1,5),(2,3),(2,5),(3,5),(4,5)],6)                               => 2
([(0,3),(0,4),(0,5),(1,2),(1,4),(1,5),(2,3),(2,5),(3,4)],6)                                     => 2
([(0,1),(0,3),(0,5),(1,2),(1,4),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                               => 2
([(0,4),(0,5),(1,2),(1,3),(1,5),(2,3),(2,4),(3,4),(3,5),(4,5)],6)                               => 2
([(0,1),(0,4),(0,5),(1,3),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                         => 2
([(0,3),(0,4),(0,5),(1,2),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                   => 2
([(0,2),(0,5),(1,3),(1,4),(1,5),(2,3),(2,4),(3,4),(3,5),(4,5)],6)                               => 2
([(0,4),(0,5),(1,2),(1,3),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                         => 2
([(0,5),(1,2),(1,3),(1,4),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                               => 2
([(1,2),(1,3),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                               => 3
([(0,5),(1,2),(1,3),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                         => 2
([(0,4),(0,5),(1,2),(1,3),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                   => 2
([(0,3),(0,4),(0,5),(1,2),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5)],6)                         => 2
([(0,4),(0,5),(1,2),(1,3),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5)],6)                         => 2
([(0,2),(0,3),(0,4),(0,5),(1,2),(1,3),(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)],6)                   => 2
([(0,2),(0,3),(0,4),(0,5),(1,2),(1,3),(1,4),(1,5),(2,4),(2,5),(3,4),(3,5),(4,5)],6)             => 2
([(0,2),(0,3),(0,4),(0,5),(1,2),(1,3),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)       => 2
([(0,1),(0,2),(0,3),(0,4),(0,5),(1,2),(1,3),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6) => 2

-----------------------------------------------------------------------------
Created: Dec 12, 2017 at 11:00 by Martin Rubey

-----------------------------------------------------------------------------
Last Updated: Nov 18, 2021 at 11:51 by Martin Rubey