Dijkstra's Algorithm in LabVIEW

So I've attempted to undergo the painful task of trying to implement dijkstra's algorithm in LabVIEW. The problem is that I think I am going about doing this wrong, or at least not in the most efficient manner. I've attached my VI so people can take a look at it. I guess I'll also give a brief description of how I'm attempting to implement this. So the input from the user ( at this point) is three 1D arrays as well as a start and end vertex value. The three arrays are the weight values of the edges, V1, and V2. The way these arrays are filled out is so that in each array the coordinating values are all stored at the same index. So if there is a path from vertex 0 to 1, with a weight of 2 then 2 will be stored in the edge array, 0 in the V1 array, and 1 in the V2 array, and all at the same index. These values get fed into functions and the shortest path is found, yada yada yada. I'd explain it more, but I think it'll be easier if you look at the VIs. The problem is that the way I have it setup, creating a finished product to sort through even 20 vertexes would result in massive code. The VI i have is only about 25% complete I'd say, but i dont want to go any further as it is getting exponentially more complicated with each iteration and I feel there has to be a better way. So if anyone has any ideas I would greatly appreciate it!
P.S. I realize that i can write the code in C and call it as a function in the LabVIEW program, but I'm kind of stubborn and want to make this work written solely in LabVIEW
Attachments:
Dijkstras.vi ‏23 KB
Short path.vi ‏21 KB
Short path 2.vi ‏24 KB

Well I'm glad that there are others interested in this project. First I'd just like to give a little update. The program currently will give the length of the shortest path to the desired vertex, but it doesn't output what the path it took to get that shortest value yet. So that is what I am working on now, as well as verifying its scalability and trying to implement other features that will actually make this a useful program vs. mere curiosity. 
As far as my references go, I've gotten all my info from the internet. Wikipedia, of course, was my starting place. I found a well explained article at http://eoinbailey.com/blog/dijkstras-algorithm-illustrated-explanation that helped me decide how I was going to try and implement the program. I also read pretty much the rest of the links that come up on google when you type in "dijkstras algorithm." Again, I have no formal CS background, Im studying engineering, so I'm working with a lot of trial and error here. My basic methodology behind all this was simply to read as much as I could, try to understand it, and then work on the program until I started getting somewhere. Maybe not the best strategy, but it works for me. Thank you also for the link, I wish I had read that before I had started this project lol
I will post my latest version of the VI later today, This way I can get some feedback on how I can improve it and what works or doesn't work. Thanks again everyone for all ur help!

Similar Messages

  • How can I use Dijkstra�s algorithm?

    Hi,
    I am reviewing some algorithm problems that are quite interesting and challenging. I am quite addicted to them, lol~~ but I was stuck and wish some smart people could help me out. Thanks a lot!
    Here is one of the problems that Dijkstra's Algorithm is supposed to use, anyone have ideas please?
    ==========================
    Jim has left from A city and must travel from A across a desert to B city. At various places in the desert, there are wells that Jim can refill his water bottle. Now the problem is to determine the �well-to-well� path that
    will get Jim from A to the B in the minimum amount of time.
    The input will be an integer n and the 2D coordinates of n wells.
    Let's make the following assumptions:
    1. All the wells are in a square of side 2500 km. A coordinate system is laid out for this square so that the lower left corner of the square is at the origin.
    2. The coordinates of A city are (0, 2500) and the B city is at (2500, 0).
    3. For any pair of wells, the difference in their x-coordinates is at least 50 km or the difference in their y-coordinates is at least 50 km.
    4. Assume the input specifies n wells. As n increases for other instances, the clumping constraint may require that the area of the square must also increase. i.e., the number of wells is NOT bounded above by some constant.
    In addition, the following list gives all the assumptions about the use of water:
    1. Normally, Jim can travel at 10 km/hr but can only do so after refilling the water bottle. In the heat of the desert, he can only travel for 10 hours after refilling the water bottle. Assume that he starts from A city with a full bottle.
    2. Or, he can travel faster, but the bottle does not have a cap and it will lose water when he carries it. Consequently, then we must assume that the bottle is empty if he is in this form. Then he can travel at 20 km/hr but with no water, he can only last for 5 hours.
    ==========================
    I'm having trouble applying Dijkstra's Algorithm. Could anybody have any idea about this problem? Help me out please? Really appreciate that.
    Regards,
    Victor

    VictorPorton wrote:
    Hello again guys,
    After thinking about the problem for a few days, I came up some very basic ideas. Now I have some specific problems and hope I can seek help from you guys now:
    1. As I understand it, Jim can travel at most 200km between wells, because it would be 10 hours at 10km/h to cover 100km. Then, his water will run out somewhere between wells where he can travel another 5
    hours at 20km/hr to cover another 100km. So in total he can travel up to 200km between wells. Correct?I understood it differently: either walk 10 hours at 10 km/hr or walk 5 hours at 20 km/hr. But it doesn't really matter: the way I understood it, Jim can only travel between wells that lie at most 100 km from each other. The way you understand it, Jim can travel at most 200 km between wells. Either way, it is a fixed number Jim can travel.
    2. There is a limitation on distance traveled between wells because of the time limitations imposed by the constraints above, so I don’t want to use a complete graph to describe the distances between all the wells. I want a sparse graph represented by an adjacency list instead.Or do as marlin suggested: just create a list of points (wells) and for each point in your walk, collect all points that lie at most 200 km (or 100 km) apart from Jim's current point. This is not the most efficient one, but since your graph is sparse, iterating over all points every step won't take that much time.
    Since you yourself seem to be not entirely clear about the constraints, I ask it again: where did you get this puzzle? Did you post it word-for-word here? Where can I find the original?

  • Levy flight or firefly algorithm in Labview or matlab

    Hello,
    Has anyone used Levy flight algorithm with Labview. Is there any toolkit  or library to implement this algorithm in Labview or at least a Matlab code that can be coupled with Labview via Mathscript??
    Thanks,
    Zied

    If you search the Web for "Levy Flight", you will find Matlab code.
    Bob Schor

  • Perturbation & Observation algorithm using labview

    Hi
    i have a problem with the mppt (maximum power point tracking) algorithm in labview, if you know how to do it help me please

    السلام عليكم ورحمة الله وبركاته
    الرجاء طرح الأسئلة بشكل واضح و كامل وذلك للدفع بهذا المنتدى العربي إلى الأمام وبذلك تعم المنفعة للجميع.
    للإجابة على شيئ من السؤال التالي قد يفيدك
    Using NI CompactRIO to Design a Maximum Power Point Tracking Controller for Solar Energy Application...

  • Iterative signal processing algorithms in Labview

    Hi
    I am learning to program in Labview. I am trying to program an iterative algorithm in Labview and I am having difficultires. It is a short algorithm and thought that perhaps someone with Labview experience may be able to show me the way. Here I describe the algorithm:
    I have data in an I by K matrix A where i are the samples (rows) and k the variables (columns). For n number of runs, n = 1,2,...N need to compute u(subscript n) and r(subscript n) from A(subscript n-1). (Note that u is vector of length i and r is a vector of length k). Results are obatined for each run, n, iteratively by improving on estimates of u and r.
    First I need to select start values for u(subscript n) in the first iteration of the algorithm. These start values can be any one of the columns of A. Then I want to repeat the following steps (1 to 5) until convergence:
    (Note that ' represents transpositionof vector /matrix; ^ represents power)
    1. Improve estimate of r(subscript n) by:
    r(subscript n) = [u(subscript n)' u(subscript n)]^-1 u(subscript n)' A(subscript n-1)
    2. Scale length of r(subscript n) to 1.0 by:
    r(subscript n) = r(subscript n) [r(subscript n)' r(subscript n)]^0.5
    3. Improve estimate of u(subscript n) for this run by:
    u(subscript n) = A(subscript n-1) r(subscript n) [r(subscript n)' r(subscript n)]^-1
    4. Imprve estimate of tee(subscript n) by:
    tee(subscript n) = [u(subscript n)' u(subscript n)]
    5. check for convergence: if tee(subscript n) minus tee(subscript n) in the previous iteration is smaller than say e.g. 0.00001 times tee(subscript n), the method has converged for this run, if not, go to step 1.  
    The Substract the effect of this run:  A(subscript n) = A(subscript n -1) - u(subscript n) r(subscript n)'    and then go to the start for the next run.
    I have tried to do this with shift registers but the problems I am having aare to do with the start values for u and the iterative updating...
    I hope someone can help. I know that MAth script is probably the best way to do this but I don't yet have it and would like to do it in the block diagram with Labview vi for math.
    Cheers,

    for anyone trying to help me...i worked it out. Perseverance is certainly good!

  • I want to know memory manament and data display algorithm in LabViEW.Where can I get some materials about them?

    I want to know memory manament and data display algorithm in LabViEW.Where can I get some materials about them? I need them to complete my essay .Thank you for your help.

    Memory menagement:
    http://zone.ni.com/devzone/conceptd.nsf/2d17d611efb58b22862567a9006ffe76/732cec772aa4fbe586256a37005541d3?OpenDocument
    About data display: what type of data you wat display?

  • Interfacing a C++ Console Application Genetic Algorithm with LabVIEW

    Hi,
    I am have recently modified the GENESIS genetic algorithm using C++ so that it runs on a Windows machine (before it only ran under UNIX). In my experimental work the aim is to control everything using LabVIEW, including this Genetic algorithm.
    My problem comes from the fact that the Genetic Algorithm is set-up as a console application, a library file is created  containing the input parameters of the VI, then this is joined with an evaluation function that is dependant on the library file an an executable is created.
    I need to take some information collected from LabVIEW and give it to the genetic algorithm, but I don't know how to do this.
    Any Ideas?
    Thanks
    Alan Homer

    You can run most applications from a command line using the location/application.exe (where the location is where the executable is stored), all c++ applications run using:   int main (int argc, char **argv); where the argc is the number of arguments and argv is essentially a string table with the parameters passed to the program (will be used as code) the output if a command line application is the std out which can be piped to file or wired out from the standard out terminal.  To pass parameters from your LV code to the command line you should know the parameter list (sometimes empty). 
    Paul
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

  • Genetic Algorithms in Labview

    I'd like to implement some diagnostic applications in Labview, using
    genetic algorithms and fuzzy logic. Anyone can give me some guidelines
    to do this?
    Best Regards,
    Sérgio Cruz

    wrote:
    > I'd like to implement some diagnostic applications in Labview, using
    > genetic algorithms and fuzzy logic. Anyone can give me some guidelines
    > to do this?
    >
    I have implemented a genetic algorithm based control of a mobile robot
    using Mathematica Link for LabVIEW http://www.e-notebooks.com/products/
    link/. LabVIEW is in charge of communication with the robot, Mathematica
    was more suitable to implement the GA. I can provide with more details if
    you wish.
    Jean.
    e-NoteBooks Ltd
    http://www.e-notebooks.com
    http://www.sstreams.com
    Sent via Deja.com http://www.deja.com/
    Before you buy.

  • Looking for VCDIFF (RFC 3284) algorithm implemented in LabVIEW

    Hello forum,
    I am looking to see if anyone knows of a publicly available implementation of the VCDIFF binary differencing algorithm in native LabVIEW (G) ? 
    Here is a link to a paper on the RFC 3284 standard for those interested: http://tools.ietf.org/html/rfc3284
    There are a number of open source implementations in C/C++, but I would like to locate one in LabVIEW if possible.
    Regards!

    Implementing binary algorithmes in LabVIEW and especially compression algorithmes, while possibe is not a very smart idea. Aside from possible perfomance problems when you start to shuffle around on bit level, there is also the issue about how to proof the correctness of your implementation. Those open source C/C++ solutions have been used, peer reviewed and what else many times and all that has uncovered various flaws and bugs during the process.There is only a very small adience that will go and use your LabVIEW algorithme and even a much smaller one who is able to do any significant form of peer review.
    So all in all you are likely to end up with a somewhat to almost working implementation that nobody is going to use, for the gain of bragging that you did it in LabVIEW.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • FFT algorithm routines in Labview

    Hello,
    Real FFT.vi uses the fast radix-2 FFT routines or a mixed radix cooley-tukey algorithm in Labview.
    Do these kinds of routines have the 2N-point real FFT method?
    2N-point real FFT method is to utilize the single complex FFT by processing  two seperated N points (even index data- real N-points input, odd index data-imaginary N-points input in single complex FFT routine)
    And what are differences between radix-2 FFT and fast radix-2 FFT routines?
    And  what are differences between cooley-tukey algorithm and mixed radix cooley-tukey algorithm ?

    fefelove wrote:
    2N-point real FFT method is to utilize the single complex FFT by processing  two seperated N points (even index data- real N-points input, odd index data-imaginary N-points input in single complex FFT routine)
    If I understand you right, you could just typecast your interlaced array into a complex array of half the lenght before feeding it to the complex FFT.
    Can you explain your concerns about the algorithms. Maybe wikipedia will help?
    LabVIEW Champion . Do more with less code and in less time .

  • How can i sort out the N lowiest elements from an 1D array faster than using the build in sort function (1D-array) in Labview?

    I need an algorithm that is based on the same sorting-algorithm that Labview uses (or one that is just as fast) but it only needs to sort out the N lowiest elements (and the N-element output array don't need to be sorted).
    /Jonas

    I want all three zeros in the output. You can se the algorithm that I'm looking for as a soft version of Labviews own sort algorithm that only gives you the N (always less then the length of the array) lowiest values as output.If two elements contain the same small value both should be sorted out.
    /Jonas

  • Using labview cosimulation, how to control PWM duty cycle in multisim

    I am new to using Multisim with LabVIEW using cosimulation. I want to ask if there is a PWM component in Multisim that can have its duty cycle be controlled using LabVIEW? I have an algorithm in LabVIEW that outputs duty cycle values from 0 to 1, representing duty cycle percentages.
    How do I control the PWM duty cycle in Multisim using LabVIEW cosimulation?
    Many thanks,
    SPECTRE
    Solved!
    Go to Solution.

    Hi Spectre,
    In Multisim, search for the parts base on functionality, there are some PWM models in the database.  Have a look at this knowledge base  if you don't know how to search for parts:
    http://digital.ni.com/public.nsf/allkb/7309A5CABC677296862577ED006EC99E
    Aslo, have a look at this knowledgebase:
    http://digital.ni.com/public.nsf/allkb/EF391C48CF71AE4F862571B900644F84
    This article shows how you can get Mutlisim and LabVIEW to co-simiualte:
    http://www.ni.com/white-paper/13663/en
    I hope this helps
    Tien P.
    National Instruments

  • Constraining the algorithm for assignment of multiple plot colors

    I would like to know if there is some way to modify the algorithm that
    LabVIEW uses to automatically assign different colors when a graph
    displays multiple plots. In particular, given the default background
    color (black), it appears that black is never used for a plot color.
    However, if I programmatically change the background color to white,
    for example, I would like the plot color assignment to not use white. I
    would also like to know if it is possible to constrain the plot color
    assignment to a single color a priori, without having to go back and
    explicitly assign the colors of each plot via the property node in a
    loop.
    Thanks.
    Lyle

    I think you will have to create your own plot color assignment function to do this.
    You can set the color of each plot by using the active plot property (index of the plot you want to change) and then set the plot color property (just expand one and the same property ndoe to set both at the same time).
    You can then make that function check the background color and choose a color table that fits. If this is in a built application you would run this function when a color change is detected, if it's in the development environment you need this feature make the function ask for a VI and plot name (so that it can get a reference to the plot) and put it in your projects folder. That way whenever you need to set the plot colors differently you just select this function from the Tools menu of LabVIEW. An easier alternative though would be to just create the different graphs you need (with the colors for all plots already defined correctly for that background etc.) and save them as custom indicators...
    MTO

  • Using Simulink data in labview

    Hello everyone !
    I have made an algorithm in labview and the simulink model data needs to be manipulated in this algorithm. The output of this algorithm is to be fed back in simulink model. I am able to map labview front panel controls with simulink model but i cannot use its data in block diagram window. How do i do it ?

    Here you have three options:
    1. Create a DLL from your model and use the Model Interface Toolkit (http://sine.ni.com/nips/cds/view/p/lang/en/nid/211815) to load the model into LabVIEW;
    2. Convert your model into a LabVIEW Control Design and Simulation (http://www.ni.com/white-paper/11281/en/) SubSystem and use the Control and Simulation Loop to run the model;
    3. Use some sort of communication between LabVIEW and Simulink (like OPC server) to communicate between simulations. This last option, although possible, it requires some sort of synchronization between products to avoid the loop to run too fast.
    Hopefully this helps,
    Barp - Control and Simulation Group - LabVIEW R&D - National Instruments

  • A little help needed with Dijkstra's algorithim

    Hi I'm trying to implement Dijkstra's algorithm. I have a class GraphMaker
    which creates the graph, and is the main console. And then a second class for Dijkstra's algorithm. Overall it works alright but, I can't to figure out how to get it to find the shortest path for all the cities.
    Here's a sample output:
    BOSTON To NEW YORK: Cost of: 22 MIAMI: Cost of: 122
    NEW YORK To MIAMI: Cost of: 50 HONOLULU : Cost of: 422
    DETROIT To CHICAGO: Cost of: 22 PHOENIX: Cost of: 62
    MIAMI To HONOLULU : Cost of: 402
    CHICAGO To
    PHOENIX To
    HONOLULU To DETROIT: Cost of: 302 PHOENIX: Cost of: 102
    [BOSTON ----> ]
    [BOSTON ----> , NEW YORK------>]
    [BOSTON ----> , NEW YORK------>, HAWAII------>, DETROIT------>]
    [BOSTON ----> , NEW YORK------>, MIAMI------>]
    [BOSTON ----> , NEW YORK------>, HAWAII------>,CHICAGO------>]
    [BOSTON ----> , NEW YORK------>, HAWAII------>, PHOENIX------>]
    [BOSTON ----> , NEW YORK------>, HAWAII------>]
    I know its not the most efficient looking output, I'm intermediate coder at best. But at the top you have 7 cities from BOSTON to HONOLULU, and the cities they connect to. Where I'm really having the problem is at the bottom part. It shows the shortest paths from Boston to other the cities. But I want it show not only the shortest paths from Boston but also the shortest paths from the other cities, to their destination.
    Here's my code:
    The GraphMaker Class:
    public class GraphMaker {
       private int [][]  edges;  // The adjacency matrix
       private Object [] Cities; // Cities
       public static int count;
       public GraphMaker (int n) {
          edges  = new int [n][n];
          Cities = new Object[n];
       public int GetSize()
            return Cities.length;
       public void   SetCities (int vertex, Object label)
            Cities[vertex]=label;
       public Object GetCities (int vertex)             
            return Cities[vertex];
       public void AddEdge  (int source, int target, int w)
            edges[source][target] = w;
       public boolean IsEdge (int source, int target) 
            return edges[source][target]>0;
       public void  RemoveEdge (int source, int target) 
            edges[source][target] = 0;
       public int GetWeight (int source, int target) 
            return edges[source][target];
       public int [] Neighbors (int vertex) {
          count = 0;
          for (int i=0; i<edges[vertex].length; i++) {
          if (edges[vertex]>0) count++;
    final int[]answer= new int[count];
    count = 0;
    for (int i=0; i<edges[vertex].length; i++) {
         if (edges[vertex][i]>0) answer[count++]=i;
    return answer;
    public void print () {
    for (int j=0; j<edges.length; j++) {
         System.out.print (Cities[j]+" To ");
         for (int i=0; i<edges[j].length; i++) {
         if (edges[j][i]>0) System.out.print (Cities[i]+": Cost of: " +
                   " " + edges[j][i]+" ");
         System.out.println (" ");
    public static void main (String args[]) {
    GraphMaker t = new GraphMaker (7);
    t.SetCities (0, "BOSTON");
    t.SetCities(1, "NEW YORK");
    t.SetCities (2, "DETROIT");
    t.SetCities (3, "MIAMI");
    t.SetCities (4, "CHICAGO");
    t.SetCities (5, "PHOENIX");
    t.SetCities (6, "HAWAII");
    t.AddEdge (0,1,22);
    t.AddEdge (1,6,422);
    t.AddEdge (0,3,122);
    t.AddEdge (2,4,22);
    t.AddEdge (2,5,62);
    t.AddEdge (6,5,102);
    t.AddEdge (3,6,402);
    t.AddEdge (6,2,302);
    t.AddEdge (1,3,50);
    t.print();
    final int [] pred = Dijkstra.dijkstra (t, 0);
    for (int n=0; n<7; n++) {
         Dijkstra.PrintPath (t, pred, 0, n);
    And my Dijkstra class
    import java.util.LinkedList;
    public class Dijkstra {
       public static int [] dijkstra (GraphMaker G, int s) {
          final int [] dist = new int [G.GetSize()];  // shortest known distance from "s"
          final int [] pred = new int [G.GetSize()];  // the node that preceeds it in the path
          final boolean [] visited = new boolean [G.GetSize()]; // all false initially
          for (int i=0; i<dist.length; i++) {
          dist[i] = Integer.MAX_VALUE;
          dist[s] = 0;
          for (int i=0; i<dist.length; i++) {
               final int next = SmallestVertex (dist, visited);
               visited[next] = true;
               final int [] n = G.Neighbors (next);
                    for (int j=0; j<n.length; j++) {
                         final int v = n[j];
                         final int d = dist[next] + G.GetWeight(next,v);
                              if (dist[v] > d) {
                                   dist[v] = d;
                                   pred[v] = next;
          return pred;
       private static int SmallestVertex (int [] dist, boolean [] v) {
          int x = Integer.MAX_VALUE;
          int y = -1;  
          for (int i=0; i<dist.length; i++) {
          if (!v[i] && dist<x) {y=i; x=dist[i];}
    return y;
    public static void PrintPath (GraphMaker G, int [] pred, int s, int e) {
    final LinkedList path = new LinkedList();
    int x = e;
    while (x!=s) {
         path.add (0, G.GetCities(x) + "------>");
         x = pred[x];
    path.add (0, G.GetCities(s) + " ----> ");
    System.out.println (path);

    These are the actual results I get.:
    BOSTON To NEW YORK: Cost of: 22 MIAMI: Cost of: 122
    NEW YORK To MIAMI: Cost of: 50 HONOLULU : Cost of: 422
    DETROIT To CHICAGO: Cost of: 22 PHOENIX: Cost of: 62
    MIAMI To HONOLULU : Cost of: 402
    CHICAGO To
    PHOENIX To
    HONOLULU To DETROIT: Cost of: 302 PHOENIX: Cost of: 102
    [BOSTON ----> ]
    [BOSTON ----> , NEW YORK------>]
    [BOSTON ----> , NEW YORK------>, HONOLULU------>, DETROIT------>]
    [BOSTON ----> , NEW YORK------>, MIAMI------>]
    [BOSTON ----> , NEW YORK------>, HONOLULU------>,CHICAGO------>]
    [BOSTON ----> , NEW YORK------>, HONOLULU------>, PHOENIX------>]
    [BOSTON ----> , NEW YORK------>, HONOLULU------>]
    BOSTON To NEW YORK: Cost of: 22 MIAMI: Cost of: 122
    NEW YORK To MIAMI: Cost of: 50 HONOLULU : Cost of: 422
    DETROIT To CHICAGO: Cost of: 22 PHOENIX: Cost of: 62
    MIAMI To HONOLULU : Cost of: 402
    CHICAGO To
    PHOENIX To
    HONOLULU To DETROIT: Cost of: 302 PHOENIX: Cost of: 102
    ^
    ^
    ^
    This part is what I expected I'm fine with that.
    [BOSTON ----> ]
    [BOSTON ----> , NEW YORK------>]
    [BOSTON ----> , NEW YORK------>, HONOLULU------>, DETROIT------>]
    [BOSTON ----> , NEW YORK------>, MIAMI------>]
    [BOSTON ----> , NEW YORK------>, HONOLULU------>,CHICAGO------>]
    [BOSTON ----> , NEW YORK------>, HONOLULU------>, PHOENIX------>]
    [BOSTON ----> , NEW YORK------>, HONOLULU------>]
    ^
    ^
    ^
    This is where I'm having the problem, it shows the shortest paths from Boston to other cities,which fine right there those are accurate, but I also need it to show the same for the other cities
    for example something this:
    [NEW YORK----> ]
    [NEW YORK ----> , MIAMI------>]
    [NEW YORK ----> , NEW YORK------>, HAWAII------>, DETROIT------>]
    [NEW YORK ----> , NEW YORK------>, MIAMI------>]
    [NEW YORK ----> , NEW YORK------>, HAWAII------>,CHICAGO------>]
    [NEW YORK----> , HONOLULU------>]
    This would be the results from New York to other cities, although the actual routes for NY would probably be a little different. It would also do the same all the other cites
    like DETROIT
    [DETROIT ----> ]
    [DETROIT  ----> , CHICAGO------>]
    [DETROIT ----> , CHICAGO------>, HAWAII------>,]
    [DETROIT  ----> , NEW YORK------>]
    [DETROIT  ----> ,CHICAGO------>]
    [DETROIT ----> , HONOLULU------>]
    It should produce a overall chart similar to this:
    BOSTON ----> ]
    [BOSTON ----> , NEW YORK------>]
    [BOSTON ----> , NEW YORK------>, HONOLULU------>, DETROIT------>]
    [BOSTON ----> , NEW YORK------>, MIAMI------>]
    [BOSTON ----> , NEW YORK------>, HONOLULU------>,CHICAGO------>]
    [BOSTON ----> , NEW YORK------>, HONOLULU------>, PHOENIX------>]
    [BOSTON ----> , NEW YORK------>, HONOLULU------>]
    [NEW YORK----> ]
    [NEW YORK ----> , MIAMI------>]
    [NEW YORK ----> , NEW YORK------>, HAWAII------>, DETROIT------>]
    [NEW YORK ----> , NEW YORK------>, MIAMI------>]
    [NEW YORK ----> , NEW YORK------>, HAWAII------>,CHICAGO------>]
    [NEW YORK----> , HONOLULU------>]
    [DETROIT ----> ]
    [DETROIT  ----> , CHICAGO------>]
    [DETROIT ----> , CHICAGO------>, HAWAII------>,]
    [DETROIT  ----> , NEW YORK------>]
    [DETROIT  ----> ,CHICAGO------>]
    [DETROIT ----> , HONOLULU------>]
    and so on for the other cities
    Hopefully makes it a little clearer

Maybe you are looking for