CSCI 2300 Lab 5, Fall 2012, 10/10/12

This lab is about graphs and algorithms. You are welcome to start working on the lab ahead of time.
  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. 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 atrting vertex.)
  3. In class (10/4/2012), I mentioned about the maximum 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 strongle components.) Your problem is to find the maximum number of edges with 2 strongly components for a directed graph with 6 vertices. (Optional problem to generalize with n vertices directed graph)