code: function addEdge(u, v, weight){
      addNode(u);
      addNode(v);
      adjacent(u).push(v);
  
      if (weight !== undefined) {
        setEdgeWeight(u, v, weight);
      }
  
      return graph;
    }
docs: Adds an edge from node u to node v. Implicitly adds the nodes if they were not already added.