title: dijkstra algorithm using Matlab
body: <p>I am doing dijkstra algorithm using Matlab . Here is my code </p>
  
  <pre><code>W = [10 8 5 3 7 2 4 6 21];
  DG = sparse([1 1 1 2 2 3 4 5 6],[2 4 3 4 5 6 6 6 1],W)
  
  h = view(biograph(DG,[],'ShowWeights','on'))
  
  [dist,path,pred] = graphshortestpath(DG,1,6)
  
  set(h.Nodes(path),'Color',[1 0.4 0.4])
  edges = getedgesbynodeid(h,get(h.Nodes(path),'ID'));
  set(edges,'LineColor',[1 0 0])
  set(edges,'LineWidth',1.5)
  </code></pre>
  
  <p>The problem is how do i get the red color lines nodes and edges of the shortest path "reset". for example I want it to be <code>[dist,path,pred] = graphshortestpath(DG,2,3)</code> but the graph still shows the </p>
  
  <pre><code>[dist,path,pred] = graphshortestpath(DG,1,6). 
  </code></pre>