Ticket #12942: trac_12942.reviewer.patch

File trac_12942.reviewer.patch, 5.0 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 1336939078 -28800
    # Node ID b04704c9d1b2c3db7806b7e6f91593b57180025f
    # Parent  4c1b8a055328efe739c6c1079a29b63cea4020ad
    PEP 8, formatting
    
    diff --git a/sage/graphs/graph_generators.py b/sage/graphs/graph_generators.py
    a b  
    25262526
    25272527    def Balaban10Cage(self, embedding = 1):
    25282528        r"""
    2529         Returns Balaban's 10 cage.
    2530 
    2531         Balaban's 10-cage is a 3-regular graph with 70 vertices and 105
    2532         edges. See its :wikipedia:`Wikipedia page <Balaban_10-cage>`.
    2533 
    2534         The default embedding gives a deeper understanding of the graph's
    2535         automorphism group. It is divided into 4 layers (each layer being a set
    2536         of points at equal distance from the drawing's center). From outside to
    2537         inside :
    2538 
    2539         - L1 : The outer layer (vertices which are the furthest from the origin)
    2540           is actually the disjoint union of two cycles of length 10.
     2529        Returns the Balaban 10-cage.
     2530
     2531        The Balaban 10-cage is a 3-regular graph with 70 vertices and
     2532        105 edges. See its :wikipedia:`Wikipedia page
     2533        <Balaban_10-cage>`.
     2534
     2535        The default embedding gives a deeper understanding of the
     2536        graph's automorphism group. It is divided into 4 layers (each
     2537        layer being a set of points at equal distance from the drawing's
     2538        center). From outside to inside :
     2539
     2540        - L1 : The outer layer (vertices which are the furthest from the
     2541          origin) is actually the disjoint union of two cycles of length
     2542          10.
    25412543
    25422544        - L2 : The second layer is an independent set of 20 vertices.
    25432545
    25442546        - L3 : The third layer is a matching on 10 vertices.
    25452547
    2546         - L4 : The inner layer (vertices which are the closest from the origin)
    2547           is also the disjoint union of two cycles of length 10.
    2548 
    2549         This graph is not vertex-transitive, and its vertices are partitionned
    2550         into 3 orbits : L2, L3, and the union of L1 of L4 whose elements are
    2551         equivalent.
     2548        - L4 : The inner layer (vertices which are the closest from the
     2549          origin) is also the disjoint union of two cycles of length 10.
     2550
     2551        This graph is not vertex-transitive, and its vertices are
     2552        partitioned into 3 orbits : L2, L3, and the union of L1 of L4
     2553        whose elements are equivalent.
    25522554
    25532555        INPUT:
    25542556
    2555         - ``embedding`` -- two embeddings are available, and can be selected by
    2556           setting ``embedding`` to be either 1 or 2.
     2557        - ``embedding`` -- two embeddings are available, and can be
     2558          selected by setting ``embedding`` to be either 1 or 2.
    25572559
    25582560        EXAMPLE::
    25592561
     
    25762578              -17, -25, 9, 31, 13, -9, -21, -33, -17, -29, 29]
    25772579
    25782580        g = graphs.LCFGraph(70, L, 1)
    2579         g.name("Balaban's 10-cage")
     2581        g.name("Balaban 10-cage")
    25802582
    25812583        if embedding == 2:
    25822584            return g
    25832585        elif embedding != 1:
    2584             raise ValueError("The value of embedding must be equal to either 1 or 2")
     2586            raise ValueError("The value of embedding must be either 1 or 2")
    25852587
    25862588        L3 = [5, 24, 35, 46, 29, 40, 51, 34, 45, 56]
    25872589        _circle_embedding(g, L3, center=(0,0), radius = 4.3)
    25882590
    2589         L2  = [6, 4, 23, 25, 60, 36, 1, 47, 28, 30, 39, 41, 50, 52, 33, 9, 44, 20, 55, 57]
     2591        L2  = [6, 4, 23, 25, 60, 36, 1, 47, 28, 30, 39, 41, 50, 52, 33, 9, 44,
     2592                20, 55, 57]
    25902593        _circle_embedding(g, L2, center=(0,0), radius = 5, shift=-.5)
    25912594
    25922595
     
    74737476    r"""
    74747477    Set some vertices on a circle in the embedding of a graph G.
    74757478
    7476     This method modifies the graph's embedding so that the vertices listed in
    7477     ``vertices`` appear in this ordering on a circle of given radius and
    7478     center. The ``shift`` parameter is actually a rotation of the circle. A
    7479     value of ``shift=1`` will replace in the drawing the `i` th element of the
    7480     list by the `i-1` th. Non-integer values are admissible, and a value of
    7481     `\alpha` corresponds to a rotation of the circle by an angle of `\alpha
    7482     2\Pi/n` (where `n` is the number of vertices set on the circle).
     7479    This method modifies the graph's embedding so that the vertices
     7480    listed in ``vertices`` appear in this ordering on a circle of given
     7481    radius and center. The ``shift`` parameter is actually a rotation of
     7482    the circle. A value of ``shift=1`` will replace in the drawing the
     7483    `i`-th element of the list by the `(i-1)`-th. Non-integer values are
     7484    admissible, and a value of `\alpha` corresponds to a rotation of the
     7485    circle by an angle of `\alpha 2\pi/n` (where `n` is the number of
     7486    vertices set on the circle).
    74837487
    74847488    EXAMPLE::
    74857489
     
    74947498
    74957499    for i,v in enumerate(vertices):
    74967500        i += shift
    7497         v_x = c_x + radius * cos( 2*i*pi / n)
    7498         v_y = c_y + radius * sin( 2*i*pi / n)
     7501        v_x = c_x + radius * cos(2*i*pi / n)
     7502        v_y = c_y + radius * sin(2*i*pi / n)
    74997503        d[v] = (v_x, v_y)
    75007504
    75017505    g.set_pos(d)