# HG changeset patch
# User Nathann Cohen <nathann.cohen@gmail.com>
# Date 1336937880 7200
# Node ID 0edc05691270126760fea01d3d1e43871aa265dd
# Parent 006283a0ed0c5793ce38580ec278d88b55228d0f
Inconcistencies in the documentation of traveling_salesman_problem
diff git a/sage/graphs/generic_graph.py b/sage/graphs/generic_graph.py
a

b


5039  5039  return g 
5040  5040  
5041  5041  
5042   def traveling_salesman_problem(self, use_edge_labels = True, solver = None, constraint_generation = None, verbose = 0, verbose_constraints = False): 
 5042  def traveling_salesman_problem(self, use_edge_labels = False, solver = None, constraint_generation = None, verbose = 0, verbose_constraints = False): 
5043  5043  r""" 
5044  5044  Solves the traveling salesman problem (TSP) 
5045  5045  
… 
… 

5059  5059  `1` 
5060  5060  
5061  5061   If set to ``True``, the weights are taken into account, and the 
 5062  circuit returned is the one minimizing the sum of the weights. 
5062  5063  
5063  5064   ``solver``  (default: ``None``) Specify a Linear Program (LP) 
5064  5065  solver to be used. If set to ``None``, the default one is used. For 
… 
… 

5131  5132  
5132  5133  One easy way to change is is obviously to add to this graph the edges 
5133  5134  corresponding to a Hamiltonian cycle. 
5134   
 5135  
5135  5136  If we do this by setting the cost of these new edges to `2`, while the 
5136  5137  others are set to `1`, we notice that not all the edges we added are 
5137  5138  used in the optimal solution :: 
… 
… 

5174  5175  ... for u,v in graphs.CycleGraph(n).edges(labels = False): 
5175  5176  ... if not g.has_edge(u,v): 
5176  5177  ... g.add_edge(u,v,round(random(),5)) 
5177   ... v1 = g.traveling_salesman_problem(constraint_generation = False) 
5178   ... v2 = g.traveling_salesman_problem() 
 5178  ... v1 = g.traveling_salesman_problem(constraint_generation = False, use_edge_labels = True) 
 5179  ... v2 = g.traveling_salesman_problem(use_edge_labels = True) 
5179  5180  ... c1 = sum(map(itemgetter(2), v1.edges())) 
5180  5181  ... c2 = sum(map(itemgetter(2), v2.edges())) 
5181  5182  ... if c1 != c2: 
… 
… 

5195  5196  ... for u,v in digraphs.Circuit(n).edges(labels = False): 
5196  5197  ... if not g.has_edge(u,v): 
5197  5198  ... g.add_edge(u,v,round(random(),5)) 
5198   ... v2 = g.traveling_salesman_problem() 
5199   ... v1 = g.traveling_salesman_problem(constraint_generation = False) 
 5199  ... v2 = g.traveling_salesman_problem(use_edge_labels = True) 
 5200  ... v1 = g.traveling_salesman_problem(constraint_generation = False, use_edge_labels = True) 
5200  5201  ... c1 = sum(map(itemgetter(2), v1.edges())) 
5201  5202  ... c2 = sum(map(itemgetter(2), v2.edges())) 
5202  5203  ... if c1 != c2: 