CSCI 2300 Lab 5, Spring 2015, 03/11/2014

This lab is about graphs and algorithms. You are encouraged to start working on the lab ahead of time. It may be time consuming. Please read chapter 3 (DG) and understand the material.
  1. Using a DFS procedure to the Graph Class (Sample) and Sample Data (input) for unweighted graph. test whether a given graph is a tree or not. You can assume that the given graph is connected. DFS on Undirected Graph Code - Please read the code and understand and adapt it for this problem.
  2. Using a DFS procedure, for the given input directed graph find the topological sorted numbers. (You can still use Graph.cc (Graph Class) and your dfs procedure.) You may assume that there is exactly one source vertex (that is one vertex with in-degree 0 and that will be ths starting vertex.) input graph for topological sort
  3. Next two questions in this sub-part involve strongly connected components. A directed graph is Strongly - Connected if there is a path between every pair of vertices. If a directed graph is not strongly connected, it can be broken into strongly connected components (similar to connected components in an undirected graph). In a strongly connected component, there is path between every pair of vertices. Maximum number of edges in a strongly connected directed graph (also known as digraph) with n vertices is n*(n-1) (A complete directed graph). Minimum number of edges in a strongly connected digraph with n vertices will n (corresponds to a cycle).
    1. The mafximum number of edges in a digraph(directed graph) with n different strongly connected components is n(n-1)/2. (Draw a complete undirected graph with n nodes labelled {1,2,3,...,n} and draw a directed edge from node i to node j if j is > i . Such a directed graph is acyclic and has n strong components.) Your problem is to find the maximum number of edges with 2 and 3 strongly components for a directed graph with 8 vertices. (Optional problem to generalize with n vertices directed graph)
    2. Here is a strongly connected component finding program (The algorithm described in DG is the algorithm that is implemented in the link - called Kosaraju's algorithm) in C++ . Using this program find strongly connected components of the problem in 3.4 (i) and 3.4 (ii)