Posts

Showing posts with the label Sort and Search

Graph extended - adjacency list representation

/*** Graph implement: 1. BFS 2. DFS 3. test is cyclic 4. topological sort http://www.geeksforgeeks.org/topological-sorting / http://www.cs.washington.edu/education/courses/cse373/02au/lectures/lecture19l.pdf 5. Find a path between two node in a graph --> if node v is reachable with node w http://www.geeksforgeeks.org/find-if-there-is-a-path-between-two-vertices-in-a-given-graph/ ***/ #include <iostream> #include <list> #include <queue> using namespace std; class graph {        int V;        list < int > *adj;        bool cyclicUtil( int , bool *, bool *);        void BFSUtil( bool *, queue < int > &);        void DFSUtil( int , bool *);        void update_degree( int , int *, queue < int > &);  ...