src/app/script.js
/**
   * Clears the current weights, and initializes the algorithm.
   * @param {String} source vertex to start from.
   * @param {String} target vertex to find.
   */
Clears the current weights, and initializes the algorithm.
@param {String} source vertex to start from.
@param {String} target vertex to find.
Clears the current weights and initializes the algorithm . @param { String } source vertex to start from . @param { String } target vertex to find .
initDijkstra(source, target) {
    const vKey = Object.keys(this.verticies);
    let vert1;
    let vert2;
    for (let i = 0; i < vKey.length; i += 1) {
      const eKey = Object.keys(this.verticies[vKey[i]].edges);
      vert1 = this.verticies[vKey[i]];
      if (vert1.children.length > 2) {
        vert1.removeChildAt(2);
      }
      for (let j = 0; j < eKey.length; j += 1) {
        vert2 = this.verticies[eKey[j]];
        vert1.edges[eKey[j]].line.colour = 0xd63031;
        drawLine(vert1.edges[eKey[j]].line, vert1.x, vert1.y, vert2.x, vert2.y, vert1.edges[eKey[j]].line.colour);
      }
    }
    this.dijkstra(source, target);
  }
initDijkstra ( source , target ) { const vKey = Object . keys ( this . verticies ) ; let vert1 ; let vert2 ; for ( let i = 0 ; i < vKey . length ; i += 1 ) { const eKey = Object . keys ( this . verticies [ vKey [ i ] ] . edges ) ; vert1 = this . verticies [ vKey [ i ] ] ; if ( vert1 . children . length > 2 ) { vert1 . removeChildAt ( 2 ) ; } for ( let j = 0 ; j < eKey . length ; j += 1 ) { vert2 = this . verticies [ eKey [ j ] ] ; vert1 . edges [ eKey [ j ] ] . line . colour = 0xd63031 ; drawLine ( vert1 . edges [ eKey [ j ] ] . line , vert1 . x , vert1 . y , vert2 . x , vert2 . y , vert1 . edges [ eKey [ j ] ] . line . colour ) ; } } this . dijkstra ( source , target ) ; }
Clears the current weights, and initializes the algorithm.
Clears the current weights and initializes the algorithm .