/// <summary>
        /// Returns an inverted graph
        /// </summary>
        /// <returns></returns>
        private ConnectivityCheck GetInvertedGraph()
        {
            ConnectivityCheck g = new ConnectivityCheck(numberOfVertices);

            for (int v = 0; v < numberOfVertices; v++)
            {
                foreach (int i in adjacencyList[v])
                {
                    g.adjacencyList[i].Add(v);
                }
            }
            return(g);
        }
        /// <summary>
        /// Checks if graph is valid
        /// </summary>
        public static bool IsGraphValid(Digraph digraph)
        {
            if (digraph.Vertices.Count < 3)
            {
                return(false);
            }
            ConnectivityCheck check = new ConnectivityCheck(digraph.Vertices.Count);

            foreach (Arc arc in digraph.Arcs)
            {
                check.AddArc(arc);
            }
            return(check.IsStronglyConnected());
        }
        /// <summary>
        /// Connectivity check method (using Kosaraju algorithm)
        /// </summary>
        public bool IsStronglyConnected()
        {
            bool[] visited = new bool[numberOfVertices];
            // Fist DFS traversing
            DFS(0, visited);
            // Returning false there is a vertex that hasn't been visited
            if (visited.Contains(false))
            {
                return(false);
            }

            // Inverting the graph
            ConnectivityCheck gr = GetInvertedGraph();

            visited = new bool[numberOfVertices]; // Refreshing
            // DFS traversing for inverted graph
            gr.DFS(0, visited);
            // Returning false if there is a vertex that hasn't been visited
            return(Array.TrueForAll(visited, v => v));
        }