title: How to highlight the path between two nodes in CYTOSCAPE JS
body: <p>i can create a graph using <code>cytoscape js</code> library . i am following the <a href="http://jsbin.com/qohop/3/edit" rel="nofollow"> this </a> tutorial and i implement <a href="http://jsbin.com/kavipobi/1/edit" rel="nofollow"> like this. </a></p>
  
  <p>CODE: </p>
  
  <pre><code>$(function(){ // on dom ready
  
  $('#cy').cytoscape({
    style: cytoscape.stylesheet()
      .selector('node')
        .css({
          'content': 'data(id)'
        })
      .selector('edge')
        .css({
          'target-arrow-shape': 'triangle',
          'width': 4,
          'line-color': '#ddd',
          'target-arrow-color': '#ddd'
        })
      .selector('.highlighted')
        .css({
          'background-color': '#61bffc',
          'line-color': '#61bffc',
          'target-arrow-color': '#61bffc',
          'transition-property': 'background-color, line-color, target-arrow-color',
          'transition-duration': '0.5s'
        }),
  
    elements: {
        nodes: [
          { data: { id: 'a' } },
          { data: { id: 'b' } },
          { data: { id: 'c' } },
          { data: { id: 'd' } },
          { data: { id: 'e' } },
          { data: { id: 'f' } },
          { data: { id: 'g' } }
        ], 
  
        edges: [
          { data: { id: 'ab', weight: 1, source: 'a', target: 'b' } },
          { data: { id: 'ac', weight: 2, source: 'a', target: 'c' } },
          { data: { id: 'bd', weight: 3, source: 'b', target: 'd' } },
          { data: { id: 'be', weight: 4, source: 'b', target: 'e' } },
          { data: { id: 'cf', weight: 5, source: 'c', target: 'f' } },
          { data: { id: 'cg', weight: 6, source: 'c', target: 'g' } }       
        ]
      },
  
    layout: {
      name: 'breadthfirst',
      directed: true,
      roots: '#a',
      padding: 5
    },
  
    ready: function(){
      window.cy = this;
  
      var bfs = cy.elements().bfs('#a', function(){}, true);
  
      var i = 0;
      var highlightNextEle = function(){
        bfs.path[i].addClass('highlighted');
  
        if( i &lt; bfs.path.length ){
          i++;
          setTimeout(highlightNextEle, 1000);
        }
      };
  
      // kick off first highlight
      highlightNextEle();
    }
  });
  
  }); // on dom ready
  </code></pre>
  
  <p>on my implementation i need to highlight the path between the nodes d and g.</p>
  
  <p>How to find the path between the nodes and highlight them? </p>