added piecewise support to graph