How can I create a matrix from the nodes-edges-graph?

4 ビュー (過去 30 日間)
Qijie Fang
Qijie Fang 2017 年 6 月 19 日
コメント済み: Jay Vaidya 2020 年 1 月 1 日
I am doing my master thesis and I need to create a design-structure matrix automatically. I want to have this function: I define the interaction of the features first and then automatically create the graph(see below) and the matrix. How can I realize this function? Thx.
PS: DSM is like N-Square matrix, which show the interaction of the features. It's simpler because it's binary. The elements are either 0 or 1, means relevant or irrelevant.

回答 (1 件)

Stephen Jue
Stephen Jue 2017 年 6 月 21 日
You can create a design-structure matrix from a graph object by using the adjacency method.
Once the matrix is created, heatmap is a good way to visualize it.
This code demonstrates how to create an adjacency matrix (or DSM) from a graph, then plot a heatmap of the matrix:
s = [1 1 1 2 2 3];
t = [2 3 4 5 6 7];
G = digraph(s,t)
figure
subplot(1,2,1)
plot(G)
A = adjacency(G);
subplot(1,2,2)
heatmap(A)
  1 件のコメント
Jay Vaidya
Jay Vaidya 2020 年 1 月 1 日
Dear Mr Stephen,
I am having the similar problem, https://www.mathworks.com/matlabcentral/answers/498570-how-to-convert-the-graph-below-in-to-heatmap here. It would be really great if you could help me with this.
I have been putting questions for this as if you see this thread https://www.mathworks.com/matlabcentral/answers/498447-how-can-i-convert-2-column-matrix-to-a-cell-array This thread was made for the same question. My ultimate goal is to transform,
matrix->graph->adjacency matrix-> heatmap. My ultimate goal is to plot a heatmap from the input matrix. The input matrix is fig a (below). The goal is heatmap which I guess will need fig c. When I use a couple of solutions provided, I dont find the SizeX and SizeY in fig b and fig c to be matching. But I need it to be matched so that I can just represent the graph in form of a heatmap. Thanks in advance. Happy new year 2020. 7.JPG

サインインしてコメントする。

カテゴリ

Help Center および File Exchange数据分布图 についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!