How to manipulate the sample code to get it work in the command h=view(bio​graph(DG,[​],'ShowWei​ghts','on'​)) Biograph object with 6 nodes and 11 edges.

1 view (last 30 days)
The sample code runs just fine showing an error "CM must be a sparse or full square matrix." but when i change the values with my data then the same error appears without executing the commands. this is the sample code:(pic1.png) while my code is:(pic.png).I just want to know that both are same set of data but while executing an error appears which asks the result to be sparse and my result is in the form of sparse but it does not works.

Answers (1)

sara masoud
sara masoud on 8 Dec 2017
>>W = [.41 .99 .51 .32 .15 .45 .38 .32 .36 .29 .21]; DG = sparse([6 1 2 2 3 4 4 5 5 6 1],[2 6 3 5 4 1 6 3 4 3 5],W)
DG =
(4,1) 0.4500
(6,2) 0.4100
(2,3) 0.5100
(5,3) 0.3200
(6,3) 0.2900
(3,4) 0.1500
(5,4) 0.3600
(1,5) 0.2100
(2,5) 0.3200
(1,6) 0.9900
(4,6) 0.3800
h = view(biograph(DG,[],'ShowWeights','on')) Biograph object with 6 nodes and 11 edges.

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!