How to turn an adjacency matrix into a graph of cubes?

조회 수: 1 (최근 30일)
Wolfgang McCormack
Wolfgang McCormack 2021년 4월 26일
댓글: Steven Lord 2021년 4월 26일
Hi all,
How can I turn the adjacency matrix into a graph of cubes like this? Also, I create my adjacency matrixes in Excel, do you have any suggestion for making them in Matlab when there are too many variables?
https://en.wikipedia.org/wiki/File:Symmetric_group_4;_Cayley_graph_1,5,21_(adjacency_matrix).svg
Thanks

채택된 답변

Steven Lord
Steven Lord 2021년 4월 26일
You just want to visualize the pattern? Call spy on your adjacency matrix. Alternately if you need color coding see scatter, pcolor, imagesc, etc.
  댓글 수: 2
Wolfgang McCormack
Wolfgang McCormack 2021년 4월 26일
@Steven Lord thanks, yes, I think scatter is better but how do I create those lines where squares are filled? Like should I use multiple xline and yline? becuase the matrix includes more than 100 entries.
Steven Lord
Steven Lord 2021년 4월 26일
A = sprand(10, 10, 0.2);
[r, c] = find(A);
scatter(c, r, 20, 's', 'filled');
grid on
set(gca, 'YDir', 'reverse')
axis([1 10 1 10])
figure
spy(A)
grid on
axis([1 10 1 10])

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by