![]() |
| ||
| Directed graph Hi everyone, I am a U.student from China, I would like ask a question about my assignment. For the directed graph, I would like to perform topological sort for sorting up nodes, but I encountered some problem in queue which is able to be removed or added with certain elements. My question is how I can perform queue in topological sort function? my algorithm is here // The topological sort my professor gave a hint to perform queue: In the implementation of the topological sort, a queue data structure is required. he said I can use the queue from the standard template library. Here are some short descriptions of the functions provided by the STL queue. empty : true if the queue has no elements front pop: returns a reference to the first push : element of a queue removes the first element of a queue adds an element to the end of the queue For example, include header <queue> and declare my queue as std::queue <int> Queue. And use push as Queue.push(int). I could find some information in http://www.sgi.com/tech/stl/queue.html. but I don't catch up the point. Thank you very much |
| All times are GMT -4. The time now is 5:07 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC