Code covered by the BSD License  

Highlights from
Solve the puzzle via djstra shortest path algorithm

Be the first to rate this file! 11 Downloads (last 30 days) File Size: 24.1 KB File ID: #34670
image thumbnail

Solve the puzzle via djstra shortest path algorithm

by Su Dongcai

 

19 Jan 2012 (Updated 20 Jan 2012)

an interesting application of djstra algorithm

| Watch this File

File Information
Description

This file apply djstra algorithm(only consider the positive edge weight case) to solve the
puzzle and visualize the result.
Please run the following commands to duplicate the screen shot(have fun :):

mex vcDjstra.cpp;%compile the cpp file
im = imread('puzzle.png'); im = rgb2gray(im);
[pc, path] = shortestPath(im, [57, 94], [471, 496]);
Acknowledgement:
The puzzle.png is from steven's blog:
http://blogs.mathworks.com/steve/?s_cid=global_nav
Note:
The core file that implement djstra algorithm is 'cShortestPath.h', the compiler I used in
msvc++ 6.0

MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
20 Jan 2012

Fix a bug on line59 'cShortestPath.h', where I erroneously written operator '%' instead of '/', this bug result in the incorrect path cost 'pc'

Tag Activity for this File
Tag Applied By Date/Time
demo Su Dongcai 19 Jan 2012 12:14:46
image processing Su Dongcai 19 Jan 2012 12:14:46
graph Su Dongcai 19 Jan 2012 12:14:46
djstra Su Dongcai 19 Jan 2012 12:14:46
djstra deepesh makhija 22 Jan 2012 22:26:38

Contact us at files@mathworks.com