Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 834325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:39:18+00:00 2026-05-15T04:39:18+00:00

Here is my problem : I have an array of points, the points have

  • 0

Here is my problem : I have an array of points, the points have three properties : the “x” and “y” coordinates, and a sequence number “n”. The “x” and “y” are defined for all the points, the “n” are not.
You can access and write them calling points[i]->x, points[i]->y, points[i]->n. i.e. :

points[i]->n = var
var = points[i]->n

So the title maybe ruined the surprise, but I’m looking for a possible implementation of a solution to the Hamiltonian path problem : I need to set the “n” number of each point, so that the sequence is the shortest path (not cycle, the edges have to be disjoint) that goes exactly once through each point. I looked for a solution and I found The Bellman Ford Algorithm but I think it doesn’t work since the problem doesn’t specify that it has to go through all of the points is it correct ?

If it is, does somebody has another algorithm and the implementation ?
If the Bellman Ford Algorithm works, how would I implement it ?

Thanks a lot,

Julien

Edit : the problem is that I have to recreate a list of geographic points which represent bus stops, and I have to figure out a realistic sequence. Performance is not important at all since the goal is only to populate a database.

Edit : Here is a picture :My Hamiltonian Path Problem http://www.stoeffler.cc/hpp.png

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T04:39:19+00:00Added an answer on May 15, 2026 at 4:39 am

    This is called Euclidean Travelling Salesman (in 2-dimensions) and is also NP-Complete like TSP.

    The other answers are inaccurate as they are doing the opposite: reducing your problem to Hamiltonian Path, while it should be the other way round, to show NP-Completeness. Sorry to say this, but it seems to be a pretty common problem on this site.

    We can say that this fundamentally differs from the normal TSP in the following sense:

    If P != NP,

    • There is no PTAS for TSP (in fact also for metric TSP, where distances satisfy the triangle inequality).

    • There is a PTAS for Euclidean TSP. Check out this paper by Arora by which gives an 1+1/c approximation algorithm and runtime is O(n (logn)^O(c)): Polynomial time approximation schemes for Euclidean TSP and other geometric problems. Notice that Euclidean TSP is a special case of metric TSP and yet it differs in this way.

    There are other algorithms which guarantee 2-approximation (using Minimum Spanning Trees) and 3/2-approximation and might be simpler. Arora’s paper mentions those and you should be able to track down using the references in Arora’s paper.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.