Skip to content

A shortest path algorithm with special input solved with dynamic programming

Notifications You must be signed in to change notification settings

Selubi/Shortest-Path-special

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

Shortest-Path-special

A shortest path algorithm with special input, solved with recursion

Overview

Given H amount of number h1,h2,...,hH and V amount of number v1,v2,...,vV
Horizontally H, Vertically V, H*V amount of vertex is arranged in a matrix.
These vertex make up a directional graph.
Let Vi,j be the vertex at ith row and jth column.
From every Vi,j, there are three directional edge going to Vi+1,j,Vi,j+1,Vi+1,j+1, assuming the vertex exists
Given H amount of number h1,h2,...,hH and V amount of number v1,v2,...,vV ,the cost of each of these edges is the absolute difference between hi and vj.
This algorithm finds the shortest path of the given graph

Input
H X
h1,h2,...,hH
v1,v2,...,vV

Output
three matrixes of H*V size.
The first matrix gives the cost of the edges going from the vertex.
The second matrix gives the total cost needed to go from 0,0 to that vertex.
The third matrix prints out the parent of the current vertex.

About

A shortest path algorithm with special input solved with dynamic programming

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages