create a graph data structure including topological sorting method.