Effacer les filtres
Effacer les filtres

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

10 vues (au cours des 30 derniers jours)
Qijie Fang
Qijie Fang le 19 Juin 2017
Commenté : Jay Vaidya le 1 Jan 2020
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.

Réponses (1)

Stephen Jue
Stephen Jue le 21 Juin 2017
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 commentaire
Jay Vaidya
Jay Vaidya le 1 Jan 2020
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

Connectez-vous pour commenter.

Catégories

En savoir plus sur 数据分布图 dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!