Ticket #13058: trac_13058.reviewer.patch

File trac_13058.reviewer.patch, 11.6 KB (added by kini, 7 years ago)

apply to $SAGE_ROOT/devel/sage

  • sage/graphs/graph_generators.py

    # HG changeset patch
    # User Keshav Kini <keshav.kini@gmail.com>
    # Date 1338334156 25200
    # Node ID 528f0e5dd9978d6093426a38d38c5376a4f03951
    # Parent  e7e0b0bc0cd43b4c756e3eedda4072ce64a8a575
    Formatting, parse-time string concatenation, etc.
    
    diff --git a/sage/graphs/graph_generators.py b/sage/graphs/graph_generators.py
    a b  
    15131513
    15141514    def HallJankoGraph(self):
    15151515        r"""
    1516         Returns the Hall-Janko Graph.
    1517 
    1518         More information on the Hall-Janko on its :wikipedia:`Wikipedia page
    1519         <Hall-Janko_graph>`.
     1516        Returns the Hall-Janko graph.
     1517
     1518        For more information on the Hall-Janko graph, see its
     1519        :wikipedia:`Wikipedia page <Hall-Janko_graph>`.
    15201520
    15211521        EXAMPLES::
    15221522
     
    15261526            sage: g.is_vertex_transitive()
    15271527            True
    15281528
    1529         Is it really strongly regular with parameters 14,12 ? ::
     1529        Is it really strongly regular with parameters 14, 12? ::
    15301530
    15311531            sage: nu = set(g.neighbors(0))
    15321532            sage: for v in range(1, 100):
    1533             ...       if v in nu:
    1534             ...          expected = 14
    1535             ...       else:
    1536             ...          expected = 12
    1537             ...       nv = set(g.neighbors(v))
    1538             ...       nv.discard(0)
    1539             ...       if len(nu & nv) != expected:
    1540             ...          print "Something is wrong here !!!"
    1541             ...          break
     1533            ...     if v in nu:
     1534            ...        expected = 14
     1535            ...     else:
     1536            ...        expected = 12
     1537            ...     nv = set(g.neighbors(v))
     1538            ...     nv.discard(0)
     1539            ...     if len(nu & nv) != expected:
     1540            ...        print "Something is wrong here!!!"
     1541            ...        break
    15421542
    15431543        Some other properties that we know how to check::
    15441544
     
    15491549            sage: factor(g.characteristic_polynomial())
    15501550            (x - 36) * (x - 6)^36 * (x + 4)^63
    15511551        """
    1552         # Below are the lines generating the graph's sparse6 string. As it takes
    1553         # some time to run them, this method actually builds the graph from its
    1554         # sparse6 string.
     1552        # Below are the lines generating the graph's sparse6 string. As it
     1553        # takes some time to run them, this method actually builds the graph
     1554        # from its sparse6 string.
    15551555
    15561556        # from sage.interfaces.gap import gap
    1557         # gap.eval("g1 := (1,84)(2,20)(3,48)(4,56)(5,82)(6,67)(7,55)(8,41)(9,35)"+
    1558         #          "(10,40)(11,78)(12,100)(13,49)(14,37)(15,94)(16,76)(17,19)"+
    1559         #          "(18,44)(21,34)(22,85)(23,92)(24,57)(25,75)(26,28)(27,64)"+
    1560         #          "(29,90)(30,97)(31,38)(32,68)(33,69)(36,53)(39,61)(42,73)"+
    1561         #          "(43,91)(45,86)(46,81)(47,89)(50,93)(51,96)(52,72)(54,74)"+
    1562         #          "(58,99)(59,95)(60,63)(62,83)(65,70)(66,88)(71,87)(77,98)"+
    1563         #          "(79,80);")
    1564 
    1565         # gap.eval("g2 := (1,80,22)(2,9,11)(3,53,87)(4,23,78)(5,51,18)(6,37,24)"+
    1566         #          "(8,27,60)(10,62,47)(12,65,31)(13,64,19)(14,61,52)(15,98,25)"+
    1567         #          "(16,73,32)(17,39,33)(20,97,58)(21,96,67)(26,93,99)(28,57,35)"+
    1568         #          "(29,71,55)(30,69,45)(34,86,82)(38,59,94)(40,43,91)(42,68,44)"+
    1569         #          "(46,85,89)(48,76,90)(49,92,77)(50,66,88)(54,95,56)(63,74,72)"+
    1570         #          "(70,81,75)(79,100,83);")
     1557        # gap.eval("g1 := (1,84)(2,20)(3,48)(4,56)(5,82)(6,67)(7,55)(8,41)"
     1558        #          "(9,35)(10,40)(11,78)(12,100)(13,49)(14,37)(15,94)(16,76)"
     1559        #          "(17,19)(18,44)(21,34)(22,85)(23,92)(24,57)(25,75)(26,28)"
     1560        #          "(27,64)(29,90)(30,97)(31,38)(32,68)(33,69)(36,53)(39,61)"
     1561        #          "(42,73)(43,91)(45,86)(46,81)(47,89)(50,93)(51,96)(52,72)"
     1562        #          "(54,74)(58,99)(59,95)(60,63)(62,83)(65,70)(66,88)(71,87)"
     1563        #          "(77,98)(79,80);")
     1564
     1565        # gap.eval("g2 := (1,80,22)(2,9,11)(3,53,87)(4,23,78)(5,51,18)"
     1566        #          "(6,37,24)(8,27,60)(10,62,47)(12,65,31)(13,64,19)(14,61,52)"
     1567        #          "(15,98,25)(16,73,32)(17,39,33)(20,97,58)(21,96,67)"
     1568        #          "(26,93,99)(28,57,35)(29,71,55)(30,69,45)(34,86,82)"
     1569        #          "(38,59,94)(40,43,91)(42,68,44)(46,85,89)(48,76,90)"
     1570        #          "(49,92,77)(50,66,88)(54,95,56)(63,74,72)(70,81,75)"
     1571        #          "(79,100,83);")
    15711572
    15721573        # gap.eval("G := Group([g1,g2]);")
    1573         # edges=gap('Orbit(G,[1,5],OnSets)')
     1574        # edges = gap('Orbit(G,[1,5],OnSets)')
    15741575
    15751576        # edge_list = []
    1576         # for u,v in edges:
     1577        # for u, v in edges:
    15771578        #     edge_list.append((int(u),int(v)))
    15781579
    1579         # g = graph.Graph(edge_list, pos = {})
    1580         # return g.sparse6_string()
    1581 
    1582         string = (":~?@c__E@?g?A?w?A@GCA_?CA`OWF`W?EAW?@?_OD@_[GAgcIaGGB@OcIA"+
    1583                   "wCE@o_K_?GB@?WGAouC@OsN_?GB@O[GB`A@@_e?@OgLB_{Q_?GC@O[GAOs"+
    1584                   "OCWGBA?kKBPA@?_[KB_{OCPKT`o_RD`]A?o[HBOwODW?DA?cIB?wRDP[X`"+
    1585                   "ogKB_{QD@]B@o_KBPWXE`mC@o_JB?{PDPq@?oWGA_{OCPKTDp_YEwCA@_c"+
    1586                   "IBOwOC`OX_OGB@?WPDPcYFg?C@_gKBp?SE@cYF`{_`?SGAOoOC`_\\FwCE"+
    1587                   "A?gKBO{QD@k[FqI??_OFA_oQE@k\\Fq?`GgCB@pGRD@_XFP{a_?SE@ocIA"+
    1588                   "ooNCPOUEqU@?oODA?cJB_{UEqYC@_kLC@CREPk]GAGbHgCA@?SMBpCSD`["+
    1589                   "YFq?`Ga]BA?gPC`KSD`_\\Fa?cHWGB@?[IAooPD`[WF@s^HASeIg?@@OcP"+
    1590                   "C`KYF@w^GQ[h`O[HAooMC@CQCpSVEPk\\GaSeIG?FA?kLB_{OC`OVE@cYG"+
    1591                   "QUA@?WLBp?PC`KVEqKgJg?DA?sMBpCSDP[WEQKfIay@?_KD@_[GC`SUE@k"+
    1592                   "[FaKdHa[k_?OLC@CRD@WVEpo^HAWfIAciIqoo_?CB@?kMCpOUE`o\\GAKg"+
    1593                   "IQgq_?GD@_[GB?{OCpWVE@cYFACaHAWhJR?q_?CC@_kKBpC\\GACdHa[kJ"+
    1594                   "a{o_?CA?oOFBpGRD@o\\GaKdIQonKrOt_?WHA`?PC`KTD`k]FqSeIaolJr"+
    1595                   "CqLWCA@OkKCPGRDpcYGAKdIAgjJAsmJr?t__OE@ogJB_{XEps`HA[gIQwn"+
    1596                   "KWKGAOoMBpGUE`k[Fa?aHqckJbSuLw?@?_SHA_kLC@OTFPw^GaOkLg?B@?"+
    1597                   "[HA_{PDP_XFaCbHa[gIqooKRWx_?CFBpOTE@cZFPw^GACcHQgoKrSvMwWG"+
    1598                   "BOwQCp_YFP{`HASfJAwnKRSx_OSSDP[WEq?aGqSfIQsoKR_zNWCE@o_HA_"+
    1599                   "sREPg^GAGcHQWfIAciKbOxNg?A@__IAooMC`KTD`g\\GAKcIasoKrOtLb["+
    1600                   "wMbyCA?cKBp?TD`[WE`s^GQGbHqcjJrK{NRw~_oODA?sNC@CQCpOZF@s]G"+
    1601                   "QOfIaolJrGsLbk}_?OFA_sRD@SVE`k[HQcjJa{qLb[xMb|?_OOFA?cIAos"+
    1602                   "RDP_ZFa?aGqOfIAsuMbk{Ns@@OsQAA_sPDPWXE`o\\FqKdIQkkJrCuLr_x"+
    1603                   "Mro}NsDAPG?@@OWFApKUE@o`IQolKRKsLrc|NsQC@OWGAOgJCpOWE`o_GQ"+
    1604                   "KiIqwnKr_~OcLCPS]A?oWHA_oMBpKSDP[\\FagjKBWxMbk{OSQ@@O_IAoo"+
    1605                   "LBpCSD`g\\FaGbHQWgIQgmKRKwMRl?PgGC@OWHB@KSE@c[FqCaGqSeIAkk"+
    1606                   "KBCqLBSuMBpGQWCA@?cKBOwRDPWVE@k^GqOfJr?pKbKtLrs}OSHDQwKIBO"+
    1607                   "wPD@WWEQ?`HQWfIQglKBOtLbo}Ns@@OsTE_?kLCpWWHA[gIqomKBGwMRgz"+
    1608                   "NBw~OSPDPc\\H_?CFAOoLCPSVE`o\\GAOeJAwpKbKtMrx?Qcq??OKFA?gJ"+
    1609                   "B`?QDpcYEpo]FqKfIAgjJB?qKr_{NS@A__SE@o_HBO{PC`OTD`{_HaciIq"+
    1610                   "{vMbt?OcPFQCeB@?SKBOwRD@SXE`k[FPw`HQ_lKRKxNRxBPC\\HQclK_?K"+
    1611                   "EB?sOC`OTDa?`GqWgJRCrNBw~OSHFQStMRtDQ_?KC@OoQE`k_GaOdHa[gI"+
    1612                   "q{tMBg|Nb|?OcPMSDDQSwCB@_cJB_{OCpOVFP{dHa[jJQwqKrk}NsHBQCd"+
    1613                   "MRtMA?oSEA_wPDp_YEpo]GAOeIq{pLBk}NsLEQCtNTDU??OKEA_oLC@[[G"+
    1614                   "aKnKBOtLbk~OCPFQStNSDLSTgGKC@GSD`[WEpw_GQGcIAciJAwpKb_xMbk"+
    1615                   "~QShJRc|R`_wNCPcZF@s^GAGbHA_hJR?qKrOvMRg|NsDEPsxTTgCB@?gJB"+
    1616                   "?sMC@CUDp_]FqCaHQcjJQwtLrhCPS\\IRCtQTw?B@?SHA_wPC`_aGqOiJa"+
    1617                   "{oKRKvMRpFQChKRtXVUTi??ocNC@KUE@cYFaGdHa_mJrKsLb[yMro|OcXI"+
    1618                   "RdPTTddZaOgJB@?UEPk[FQCfIaolJrSvMBczNR|AOsXFQCtOTtaB@?WGAP"+
    1619                   "?TEPo\\GAGdHqgmKBCqLR[xMb|?PC`HQs|TTt`XUtu@?o[HB?sNCPGXF@{"+
    1620                   "_GQKcIqolJb_yNCLDPs`MRtDRTTdYUwSEA?kLB`CWF@s]FqGgIqooLRgzN"+
    1621                   "RxFQSlMSDDQTDXVUTi@?_KDAOoLBpKUEQOfIa{oLB_xMrt?Os\\HQcpMST"+
    1622                   "HSTtl[VT}A@ocJBOwSD`_XEpo_Ha_mJrKtLbgzNSTGQspLRtDUUDp\\WG["+
     1580        # g = sage.graphs.graph.Graph(edge_list, pos={})
     1581        # string = g.sparse6_string()
     1582
     1583        string = (":~?@c__E@?g?A?w?A@GCA_?CA`OWF`W?EAW?@?_OD@_[GAgcIaGGB@OcIA"
     1584                  "wCE@o_K_?GB@?WGAouC@OsN_?GB@O[GB`A@@_e?@OgLB_{Q_?GC@O[GAOs"
     1585                  "OCWGBA?kKBPA@?_[KB_{OCPKT`o_RD`]A?o[HBOwODW?DA?cIB?wRDP[X`"
     1586                  "ogKB_{QD@]B@o_KBPWXE`mC@o_JB?{PDPq@?oWGA_{OCPKTDp_YEwCA@_c"
     1587                  "IBOwOC`OX_OGB@?WPDPcYFg?C@_gKBp?SE@cYF`{_`?SGAOoOC`_\\FwCE"
     1588                  "A?gKBO{QD@k[FqI??_OFA_oQE@k\\Fq?`GgCB@pGRD@_XFP{a_?SE@ocIA"
     1589                  "ooNCPOUEqU@?oODA?cJB_{UEqYC@_kLC@CREPk]GAGbHgCA@?SMBpCSD`["
     1590                  "YFq?`Ga]BA?gPC`KSD`_\\Fa?cHWGB@?[IAooPD`[WF@s^HASeIg?@@OcP"
     1591                  "C`KYF@w^GQ[h`O[HAooMC@CQCpSVEPk\\GaSeIG?FA?kLB_{OC`OVE@cYG"
     1592                  "QUA@?WLBp?PC`KVEqKgJg?DA?sMBpCSDP[WEQKfIay@?_KD@_[GC`SUE@k"
     1593                  "[FaKdHa[k_?OLC@CRD@WVEpo^HAWfIAciIqoo_?CB@?kMCpOUE`o\\GAKg"
     1594                  "IQgq_?GD@_[GB?{OCpWVE@cYFACaHAWhJR?q_?CC@_kKBpC\\GACdHa[kJ"
     1595                  "a{o_?CA?oOFBpGRD@o\\GaKdIQonKrOt_?WHA`?PC`KTD`k]FqSeIaolJr"
     1596                  "CqLWCA@OkKCPGRDpcYGAKdIAgjJAsmJr?t__OE@ogJB_{XEps`HA[gIQwn"
     1597                  "KWKGAOoMBpGUE`k[Fa?aHqckJbSuLw?@?_SHA_kLC@OTFPw^GaOkLg?B@?"
     1598                  "[HA_{PDP_XFaCbHa[gIqooKRWx_?CFBpOTE@cZFPw^GACcHQgoKrSvMwWG"
     1599                  "BOwQCp_YFP{`HASfJAwnKRSx_OSSDP[WEq?aGqSfIQsoKR_zNWCE@o_HA_"
     1600                  "sREPg^GAGcHQWfIAciKbOxNg?A@__IAooMC`KTD`g\\GAKcIasoKrOtLb["
     1601                  "wMbyCA?cKBp?TD`[WE`s^GQGbHqcjJrK{NRw~_oODA?sNC@CQCpOZF@s]G"
     1602                  "QOfIaolJrGsLbk}_?OFA_sRD@SVE`k[HQcjJa{qLb[xMb|?_OOFA?cIAos"
     1603                  "RDP_ZFa?aGqOfIAsuMbk{Ns@@OsQAA_sPDPWXE`o\\FqKdIQkkJrCuLr_x"
     1604                  "Mro}NsDAPG?@@OWFApKUE@o`IQolKRKsLrc|NsQC@OWGAOgJCpOWE`o_GQ"
     1605                  "KiIqwnKr_~OcLCPS]A?oWHA_oMBpKSDP[\\FagjKBWxMbk{OSQ@@O_IAoo"
     1606                  "LBpCSD`g\\FaGbHQWgIQgmKRKwMRl?PgGC@OWHB@KSE@c[FqCaGqSeIAkk"
     1607                  "KBCqLBSuMBpGQWCA@?cKBOwRDPWVE@k^GqOfJr?pKbKtLrs}OSHDQwKIBO"
     1608                  "wPD@WWEQ?`HQWfIQglKBOtLbo}Ns@@OsTE_?kLCpWWHA[gIqomKBGwMRgz"
     1609                  "NBw~OSPDPc\\H_?CFAOoLCPSVE`o\\GAOeJAwpKbKtMrx?Qcq??OKFA?gJ"
     1610                  "B`?QDpcYEpo]FqKfIAgjJB?qKr_{NS@A__SE@o_HBO{PC`OTD`{_HaciIq"
     1611                  "{vMbt?OcPFQCeB@?SKBOwRD@SXE`k[FPw`HQ_lKRKxNRxBPC\\HQclK_?K"
     1612                  "EB?sOC`OTDa?`GqWgJRCrNBw~OSHFQStMRtDQ_?KC@OoQE`k_GaOdHa[gI"
     1613                  "q{tMBg|Nb|?OcPMSDDQSwCB@_cJB_{OCpOVFP{dHa[jJQwqKrk}NsHBQCd"
     1614                  "MRtMA?oSEA_wPDp_YEpo]GAOeIq{pLBk}NsLEQCtNTDU??OKEA_oLC@[[G"
     1615                  "aKnKBOtLbk~OCPFQStNSDLSTgGKC@GSD`[WEpw_GQGcIAciJAwpKb_xMbk"
     1616                  "~QShJRc|R`_wNCPcZF@s^GAGbHA_hJR?qKrOvMRg|NsDEPsxTTgCB@?gJB"
     1617                  "?sMC@CUDp_]FqCaHQcjJQwtLrhCPS\\IRCtQTw?B@?SHA_wPC`_aGqOiJa"
     1618                  "{oKRKvMRpFQChKRtXVUTi??ocNC@KUE@cYFaGdHa_mJrKsLb[yMro|OcXI"
     1619                  "RdPTTddZaOgJB@?UEPk[FQCfIaolJrSvMBczNR|AOsXFQCtOTtaB@?WGAP"
     1620                  "?TEPo\\GAGdHqgmKBCqLR[xMb|?PC`HQs|TTt`XUtu@?o[HB?sNCPGXF@{"
     1621                  "_GQKcIqolJb_yNCLDPs`MRtDRTTdYUwSEA?kLB`CWF@s]FqGgIqooLRgzN"
     1622                  "RxFQSlMSDDQTDXVUTi@?_KDAOoLBpKUEQOfIa{oLB_xMrt?Os\\HQcpMST"
     1623                  "HSTtl[VT}A@ocJBOwSD`_XEpo_Ha_mJrKtLbgzNSTGQspLRtDUUDp\\WG["
    16231624                  "HB`CQCp[WFQGgIQgkJQ{rLbc{Nc@APsdLRt@PSt\\WUtt_Wn")
    16241625
    1625         g = graph.Graph(string, pos = {}, loops = False, multiedges = False)
     1626        g = graph.Graph(string, pos={}, loops=False, multiedges=False)
    16261627
    16271628        _circle_embedding(g, range(100))
    1628         g.name("Hall-Janko Graph")
     1629        g.name("Hall-Janko graph")
    16291630        return g
    16301631
    16311632    def HararyGraph( self, k, n ):