A stupid thought about Hamilton Path problem - Theory
This is a discussion on A stupid thought about Hamilton Path problem - Theory ; Hamilton Path: to find a shortest path in graph G from vertex s to
vertex t through all the other vertices once and only once.
My thought:
First find a random path P from s to t.
Then do this ...
-
A stupid thought about Hamilton Path problem
Hamilton Path: to find a shortest path in graph G from vertex s to
vertex t through all the other vertices once and only once.
My thought:
First find a random path P from s to t.
Then do this loop until no change happens in a pass:
Do
For Each vertex pair i, j, (note that i and j are not necessarily
adjacent vertices)
if a swap of i and j in path P can lead to a shorter path, then
swap them and the new path becomes P
Loop
Any counterexample to this algorithm?
Regards,
Yao Ziyuan
-
Re: A stupid thought about Hamilton Path problem
The flaw seems to be that only two-vertex swaps are not sufficient. For
example, a three-vertex swap:
s -...-> i -...-> j -...-> k -...-> t
=>
s -...-> j -...-> k -...-> i -...-> t
is not accomplishable by a series of two-vertex swaps.
On Dec 4, 5:04 am, "Booted Cat" <yaoziy...{}> wrote:
> Hamilton Path: to find a shortest path in graph G from vertex s to
> vertex t through all the other vertices once and only once.
>
> My thought:
>
> First find a random path P from s to t.
>
> Then do this loop until no change happens in a pass:
>
> Do
> For Each vertex pair i, j, (note that i and j are not necessarily
> adjacent vertices)
> if a swap of i and j in path P can lead to a shorter path, then
> swap them and the new path becomes P
> Loop
>
> Any counterexample to this algorithm?
>
> Regards,
> Yao Ziyuan
-
Re: A stupid thought about Hamilton Path problem
On 3 Dec 2006 13:04:13 -0800, "Booted Cat" <yaoziyuan{}>
wrote:
>Hamilton Path: to find a shortest path in graph G from vertex s to
>vertex t through all the other vertices once and only once.
>
For definition of Hamiltonian path look here
http://en.wikipedia.org/wiki/Hamiltonian_path
>My thought:
>
>First find a random path P from s to t.
>
>Then do this loop until no change happens in a pass:
>
>Do
> For Each vertex pair i, j, (note that i and j are not necessarily
>adjacent vertices)
> if a swap of i and j in path P can lead to a shorter path, then
>swap them and the new path becomes P
>Loop
>
>
>Any counterexample to this algorithm?
Run google on Travelling Salesman Problem. You can start from here
http://en.wikipedia.org/wiki/Traveling_Salesman_Problem
and check teh section "iterative improvement"
A.L.
-
Re: A stupid thought about Hamilton Path problem
Forgot Wikipedia is one's friend...
On Dec 4, 7:20 am, A.L. <alewa...{}fala2005.com> wrote:
> On 3 Dec 2006 13:04:13 -0800, "Booted Cat" <yaoziy...{}>
> wrote:
>
> >Hamilton Path: to find a shortest path in graph G from vertex s to
> >vertex t through all the other vertices once and only once.For definition of Hamiltonian path look here
>
> http://en.wikipedia.org/wiki/Hamiltonian_path
>
> >My thought:
>
> >First find a random path P from s to t.
>
> >Then do this loop until no change happens in a pass:
>
> >Do
> > For Each vertex pair i, j, (note that i and j are not necessarily
> >adjacent vertices)
> > if a swap of i and j in path P can lead to a shorter path, then
> >swap them and the new path becomes P
> >Loop
>
> >Any counterexample to this algorithm?Run google on Travelling Salesman Problem. You can start from here
>
> http://en.wikipedia.org/wiki/Traveling_Salesman_Problem
>
> and check teh section "iterative improvement"
>
> A.L.
-
Re: A stupid thought about Hamilton Path problem
On 3 Dec 2006 16:11:56 -0800, "Booted Cat" <yaoziyuan{}>
wrote:
>Forgot Wikipedia is one's friend...
That what?...
A.L.
-
Re: A stupid thought about Hamilton Path problem
> The flaw seems to be that only two-vertex swaps are not sufficient. For
> example, a three-vertex swap:
>
> s -...-> i -...-> j -...-> k -...-> t
> =>
> s -...-> j -...-> k -...-> i -...-> t
>
> is not accomplishable by a series of two-vertex swaps.
>
Huh?
xijky
xjiky
xjkiy
-
Re: A stupid thought about Hamilton Path problem
Because in order to successfully swap i and j, the pairwise swap must
lead to a shorter path; and this may not be satisfied.
On Dec 6, 11:13 pm, "d...{}comcast.net" <d...{}comcast.net> wrote:
> > The flaw seems to be that only two-vertex swaps are not sufficient. For
> > example, a three-vertex swap:
>
> > s -...-> i -...-> j -...-> k -...-> t
> > =>
> > s -...-> j -...-> k -...-> i -...-> t
>
> > is not accomplishable by a series of two-vertex swaps.Huh?
>
> xijky
> xjiky
> xjkiy
-
Re: A stupid thought about Hamilton Path problem
Booted Cat wrote:
> Because in order to successfully swap i and j, the pairwise swap must
> lead to a shorter path; and this may not be satisfied.
Shorter path? You didn't give them lengths.
It gets worse. You stated the key step of the algorithm:
if a swap of i and j in path P can lead to a shorter path
What does that mean? "Can lead to a shorter path" does not
necessarily mean that the immediately resulting path is shorter.
Plus, as A.L. pointed out, "Hamiltonian path" means, as near as
anyone can tell, the same problem as "Hamiltonian Circuit".
Shorter? What does that even have to do with the problem?
--
--Bryan
-
Re: A stupid thought about Hamilton Path problem
Bryan Olson wrote:
....
> What does that mean? "Can lead to a shorter path" does not
> necessarily mean that the immediately resulting path is shorter.
....
This is the essential problem, so far, with hill-climbing approaches to
NP-complete problems. They tend to have local optima, where any single
small change makes things worse, but improvement would be possible with
a large change.
Patricia
-
Re: A stupid thought about Hamilton Path problem
On Thu, 07 Dec 2006 13:04:13 GMT, Patricia Shanahan <pats{}acm.org>
wrote:
>Bryan Olson wrote:
>...
>> What does that mean? "Can lead to a shorter path" does not
>> necessarily mean that the immediately resulting path is shorter.
>...
>
>This is the essential problem, so far, with hill-climbing approaches to
>NP-complete problems. They tend to have local optima, where any single
>small change makes things worse, but improvement would be possible with
>a large change.
>
>Patricia
Don't pay attention, someone Booted Cat generates nonsense not only
in this thread but also in others
A.L.
Similar Threads
-
By Application Development in forum Graphics
Replies: 4
Last Post: 12-05-2004, 02:50 PM
-
By Application Development in forum Graphics
Replies: 5
Last Post: 11-13-2004, 04:18 PM
-
By Application Development in forum Graphics
Replies: 2
Last Post: 11-09-2004, 09:24 AM
-
By Application Development in forum Inetserver
Replies: 1
Last Post: 08-10-2003, 06:50 PM