add sorting to graph pipeline
removed unnecessary functions