DIJKSTRA_SPMD
Parallel Version of Dijkstra's Minimum Distance Algorithm


DIJKSTRA_SPMD is a MATLAB program which runs a simple demonstration of Dijkstra's algorithm for determining the minimum distance from one node in a graph to all other nodes, using the SPMD command to carry out the task in parallel.

The example graph handled by the program has 6 nodes and 8 links, each with a positive length:

    N0--15--N2-100--N3
      \      |     /
       \     |    /
        40  20  10
          \  |  /
           \ | /
            N1
            / \
           /   \
          6    25
         /       \
        /         \
      N5----8-----N4
      

Using "Inf" to indicate that there is no link between two nodes, the distance matrix for this graph is:

          0   40   15  Inf  Inf  Inf
         40    0   20   10   25    6
         15   20    0  100  Inf  Inf
        Inf   10  100    0  Inf  Inf
        Inf   25  Inf  Inf    0    8
        Inf    6  Inf  Inf    8    0
      

Dijkstra's algorithm efficiently determines the length of the shortest path from node 0 to other nodes as:

        From 0 to:  0    1    2    3    4    5
        Distance:   0   35   15   45   49   41
      

Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Related Data and Programs:

CONTRAST_SPMD, a MATLAB program which demonstrates the SPMD parallel programming feature for image operations; the client reads an image, the workers increase contrast over separate portions, and the client assembles and displays the results.

CONTRAST2_SPMD, a MATLAB program which demonstrates the SPMD parallel programming feature for image operations; this improves the contrast_spmd program by allowing the workers to share some data; this makes it possible to eliminate artificial "seams" in the processed image.

DIJKSTRA, a MATLAB program which runs a simple example of Dijkstra's minimum distance algorithm for graphs.

DIJKSTRA_OPENMP, a C program which uses OpenMP to parallelize a simple example of Dijkstra's minimum distance algorithm for graphs.

FACE_SPMD, a MATLAB program which demonstrates the SPMD parallel programming feature; the client has a 3D box that has been dissected into tetrahedrons. Multiple workers cooperate to construct a list of the triangular faces that lie on the boundaries of the box.

FD2D_HEAT_EXPLICIT_SPMD, a MATLAB program which uses the finite difference method and explicit time stepping to solve the time dependent heat equation in 2D. A black and white image is used as the "initial condition". MATLAB's SPMD facility is used to carry out the computation in parallel.

IMAGE_DENOISE_SPMD, a MATLAB program which demonstrates the SPMD parallel programming feature for image operations; the client reads an image, the workers process portions of it, and the client assembles and displays the results.

MATRIX_ASSEMBLE_SPMD, a MATLAB program which demonstrates the SPMD parallel programming feature by having each worker assemble part of the Hilbert matrix, which is then combined into one array by the client program.

PRIME_SPMD, a MATLAB program which counts the number of primes between 1 and N; running in parallel using MATLAB's "SPMD" feature.

QUAD_SPMD, a MATLAB program which estimates an integral using quadrature; running in parallel using MATLAB's "SPMD" feature.

Reference:

The User's Guide for the Parallel Computing Toolbox is available at http://www.mathworks.com/access/helpdesk/help/pdf_doc/distcomp/distcomp.pdf

  1. Edsger Dijkstra,
    A note on two problems in connexion with graphs,
    Numerische Mathematik,
    Volume 1, 1959, pages 269-271.
  2. Gaurav Sharma, Jos Martin,
    MATLAB: A Language for Parallel Computing,
    International Journal of Parallel Programming,
    Volume 37, Number 1, pages 3-36, February 2009.

Source Code:

Examples and Tests:

You can go up one level to the MATLAB source codes.


Last revised on 21 March 2011.