Hi i have a dataset of 1853 rows and 2 columns, sample of dataset is as follows:
1 105
1 104
2 1100
10 1165
813 1320
15 105
19 90
105 813
i want to create a graph to find distance between each node from other. For example if i enter input node 1, it will show that distance between 1 and 105 is 1, and between 1 and 813 is 2 (because it will come next to 105). and between 1 and 1320 is 3. (as shown in image below). and similarly for other nodes.
Any help will be greatly appreciated.

 Respuesta aceptada

Walter Roberson
Walter Roberson el 3 de Jun. de 2017

1 voto

To get the tree of distances from a node like you show, see https://www.mathworks.com/help/matlab/ref/graph.shortestpathtree.html

4 comentarios

Tha saliem
Tha saliem el 4 de Jun. de 2017
Thanks for your help. I have one more question. I want to know that how can I do it directly from the dataset i mean without plotting a graph first?
Walter Roberson
Walter Roberson el 4 de Jun. de 2017
The routines I referred to do not require drawing anything. You use graph() or digraph() to create the data structures but you do not need to draw if you don't want to.
Tha saliem
Tha saliem el 4 de Jun. de 2017
Thanks alot.
Waseem AL Aqqad
Waseem AL Aqqad el 24 de En. de 2021
Thank you, Walter.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Networks en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 3 de Jun. de 2017

Comentada:

el 24 de En. de 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by