plotting an adjacency matrix

조회 수: 23 (최근 30일)
A123456
A123456 2016년 1월 15일
답변: Steven Lord 2016년 12월 7일
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]

답변 (3개)

Walter Roberson
Walter Roberson 2016년 1월 15일
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
Walter Roberson
Walter Roberson 2016년 1월 15일
imagesc(A)
perhaps ?
A123456
A123456 2016년 1월 15일
that's the one, thanks!

댓글을 달려면 로그인하십시오.


aqib javed
aqib javed 2016년 12월 7일
you can use heatmap(A) as well. But imagesc(A) is the most practiced command

Steven Lord
Steven Lord 2016년 12월 7일
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.

카테고리

Help CenterFile Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by