Currently in the process of my A-level project, I am focused on the task of determining the maximum flow of a network using javascript.
My approach involves working with a 2D array where the values in the array represent distances between two points. For instance:
0 2 2 0
0 0 1 2
0 0 0 2
0 0 0 0
I believe a recursive technique is necessary to find a path. Below is some pseudocode assuming a 4x4 array, with 'a' at (0,0) and 'b' at (3,3).
function search(a,b)
from a to b
if element(i,j) != 0 then
store value of element
search(j,3)
My query pertains to if this is the correct structure for a depth-first search algorithm. I appreciate any assistance provided.