How to draw a weighted graph G=(V,E)

2 views (last 30 days)
Saber
Saber on 31 Aug 2013
Commented: Nac selli on 12 May 2017
Assume that we have a weighted graph G=(V,E). We know its adjacency matrix and position of vertices. After some calculations we see some edges has weights w=0. then we have to delete some edges from the original graph and redraw the graph. my question is that how I can do this?

Answers (1)

Youssef  Khmou
Youssef Khmou on 1 Sep 2013
Edited: Youssef Khmou on 1 Sep 2013
is the original graph a sparse matrix? generally you can delete the values using this example :
% given a vector( or matrix) G
G=randn(10,2);
% some zeros values
G(2:5,1)=0;
% REmoving zeros
G(G==0)=[]; % this operation maps the matrix to vector
Next you can reshape the result for different dimensions .
  3 Comments
Youssef  Khmou
Youssef Khmou on 2 Sep 2013
I think it is possible to resolve the problem if you provide all the details about your program, because i do not have the graph2d function,
Waiting for details i think you can remove the zeros with w(w==0)=[]
Nac selli
Nac selli on 12 May 2017
Hello, i need some help to calculate the edge weight. can i get the code that you are using. thank you

Sign in to comment.

Categories

Find more on Graph and Network Algorithms in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!