Question regarding plotting graph

2 ビュー (過去 30 日間)
jana
jana 2013 年 12 月 6 日
編集済み: Kelly Kearney 2013 年 12 月 19 日
I wanted to plot a graph with 300 nodes represented as a 300x300 adjacency matrix. it looks like this(it is just an example)
[0 2 5 0;0 0 1 4;0 1 0 2 ; 0 3 2 0]
if the matrix has a zero that means there is no edge between the nodes. If it is not zero, then there is an edge with distance as the number in the matrix.
Please help!

回答 (2 件)

Kelly Kearney
Kelly Kearney 2013 年 12 月 6 日
  2 件のコメント
John
John 2013 年 12 月 6 日
I tried gplot but it needs coordinate inputs.. I don't quite understand how to use it.
Kelly Kearney
Kelly Kearney 2013 年 12 月 6 日
編集済み: Kelly Kearney 2013 年 12 月 19 日
Do you mean that you're looking for something that will automatically determine the best locations for your nodes? There are some functions like that in the Bioinformatics toolbox:
adj = [0 2 5 0;0 0 1 4;0 1 0 2 ; 0 3 2 0];
b = biograph(adj);
view(b);
I think that function uses Graphviz (www.graphviz.org) under its hood, so if you don't have that toolbox, you might want to go to that instead (and Graphviz includes several more layout algorithms).

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


Felix
Felix 2013 年 12 月 6 日
編集済み: Felix 2013 年 12 月 6 日
As I understand this, the adjacency matrix only tells how the nodes are connected, not where each of them is located. So your challenge is to construct this coordinate matrix. If they are e.g. in a 20x15 matrix (=300 points), it would be [1,1;...1,15;...;20,1;...;20,15]. (I assume, but I've never used gplot either....)

カテゴリ

Help Center および File ExchangeGraph and Network Algorithms についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by