Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. W = [2 1 1 2 5 4 1 2 8 3 6 3 7 2 5 6];
  2. DG = sparse([1 1 2 2 2 3 3 3 4 4 4 5 5 6 6 7],[3 2 3 5 4 6 5 4 7 5 6 6 7 8 7 8],W,8,8)
  3. h= view(biograph(DG,[],'ShowWeights','on', 'ShowArrows','on'))
  4. [dist, path, pred] = graphshortestpath(DG,1,8)
  5. set(h.Nodes(path),'Color',[1 0.4 0.4])
  6. edges = getedgesbynodeid(h,get(h.Nodes(path),'ID'));
  7. set(edges,'LineColor',[1 0 0])
  8. set(edges,'LineWidth', 1.5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement