Here is something that has been getting the best of me for past few days. Hopefully someone can point me get in the right direction.
I have a graph G, and I need to produce A which is the adjacent (adjacency) matrix in MatLab. In addition, I need to produce B which is another matrix that contains the length of the shortest path B(i,j) for i and j in graph G. Lets assume equal edge weights. The part I am having trouble with is producing B -- the shortest path. Why? Normally I would use nested loops to get this done (brute force method), however I would like for this to be done using matrix operations (one loop okay, just not nested).
Here is what I so far:
I need to use an algorithm to find
B(shortest path). I believe something like Dijkstra, Warshall or Floyd algorithm is the direction I need to go in. However they all apear to use some method of the "nested loops." Unless I am missing something.Transitive closure needs to be performed on on my adjacency matrix
Ahowever this requires one of above algorithms.
Any hints or directions would be much appreciated!