plotting an adjacency matrix

How can I plot an adjacency matrix in matlab
so it comes up like this. Using say this matrix
[1/60 7/15 7/15 1/60 1/601/60;
1/6 1/6 1/6 1/6 1/6 1/6;
19/60 19/60 1/60 1/60 19/60 1/60;
1/60 1/60 1/60 1/60 7/15 7/15;
1/60 1/60 1/60 7/15 1/60 7/15;
1/60 1/60 1/60 11/12 1/60 1/60]

Respuestas (3)

Walter Roberson
Walter Roberson el 15 de En. de 2016

0 votos

Note that as an adjacency matrix, what you have simply defines the 6 x 6 "complete graph": non-zero values in the matrix imply an edge, but the exact value is otherwise not paid attention to.
If you want the weights represented on the graph, then you will need to say how you want the weights represented.

3 comentarios

A123456
A123456 el 15 de En. de 2016
A=[m,n] and m and n are both 1:6. I want to plot n against m. How could I do this, as I'm not getting a plot similar to the one I posted above.
imagesc(A)
perhaps ?
A123456
A123456 el 15 de En. de 2016
that's the one, thanks!

Iniciar sesión para comentar.

aqib javed
aqib javed el 7 de Dic. de 2016

0 votos

you can use heatmap(A) as well. But imagesc(A) is the most practiced command
Steven Lord
Steven Lord el 7 de Dic. de 2016

0 votos

If you want to plot the adjacency matrix as a graph, create a graph or digraph object using your adjacency matrix then plot that object and customize as desired. See this documentation page for examples and more information.

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 15 de En. de 2016

Respondida:

el 7 de Dic. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by