Graphing algorithm fixes