# HG changeset patch
# User Eviatar Bach
# Date 1294875715 28800
# Node ID 50830205b2f235e4424424c4538f54710dea5540
# Parent 1896a0311e7061fac80de9805e0258200b23336e
Trac 10560: Updated patch.
diff r 1896a0311e70 r 50830205b2f2 sage/graphs/generic_graph.py
 a/sage/graphs/generic_graph.py Wed Jan 12 15:29:34 2011 0800
+++ b/sage/graphs/generic_graph.py Wed Jan 12 15:41:55 2011 0800
@@ 1958,14 +1958,14 @@
def eulerian_orientation(self):
r"""
 Returns a DiGraph which is an eulerian orientation of the current graph.

 An eulerian graph being a graph such that any vertex has an even degree,
 an eulerian orientation of a graph is an orientation of its edges such
+ Returns a DiGraph which is an Eulerian orientation of the current graph.
+
+ An Eulerian graph being a graph such that any vertex has an even degree,
+ an Eulerian orientation of a graph is an orientation of its edges such
that each vertex `v` verifies `d^+(v)=d^(v)=d(v)/2`, where `d^+` and
`d^` respectively represent the outdegree and the indegree of a vertex.
 If the graph is not eulerian, the orientation verifies for any vertex `v`
+ If the graph is not Eulerian, the orientation verifies for any vertex `v`
that ` d^+(v)d^(v)  \leq 1`.
ALGORITHM:
@@ 1981,7 +1981,7 @@
EXAMPLES:
The CubeGraph with parameter 4, which is regular of even degree, has an
 eulerian orientation such that `d^+=d^`::
+ Eulerian orientation such that `d^+=d^`::
sage: g=graphs.CubeGraph(4)
sage: g.degree()
@@ 3853,10 +3853,10 @@
def vertex_cut(self, s, t, value_only=True, vertices=False, solver=None, verbose=0):
r"""
 Returns a minimum vertex cut between non adjacent vertices `s` and `t`
+ Returns a minimum vertex cut between nonadjacent vertices `s` and `t`
represented by a list of vertices.
 A vertex cut between two non adjacent vertices is a set `U`
+ A vertex cut between two nonadjacent vertices is a set `U`
of vertices of self such that the graph obtained by removing
`U` from self is disconnected. For more information, see the
`Wikipedia article on cuts
@@ 4160,7 +4160,7 @@
only the size of a minimum vertex cover is returned. Otherwise,
a minimum vertex cover is returned as a list of vertices.
  ``log``  non negative integer (default: ``0``). Set the level
+  ``log``  nonnegative integer (default: ``0``). Set the level
of verbosity you want from the linear program solver. Since the
problem of computing a vertex cover is `NP`complete, its solving
may take some time depending on the graph. A value of 0 means
@@ 4380,7 +4380,7 @@
Given a graph (resp. a digraph) `G` with weighted edges,
the traveling salesman problem consists in finding a
 hamiltonian cycle (resp. circuit) of the graph of
+ Hamiltonian cycle (resp. circuit) of the graph of
minimum cost.
This TSP is one of the most famous NPComplete problems,
@@ 4430,7 +4430,7 @@
EXAMPLES:
 The Heawood graph is known to be hamiltonian::
+ The Heawood graph is known to be Hamiltonian::
sage: g = graphs.HeawoodGraph()
sage: tsp = g.traveling_salesman_problem()
@@ 4453,16 +4453,16 @@
True
On the other hand, the Petersen Graph is known not to
 be hamiltonian::
+ be Hamiltonian::
sage: g = graphs.PetersenGraph()
sage: tsp = g.traveling_salesman_problem()
Traceback (most recent call last):
...
 ValueError: The given graph is not hamiltonian
+ ValueError: The given graph is not Hamiltonian
One easy way to change is is obviously to add to this
 graph the edges corresponding to a hamiltonian cycle.
+ graph the edges corresponding to a Hamiltonian cycle.
If we do this by setting the cost of these new edges
to `2`, while the others are set to `1`, we notice
@@ 4609,18 +4609,18 @@
return tsp
except MIPSolverException:
 raise ValueError("The given graph is not hamiltonian")
+ raise ValueError("The given graph is not Hamiltonian")
def hamiltonian_cycle(self, algorithm='tsp' ):
r"""
 Returns a hamiltonian cycle/circuit of the current graph/digraph

 A graph (resp. digraph) is said to be hamiltonian
+ Returns a Hamiltonian cycle/circuit of the current graph/digraph
+
+ A graph (resp. digraph) is said to be Hamiltonian
if it contains as a subgraph a cycle (resp. a circuit)
going through all the vertices.
 Computing a hamiltonian cycle/circuit being NPComplete,
+ Computing a Hamiltonian cycle/circuit being NPComplete,
this algorithm could run for some time depending on
the instance.
@@ 4636,11 +4636,11 @@
OUTPUT:
 If using the 'tsp' algorithm, returns a hamiltonian cycle/circuit if it
+ If using the 'tsp' algorithm, returns a Hamiltonian cycle/circuit if it
exists; otherwise, raises a ``ValueError`` exception. If using the
'backtrack' algorithm, returns a pair (B,P). If B is True then P is a
 hamiltonian cycle and if B is False, P is a longest path found by the
 algorithm. Observe that if B is False, the graph may still be hamiltonian.
+ Hamiltonian cycle and if B is False, P is a longest path found by the
+ algorithm. Observe that if B is False, the graph may still be Hamiltonian.
The 'backtrack' algorithm is only implemented for undirected
graphs.
@@ 4651,16 +4651,16 @@
NOTE:
 This function, as ``is_hamiltonian``, computes a hamiltonian
+ This function, as ``is_hamiltonian``, computes a Hamiltonian
cycle if it exists : the user should *NOT* test for
 hamiltonicity using ``is_hamiltonian`` before calling this
+ Hamiltonicity using ``is_hamiltonian`` before calling this
function, as it would result in computing it twice.
The backtrack algorithm is only implemented for undirected graphs.
EXAMPLES:
 The Heawood Graph is known to be hamiltonian ::
+ The Heawood Graph is known to be Hamiltonian ::
sage: g = graphs.HeawoodGraph()
sage: g.hamiltonian_cycle()
@@ 4672,7 +4672,7 @@
sage: g.hamiltonian_cycle()
Traceback (most recent call last):
...
 ValueError: The given graph is not hamiltonian
+ ValueError: The given graph is not Hamiltonian
Now, using the backtrack algorithm in the Heawood graph ::
@@ 4686,7 +4686,7 @@
sage: G.hamiltonian_cycle(algorithm='backtrack')
(False, [6, 8, 5, 0, 1, 2, 7, 9, 4, 3])
 Finally, we test the algorithm in a cube graph, which is hamiltonian ::
+ Finally, we test the algorithm in a cube graph, which is Hamiltonian ::
sage: G=graphs.CubeGraph(3)
sage: G.hamiltonian_cycle(algorithm='backtrack')
@@ 4699,7 +4699,7 @@
try:
return self.traveling_salesman_problem(weighted = False)
except MIPSolverException:
 raise ValueError("The given graph is not hamiltonian")
+ raise ValueError("The given graph is not Hamiltonian")
elif algorithm=='backtrack':
from sage.graphs.generic_graph_pyx import find_hamiltonian as fh
return fh( self )
@@ 11910,7 +11910,7 @@
def layout_tree(self, tree_orientation = "down", tree_root = None, dim = 2, **options):
"""
Computes an ordered tree layout for this graph, which should
 be a tree (no non oriented cycles).
+ be a tree (no nonoriented cycles).
INPUT:
@@ 13964,13 +13964,13 @@
def is_hamiltonian(self):
r"""
 Tests whether the current graph is hamiltonian

 A graph (resp. digraph) is said to be hamiltonian
+ Tests whether the current graph is Hamiltonian.
+
+ A graph (resp. digraph) is said to be Hamiltonian
if it contains as a subgraph a cycle (resp. a circuit)
going through all the vertices.
 Testing for hamiltonicity being NPComplete, this
+ Testing for Hamiltonicity being NPComplete, this
algorithm could run for some time depending on
the instance.
@@ 13980,21 +13980,21 @@
OUTPUT:
 Returns ``True`` if a hamiltonian cycle/circuit exists, and
+ Returns ``True`` if a Hamiltonian cycle/circuit exists, and
``False`` otherwise.
NOTE:
This function, as ``hamiltonian_cycle`` and
 ``traveling_salesman_problem``, computes a hamiltonian
+ ``traveling_salesman_problem``, computes a Hamiltonian
cycle if it exists : the user should *NOT* test for
 hamiltonicity using ``is_hamiltonian`` before calling
+ Hamiltonicity using ``is_hamiltonian`` before calling
``hamiltonian_cycle`` or ``traveling_salesman_problem``
as it would result in computing it twice.
EXAMPLES:
 The Heawood Graph is known to be hamiltonian ::
+ The Heawood Graph is known to be Hamiltonian ::
sage: g = graphs.HeawoodGraph()
sage: g.is_hamiltonian()