/// <summary>
        /// Adds temporary edges to the graph to make all vertex even.
        /// </summary>
        /// <param name="edgeFactory">Edge factory method.</param>
        /// <returns>Temporary edges list.</returns>

        public TEdge[] AddTemporaryEdges(EdgeFactory <TVertex, TEdge> edgeFactory)
        {
            if (edgeFactory is null)
            {
                throw new ArgumentNullException(nameof(edgeFactory));
            }

            // First gather odd edges
            List <TVertex> oddVertices = VisitedGraph.OddVertices().ToList();

            // Check that there are an even number of them
            if (oddVertices.Count % 2 != 0)
            {
                throw new InvalidOperationException("Number of odd vertices in not even.");
            }

            // Add temporary edges to create even edges
            _temporaryEdges = new List <TEdge>();

            while (oddVertices.Count > 0)
            {
                TVertex u = oddVertices[0];
                // Find adjacent odd vertex
                bool found = FindAdjacentOddVertex(u, oddVertices, edgeFactory, out bool foundAdjacent);
                if (!foundAdjacent)
                {
                    // Pick another vertex
                    if (oddVertices.Count < 2)
                    {
                        throw new InvalidOperationException("Eulerian trail failure.");
                    }
                    TVertex v = oddVertices[1];

                    // Add to temporary edges
                    AddTemporaryEdge(u, v, oddVertices, edgeFactory);

                    // Set u to null
                    found = true;
                }

                if (!found)
                {
                    oddVertices.Remove(u);
                    oddVertices.Add(u);
                }
            }

            return(_temporaryEdges.ToArray());
        }