Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Hello. I'm using the function ''shortestpath'' to solve a problem. However, I wish the output was a matrix with two columns, one the ''from'' nodes and the other the ''to'' nodes. Any ideas?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
%%using the shortestpath function on the example below, we have the following answer:
from = [1 2 3 3 5]; to = [2 3 4 5 6]; size = [16 4 4 6 4]; G = graph(from,to,size); [P,d] = shortestpath(G,1,6)
P = 1 2 3 5 6 d = 30 %%I wish the Path was like:
ans = [1 2; 2 3; 3 5; 5 6]
Thanks and best regards to all!
0 comentarios
Respuestas (1)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!