rewrite putEdge method