AdvancedAlgorithms.GraphTraversal.Main C# (CSharp) Method

Main() private static method

private static Main ( string args ) : void
args string
return void
        private static void Main(string[] args)
        {
            int numTestCases = int.Parse(Console.ReadLine());

            for (int caseNumber = 0; caseNumber < numTestCases; caseNumber++)
            {
                string line = Console.ReadLine();
                //read dimensions
                int n = int.Parse(line.Split(' ')[0]);  //size of graph
                int m = int.Parse(line.Split(' ')[1]); //number of edges

                //initialize the graph
                int[][] graph = new int[n][];
                for (int i = 0; i < n; i++)
                {
                    graph[i] = new int[n];

                }

                for (int edgeNumber = 0; edgeNumber < m; edgeNumber++)
                {
                    string edgeLine = Console.ReadLine();
                    int edgeStart = int.Parse(edgeLine.Split(' ')[0]);
                    int edgeEnd = int.Parse(edgeLine.Split(' ')[1]);

                    //add to graph
                    graph[edgeStart][edgeEnd] = HAS_EDGE;
                }

                //got the graph, now output it
                Console.WriteLine(caseNumber + 1);

                BreadthFirst(graph, n);
                Console.Write(Environment.NewLine);
                DepthFirst(graph, n);
                Console.Write(Environment.NewLine);
            }
        }