Ticket #5911: trac_5911-editing.patch

File trac_5911-editing.patch, 3.4 KB (added by rlm, 11 years ago)

apply on top of doc_graph.patch

  • sage/graphs/graph.py

    # HG changeset patch
    # User Robert L. Miller <rlm@rlmiller.org>
    # Date 1251311834 25200
    # Node ID ce7462042ef74e5bb71da02052e7f4d6c884fc1f
    # Parent  beaee80c307efdd7d4e87caf5d6918650c8a2508
    Editing for 5911
    
    diff -r beaee80c307e -r ce7462042ef7 sage/graphs/graph.py
    a b  
    87918791    Undirected graph.
    87928792
    87938793    A Graph is a set of vertices connected by edges
    8794     (cf. http://en.wikipedia.org/wiki/Graph_(mathematics) )
    8795 
    8796     One can very easily create a graph in sage by typing ::
     8794    (cf. http://en.wikipedia.org/wiki/Graph_(mathematics) ).
     8795
     8796    One can very easily create a graph in sage by typing::
    87978797   
    87988798        sage: g=Graph()
    87998799
    8800     By typing the name of the Graph, one can get some basic informations
     8800    By typing the name of the Graph, one can get some basic information
    88018801    about it::
    88028802
    88038803        sage: g
    88048804        Graph on 0 vertices
    88058805
    8806     This graph is not very interesting as it is by default the empty graph.. But
     8806    This graph is not very interesting as it is by default the empty graph. But
    88078807    Sage contains a large collection of pre-defined graph classes that can be listed
    8808     this way :
    8809    
    8810         * type in Sage : graphs.
     8808    this way:
     8809   
     8810        * Type in Sage : graphs.
    88118811          ( do not press "Enter", and do not forget the final "." )
    8812         * hit "tabulation" two times in a row
    8813    
    8814     You will see the list of methods defined in the class "graphs", all of which
    8815     generate graphs you can play with !
    8816 
    8817     If you want to see what they look like, begin this way ::
    8818    
     8812        * Hit "tab".
     8813   
     8814    You will see a list of methods which will construct named graphs. For
     8815    example::
     8816
    88198817        sage: g=graphs.PetersenGraph()
    88208818        sage: g.plot()
    88218819
     
    88248822        sage: g=graphs.ChvatalGraph()
    88258823        sage: g.plot()
    88268824
    8827     If you are curious about what these graphs are, for example if you wonder what ``RandomGNP``
    8828     actually is, you but have to type::
     8825    In order to obtain more information about these graph constructors, access
     8826    the documentation as follows::
    88298827
    88308828        sage: graphs.RandomGNP?
    88318829
     
    88338831    almost 200 functions on graphs in the Sage library !
    88348832    If your graph is named ``g``, you can list these functions as previously this way
    88358833   
    8836         * type in Sage : ``g.``
     8834        * Type in Sage : ``g.``
    88378835          ( do not press "Enter", and do not forget the final "." )
    8838         * hit "tabulation" two times in a row   
     8836        * Hit "tab".
    88398837
    88408838    As usual, you can get some information about what these functions do by typing
    8841     ( if you want to know about the ``diameter()`` method )::
     8839    (e.g. if you want to know about the ``diameter()`` method)::
    88428840
    88438841        sage: g.diameter?
    88448842
    8845     If you have defined a graph ``g`` having several connected components ( = which is not
    8846     connected... Type ``g.is_connected()`` to know if your graph is connected ), you can
    8847     print each one of its connected components with only two lines :
    8848    
    8849     ( if you do not have such a graph G, here is one for free :  ``g=graphs.RandomGNP(30,.05)``    )::
     8843    If you have defined a graph ``g`` having several connected components ( i.e.
     8844    ``g.is_connected()`` returns False ), you can print each one of its
     8845    connected components with only two lines::
    88508846   
    88518847        sage: for component in g.connected_components():
    88528848        ...      g.subgraph(component).plot()