*****************************************************************************
*       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: St001812

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

-----------------------------------------------------------------------------
Description: The biclique partition number of a graph.

The biclique partition number of a graph is the minimum number of pairwise edge disjoint complete bipartite subgraphs so that each edge belongs to exactly one of them.  A theorem of Graham and Pollak [1] asserts that the complete graph $K_n$ has biclique partition number $n - 1$.

-----------------------------------------------------------------------------
References: [1]   Graham, R. L., Pollak, H. O. On the addressing problem for loop switching [[MathSciNet:0289210]]

-----------------------------------------------------------------------------
Code:
@cached_function
def statistic(G, certificate=False, verbose=False):
    """
    sage: [statistic(graphs.CompleteGraph(n)) for n in range(1,6)]
    [0, 1, 2, 3, 4]
    sage: [statistic(graphs.PathGraph(n)) for n in range(1,8)]
    [0, 1, 1, 2, 2, 3, 3]
    sage: [statistic(graphs.CycleGraph(n)) for n in range(1,8)]
    [0, 1, 2, 1, 3, 3, 4]
    sage: n=5; all(statistic(G) <= n-G.independent_set(value_only=True) for G in graphs(n))
    True
    """
    E = G.edges(labels=False)
    if not E:
        return 0
    for c in range(1, len(E)+1):
        for p in SetPartitions(E, c):
            if verbose: print("P", p)
            for b in p:
                V = [u for e in b for u in e]
                H = G.subgraph(edges=b, vertices=V)
                if verbose: print("V", H.vertices(), "E", H.edges(labels=False))
                is_bipartite, bipartition = H.is_bipartite(certificate=True)
                if is_bipartite:
                    if verbose: print(bipartition)
                    k = list(bipartition.values()).count(0)
                    l = H.num_verts() - k
                    B = graphs.CompleteBipartiteGraph(k, l)
                    if not H.is_isomorphic(B):
                        if verbose: print("not complete")
                        break
                else:
                    if verbose: print("not bipartite")                    
                    break
            else:
                if certificate:
                    return c, p
                return c
                

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

([],1)                                                                        => 0
([],2)                                                                        => 0
([(0,1)],2)                                                                   => 1
([],3)                                                                        => 0
([(1,2)],3)                                                                   => 1
([(0,2),(1,2)],3)                                                             => 1
([(0,1),(0,2),(1,2)],3)                                                       => 2
([],4)                                                                        => 0
([(2,3)],4)                                                                   => 1
([(1,3),(2,3)],4)                                                             => 1
([(0,3),(1,3),(2,3)],4)                                                       => 1
([(0,3),(1,2)],4)                                                             => 2
([(0,3),(1,2),(2,3)],4)                                                       => 2
([(1,2),(1,3),(2,3)],4)                                                       => 2
([(0,3),(1,2),(1,3),(2,3)],4)                                                 => 2
([(0,2),(0,3),(1,2),(1,3)],4)                                                 => 1
([(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
([],5)                                                                        => 0
([(3,4)],5)                                                                   => 1
([(2,4),(3,4)],5)                                                             => 1
([(1,4),(2,4),(3,4)],5)                                                       => 1
([(0,4),(1,4),(2,4),(3,4)],5)                                                 => 1
([(1,4),(2,3)],5)                                                             => 2
([(1,4),(2,3),(3,4)],5)                                                       => 2
([(0,1),(2,4),(3,4)],5)                                                       => 2
([(2,3),(2,4),(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)                                                 => 1
([(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)                                     => 1
([(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,1),(2,3),(2,4),(3,4)],5)                                                 => 3
([(0,3),(1,2),(1,4),(2,4),(3,4)],5)                                           => 3
([(0,3),(0,4),(1,2),(1,4),(2,4),(3,4)],5)                                     => 3
([(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)                               => 3
([(0,4),(1,2),(1,3),(2,3),(2,4),(3,4)],5)                                     => 3
([(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)                               => 3
([(0,3),(0,4),(1,2),(1,3),(1,4),(2,3),(2,4),(3,4)],5)                         => 3
([(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)                   => 3
([(0,1),(0,2),(0,3),(0,4),(1,2),(1,3),(1,4),(2,3),(2,4),(3,4)],5)             => 4
([],6)                                                                        => 0
([(4,5)],6)                                                                   => 1
([(3,5),(4,5)],6)                                                             => 1
([(2,5),(3,5),(4,5)],6)                                                       => 1
([(1,5),(2,5),(3,5),(4,5)],6)                                                 => 1
([(0,5),(1,5),(2,5),(3,5),(4,5)],6)                                           => 1
([(2,5),(3,4)],6)                                                             => 2
([(2,5),(3,4),(4,5)],6)                                                       => 2
([(1,2),(3,5),(4,5)],6)                                                       => 2
([(3,4),(3,5),(4,5)],6)                                                       => 2
([(1,5),(2,5),(3,4),(4,5)],6)                                                 => 2
([(0,1),(2,5),(3,5),(4,5)],6)                                                 => 2
([(2,5),(3,4),(3,5),(4,5)],6)                                                 => 2
([(0,5),(1,5),(2,5),(3,4),(4,5)],6)                                           => 2
([(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)                                     => 2
([(2,4),(2,5),(3,4),(3,5)],6)                                                 => 1
([(0,5),(1,5),(2,4),(3,4)],6)                                                 => 2
([(1,5),(2,3),(2,4),(3,5),(4,5)],6)                                           => 2
([(0,5),(1,5),(2,3),(3,4),(4,5)],6)                                           => 2
([(2,4),(2,5),(3,4),(3,5),(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)                                           => 2
([(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)                                     => 1
([(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)                         => 1
([(0,4),(0,5),(1,4),(1,5),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                   => 2
([(0,5),(1,4),(2,3)],6)                                                       => 3
([(1,5),(2,4),(3,4),(3,5)],6)                                                 => 2
([(0,1),(2,5),(3,4),(4,5)],6)                                                 => 3
([(1,2),(3,4),(3,5),(4,5)],6)                                                 => 3
([(0,5),(1,4),(2,3),(3,5),(4,5)],6)                                           => 3
([(1,4),(2,3),(2,5),(3,5),(4,5)],6)                                           => 3
([(0,1),(2,5),(3,4),(3,5),(4,5)],6)                                           => 3
([(0,4),(1,5),(2,3),(2,5),(3,5),(4,5)],6)                                     => 3
([(1,4),(1,5),(2,3),(2,5),(3,5),(4,5)],6)                                     => 3
([(0,5),(1,4),(1,5),(2,3),(2,5),(3,5),(4,5)],6)                               => 3
([(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)                                     => 3
([(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)                                     => 3
([(1,5),(2,3),(2,4),(3,4),(3,5),(4,5)],6)                                     => 3
([(0,5),(1,4),(2,3),(3,4),(3,5),(4,5)],6)                                     => 3
([(0,5),(1,2),(1,5),(2,4),(3,4),(3,5),(4,5)],6)                               => 3
([(0,5),(1,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                               => 3
([(1,4),(1,5),(2,3),(2,5),(3,4),(3,5),(4,5)],6)                               => 3
([(0,5),(1,4),(1,5),(2,3),(2,5),(3,4),(3,5),(4,5)],6)                         => 3
([(0,5),(1,4),(2,3),(2,4),(3,5)],6)                                           => 3
([(0,1),(2,4),(2,5),(3,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)                                     => 3
([(0,4),(1,2),(2,5),(3,4),(3,5),(4,5)],6)                                     => 3
([(0,1),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                     => 3
([(0,4),(1,4),(2,3),(2,5),(3,5),(4,5)],6)                                     => 3
([(0,3),(0,4),(1,2),(1,5),(2,5),(3,5),(4,5)],6)                               => 3
([(0,3),(1,4),(1,5),(2,4),(2,5),(3,5),(4,5)],6)                               => 3
([(0,4),(1,2),(1,5),(2,5),(3,4),(3,5),(4,5)],6)                               => 3
([(0,1),(0,5),(1,5),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                         => 3
([(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                                     => 3
([(0,5),(1,5),(2,3),(2,4),(3,4),(3,5),(4,5)],6)                               => 3
([(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                               => 3
([(0,5),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                         => 3
([(0,1),(0,5),(1,4),(2,4),(2,5),(3,4),(3,5)],6)                               => 3
([(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)                         => 3
([(0,5),(1,4),(1,5),(2,3),(2,4),(3,4),(3,5),(4,5)],6)                         => 3
([(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)                   => 3
([(0,5),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5)],6)                         => 3
([(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                         => 3
([(0,5),(1,4),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                         => 3
([(0,5),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                   => 3
([(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)             => 3
([(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)                                     => 3
([(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)                               => 3
([(0,5),(1,4),(2,3),(2,4),(2,5),(3,4),(3,5)],6)                               => 3
([(0,5),(1,3),(1,4),(2,4),(2,5),(3,4),(3,5)],6)                               => 3
([(0,4),(1,3),(1,5),(2,3),(2,4),(2,5),(3,5),(4,5)],6)                         => 3
([(0,5),(1,2),(1,3),(1,4),(2,3),(2,4),(3,5),(4,5)],6)                         => 3
([(0,5),(1,2),(1,3),(1,4),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                   => 3
([(1,3),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                   => 3
([(0,5),(1,3),(1,4),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                   => 3
([(0,5),(1,3),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)             => 3
([(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)                               => 3
([(0,1),(0,5),(1,5),(2,3),(2,4),(3,4),(4,5)],6)                               => 4
([(0,1),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                               => 4
([(0,1),(0,5),(1,5),(2,3),(2,4),(3,4),(3,5),(4,5)],6)                         => 4
([(0,1),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                         => 4
([(0,1),(0,5),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                   => 4
([(0,4),(0,5),(1,2),(1,3),(1,4),(2,3),(2,5),(3,5),(4,5)],6)                   => 3
([(0,3),(1,2),(1,4),(1,5),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                   => 4
([(0,1),(0,5),(1,4),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)                   => 3
([(0,3),(0,5),(1,2),(1,4),(1,5),(2,4),(2,5),(3,4),(3,5),(4,5)],6)             => 4
([(0,1),(0,5),(1,4),(2,3),(2,4),(2,5),(3,4),(3,5)],6)                         => 4
([(0,3),(0,4),(1,2),(1,4),(1,5),(2,3),(2,5),(3,5),(4,5)],6)                   => 3
([(0,3),(0,4),(0,5),(1,2),(1,4),(1,5),(2,3),(2,5),(3,5),(4,5)],6)             => 4
([(0,4),(0,5),(1,2),(1,3),(1,5),(2,3),(2,4),(3,4),(3,5),(4,5)],6)             => 3
([(0,2),(0,5),(1,3),(1,4),(1,5),(2,3),(2,4),(3,4),(3,5),(4,5)],6)             => 3
([(0,4),(0,5),(1,2),(1,3),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)       => 4
([(0,5),(1,2),(1,3),(1,4),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)             => 4
([(1,2),(1,3),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)             => 4
([(0,5),(1,2),(1,3),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)],6)       => 4
([(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) => 4
([(0,4),(0,5),(1,2),(1,3),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5)],6)       => 3

-----------------------------------------------------------------------------
Created: Jun 28, 2022 at 12:09 by Martin Rubey

-----------------------------------------------------------------------------
Last Updated: Aug 04, 2024 at 22:07 by Martin Rubey