Plotting A Network Diagram
17 views (last 30 days)
Show older comments
So I have certain dataset that looks like this:
Source destination time quality
192.168.2.101 192.168.2.102 0.691597938537598 0.76
192.168.2.101 192.168.2.109 0.691597938537598 0
192.168.2.101 192.168.2.106 0.691597938537598 0.64
192.168.2.101 192.168.2.103 0.691597938537598 0.7
192.168.2.101 192.168.2.107 0.691597938537598 0.95
192.168.2.101 192.168.2.110 0.691597938537598 0.5
I want to draw a network where edges are between source and destination and the edge weights are based on the value in quality.
However when ever I try to create an EdgeTable (I imported the above dataset as table named me_1, I get an error. This is my code,
EdgeTable = table([me_1.ip' me_1.neighbor'],me_1.lq,'VariableNames',{'EndNodes' 'Weight'});
What am I doing wrong? Also what would be the best way to show network topology change based on the time value of my dataset?
Thanks.
0 Comments
Answers (2)
Walter Roberson
on 9 May 2016
2 Comments
Walter Roberson
on 10 May 2016
"I want to draw a network where edges are between source and destination and the edge weights are based on the value in quality."
And the link shows drawing a graph with the thickness of the edges proportional to the edge weight (which is something you requested in your duplicate posting)
If you need to get node numbers, then put all of the cell strings representing the IP addresses together in a single cell array and use unique() on it. Then ismember() against the unique array gives you a node number. You can use the source node numbers and destination node numbers in a graph() call.
Steven Lord
on 10 May 2016
What is the full text of the error message you received when you tried to construct that table?
If you can't construct that table and use the digraph constructor that accepts tables, consider creating it using source and target node pairs (the s and t input arguments described on the digraph documentation page) and add weights afterwards. Then use the approach given in the "Edge Line Width Proportional to Edge Weight" example on the plot documentation page.
0 Comments
See Also
Categories
Find more on Graph and Network Algorithms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!