how to plot a Directed graph with this structure

2 ビュー (過去 30 日間)
Mohammad
Mohammad 2016 年 9 月 26 日
編集済み: Mohammad 2016 年 9 月 28 日
hi this is mostly a programming question but i already spent some hours to solve it and still stuck. i have created a struct Graph(:) , inside each element of graph there is a 2d array that has information about who connects to who.
for example graph(1).Re = [72,0] 72 % 72->0 graph(2).Re = [45 50 60,0 20 15]% 45->0 50->20 ... ... i also have XY coordinates for each of them inside another struct for example : clusterheads.nodes(1,54).index=72 clusterheads.nodes(1,54).x=150; clusterheads.nodes(1,54).y=40; i also create a color for each node for plotting purposes clusterheads.nodes(1,54).color=[0 0 1] ///////////////// now i want to plot a Directed graph between these nodes with their position.
any tip or help is appreciated

回答 (1 件)

Steven Lord
Steven Lord 2016 年 9 月 26 日
If you're using release R2015b or later, create a digraph object and call plot on it.
  1 件のコメント
Mohammad
Mohammad 2016 年 9 月 28 日
編集済み: Mohammad 2016 年 9 月 28 日
Okay but how can i Define position of each node? in digraph it only says nodex connects to nodey without definition of what is nodex and nodey position in 2d space, am i right?

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

カテゴリ

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