Algorithm, C++, Tutorials Untitled-1

C++ Detect cycles in a Graph with indegrees

Posted on May 22nd, 2013 by

Some algorithms only work in graphs without cycles, that’s why we need an algorithm to detect if a graph has a loop. We introduce following graph: The detect cycle class #ifndef __lus__ #define __lus__ #include “graaf.h” #include <vector> #include <queue> namespace lu{ template <GraafType TYPE> class lus { public: lus(Graaf<TYPE>&); bool is_lus_ingraden(); private: Graaf<TYPE> * [...]

Read more

Algorithm, C++, Tutorials Untitled-1

C++ Calculate Diameter of a Graph

Posted on May 22nd, 2013 by

The diameter d of a graph is the maximum eccentricity of any vertex in the graph. That is, d it is the greatest distance between any pair of vertices or. To find the diameter of a graph, first find the shortest path between each pair of vertices. The greatest length of any of these paths [...]

Read more