Ticket #10560: 15059.patch

File 15059.patch, 7.1 KB (added by eviatarbach, 11 years ago)
  • sage/graphs/generic_graph.py

    # HG changeset patch
    # User Eviatar Bach <eviatarbach@gmail.com>
    # Date 1294203899 28800
    # Node ID bcff8a8fb10fe78088ccf0e33aca797a6489592b
    # Parent  d152b23009e4811eba04aff095949e25c5f19fef
    trac 10560: Fixes spelling errors in generic_graph.py
    
    diff -r d152b23009e4 -r bcff8a8fb10f sage/graphs/generic_graph.py
    a b  
    38343834       
    38353835    def vertex_cut(self, s, t, value_only=True, vertices=False, solver=None, verbose=0):
    38363836        r"""
    3837         Returns a minimum vertex cut between non adjacent vertices `s` and `t`
     3837        Returns a minimum vertex cut between non-adjacent vertices `s` and `t`
    38383838        represented by a list of vertices.
    38393839
    3840         A vertex cut between two non adjacent vertices is a set `U`
     3840        A vertex cut between two non-adjacent vertices is a set `U`
    38413841        of vertices of self such that the graph obtained by removing
    38423842        `U` from self is disconnected. For more information, see the
    38433843        `Wikipedia article on cuts
     
    41344134          only the size of a minimum vertex cover is returned. Otherwise,
    41354135          a minimum vertex cover is returned as a list of vertices.
    41364136
    4137         - ``log`` -- non negative integer (default: ``0``). Set the level
     4137        - ``log`` -- non-negative integer (default: ``0``). Set the level
    41384138          of verbosity you want from the linear program solver. Since the
    41394139          problem of computing a vertex cover is `NP`-complete, its solving
    41404140          may take some time depending on the graph. A value of 0 means
     
    43524352
    43534353        Given a graph (resp. a digraph) `G` with weighted edges,
    43544354        the traveling salesman problem consists in finding a
    4355         hamiltonian cycle (resp. circuit) of the graph of
     4355        Hamiltonian cycle (resp. circuit) of the graph of
    43564356        minimum cost.
    43574357
    43584358        This TSP is one of the most famous NP-Complete problems,
     
    43904390
    43914391        EXAMPLES:
    43924392
    4393         The Heawood graph is known to be hamiltonian::
     4393        The Heawood graph is known to be Hamiltonian::
    43944394
    43954395            sage: g = graphs.HeawoodGraph()
    43964396            sage: tsp = g.traveling_salesman_problem()
     
    44134413            True
    44144414
    44154415        On the other hand, the Petersen Graph is known not to
    4416         be hamiltonian::
     4416        be Hamiltonian::
    44174417
    44184418            sage: g = graphs.PetersenGraph()
    44194419            sage: tsp = g.traveling_salesman_problem()
    44204420            Traceback (most recent call last):
    44214421            ...
    4422             ValueError: The given graph is not hamiltonian
     4422            ValueError: The given graph is not Hamiltonian
    44234423
    44244424        One easy way to change is is obviously to add to this
    4425         graph the edges corresponding to a hamiltonian cycle.
     4425        graph the edges corresponding to a Hamiltonian cycle.
    44264426     
    44274427        If we do this by setting the cost of these new edges
    44284428        to `2`, while the others are set to `1`, we notice
     
    45694569            return tsp
    45704570       
    45714571        except MIPSolverException:
    4572             raise ValueError("The given graph is not hamiltonian")
     4572            raise ValueError("The given graph is not Hamiltonian")
    45734573
    45744574
    45754575    def hamiltonian_cycle(self):
    45764576        r"""
    4577         Returns a hamiltonian cycle/circuit of the current graph/digraph
    4578 
    4579         A graph (resp. digraph) is said to be hamiltonian
     4577        Returns a Hamiltonian cycle/circuit of the current graph/digraph
     4578
     4579        A graph (resp. digraph) is said to be Hamiltonian
    45804580        if it contains as a subgraph a cycle (resp. a circuit)
    45814581        going through all the vertices.
    45824582
    4583         Computing a hamiltonian cycle/circuit being NP-Complete,
     4583        Computing a Hamiltonian cycle/circuit being NP-Complete,
    45844584        this algorithm could run for some time depending on
    45854585        the instance.
    45864586
     
    45904590
    45914591        OUTPUT:
    45924592
    4593         Returns a hamiltonian cycle/circuit if it exists. Otherwise,
     4593        Returns a Hamiltonian cycle/circuit if it exists. Otherwise,
    45944594        raises a ``ValueError`` exception.
    45954595
    45964596        NOTE:
    45974597
    4598         This function, as ``is_hamiltonian``, computes a hamiltonian
     4598        This function, as ``is_hamiltonian``, computes a Hamiltonian
    45994599        cycle if it exists : the user should *NOT* test for
    4600         hamiltonicity using ``is_hamiltonian`` before calling this
     4600        Hamiltonicity using ``is_hamiltonian`` before calling this
    46014601        function, as it would result in computing it twice.
    46024602
    46034603        EXAMPLES:
    46044604
    4605         The Heawood Graph is known to be hamiltonian ::
     4605        The Heawood Graph is known to be Hamiltonian ::
    46064606
    46074607            sage: g = graphs.HeawoodGraph()
    46084608            sage: g.hamiltonian_cycle()
     
    46144614            sage: g.hamiltonian_cycle()
    46154615            Traceback (most recent call last):
    46164616            ...
    4617             ValueError: The given graph is not hamiltonian
     4617            ValueError: The given graph is not Hamiltonian
    46184618        """
    46194619        from sage.numerical.mip import MIPSolverException
    46204620
    46214621        try:
    46224622            return self.traveling_salesman_problem(weighted = False)
    46234623        except MIPSolverException:
    4624             raise ValueError("The given graph is not hamiltonian")
     4624            raise ValueError("The given graph is not Hamiltonian")
    46254625
    46264626    def flow(self, x, y, value_only=True, integer=False, use_edge_labels=True, vertex_bound=False, method = None, solver=None, verbose=0):
    46274627        r"""
     
    1180011800    def layout_tree(self, tree_orientation = "down", tree_root = None, dim = 2, **options):
    1180111801        """
    1180211802        Computes an ordered tree layout for this graph, which should
    11803         be a tree (no non oriented cycles).
     11803        be a tree (no non-oriented cycles).
    1180411804
    1180511805        INPUT:
    1180611806
     
    1385613856        r"""
    1385713857        Tests whether the current graph is Hamiltonian
    1385813858
    13859         A graph (resp. digraph) is said to be hamiltonian
     13859        A graph (resp. digraph) is said to be Hamiltonian
    1386013860        if it contains as a subgraph a cycle (resp. a circuit)
    1386113861        going through all the vertices.
    1386213862
    13863         Testing for hamiltonicity being NP-Complete, this
     13863        Testing for Hamiltonicity being NP-Complete, this
    1386413864        algorithm could run for some time depending on
    1386513865        the instance.
    1386613866
     
    1387013870
    1387113871        OUTPUT:
    1387213872
    13873         Returns ``True`` if a hamiltonian cycle/circuit exists, and
     13873        Returns ``True`` if a Hamiltonian cycle/circuit exists, and
    1387413874        ``False`` otherwise.
    1387513875
    1387613876        NOTE:
    1387713877
    1387813878        This function, as ``hamiltonian_cycle`` and
    13879         ``traveling_salesman_problem``, computes a hamiltonian
     13879        ``traveling_salesman_problem``, computes a Hamiltonian
    1388013880        cycle if it exists : the user should *NOT* test for
    13881         hamiltonicity using ``is_hamiltonian`` before calling
     13881        Hamiltonicity using ``is_hamiltonian`` before calling
    1388213882        ``hamiltonian_cycle`` or ``traveling_salesman_problem``
    1388313883        as it would result in computing it twice.
    1388413884
    1388513885        EXAMPLES:
    1388613886
    13887         The Heawood Graph is known to be hamiltonian ::
     13887        The Heawood Graph is known to be Hamiltonian ::
    1388813888
    1388913889            sage: g = graphs.HeawoodGraph()
    1389013890            sage: g.is_hamiltonian()