Fixed Bugs in graph creation code.