Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to perform calculation on a Dijkstra algoritm

    Hi to everybody

    I'm looking for a solution to a problem I heard would be resolvable with the Dijkstra algoritm, but I am not really sure it would be the real solution.
    My problem is the following:
    1. I got a list of 764 ocurrencies (Variables: Code, County_name, Lon, Lat);
    2. an another matrix with the distances between pairwise of 32 nodes
    3. The geodesic distance between pairwise of any singular origin/destination (764) and the nodes
    I need to perform the calculation tha allow me to find the minimum distance between all the pairwise of the 764 ocurrencies passing by the two of the 32 nearest nodes
    I'm working on it for a very lasting time, and also if I can conceptualise that in my mind, I'm looking to a good solution that could allow to me to manage all the new 500k+ and I think the Dijkstra algoritm would be a good solution, but I can't find anything in the search help repository of Stata.

    Thanks a lot.

  • #2
    I don't understand well what you have and want, but it seems possible that you might find useful the user-written program -geonear-, which is available at SSC. This program finds the nearest neighbors of a set of lat/lon locations from among another set of locations.

    Comment


    • #3
      Hi Mike!
      First I would thank you for your interest and interisting answer, also I would excuse me for this late reply.
      Actually it is not what I'm looking for, and at this thime I think I have to plan some nested loop in order to accomplish that challenge.
      Well, try to think about a set of locations i =(1,...,N) in a region, which is served by a fast train line with j =(1,...,k) stations.
      The aim is to find:
      • the shortest itinerary between pairs of location with o without train line.
      I have already computed a geodist between all pair of destinations, the geodist between all the i locations and the k train station and also the train line distance between all the pairs of trains stations along the line (no geodist).

      Now the problem is to compute the itinerary between all the pairs of locations using the train line. This routine seems to be very challenging to me, cause also I don't master loop use (mainly about indexes and variables). If I can make a trivial scheme it would be like this:

      Origin --> Trainstat_dep+Trainstat_dep-->Trainstat_arr+Trainstat_Arr-->Destination= multileg trip


      and after compare it with the original geodist distance computed across locations pairs.

      An obvious objection would be that the geodist would ever be shorter than a poligonal itinerary, but in reality I have to cope with a georoute distance (which with I got difficulties too using online services), and also that would not be very satisfying because in reality, the only road distance would never been the optimal existing measure of the optimal or second first option to move point to point (if I do not take care of all already existing transport solution - old train lines or maritime linkages and however excluding air transport).

      I'm aware that it'is quite a messing challenge, but I really would try to find a way to resolve the blue expression. For this the original idea was to use the Dijkstra algorithm (but it needs nodes indexes that I do not have at this stage), also I tried the Floyd algorithm but my problem presents some issues not managed by this routine.

      So, I thank you a new time for your interest and hope to find a plausible way to resolve this problem.

      D.

      Comment

      Working...
      X