internal void Graph_OutEdgesShouldHaveSameTail(GraphDefinitionParameter p)
        {
            // Arrange
            Graph.Builder builder = new(p.VertexCount, p.Edges.Count);
            foreach (Endpoints endpoints in p.Edges)
            {
                builder.Add(endpoints.Tail, endpoints.Head);
            }

            Graph graph = builder.ToGraph();

            // Act
            for (int vertex = 0; vertex < graph.VertexCount; ++vertex)
            {
                EdgeEnumerator outEdges = graph.EnumerateOutEdges(vertex);
                while (outEdges.MoveNext())
                {
                    int  edge    = outEdges.Current;
                    bool hasTail = graph.TryGetTail(edge, out int tail);
                    if (!hasTail)
                    {
                        Assert.True(hasTail);
                    }

                    // Assert
                    Assert.Equal(vertex, tail);
                }
            }
        }
        internal void Graph_ShouldContainSameSetOfEdges(GraphDefinitionParameter p)
        {
            // Arrange
            Graph.Builder builder = new(p.VertexCount, p.Edges.Count);
            foreach (Endpoints endpoints in p.Edges)
            {
                builder.Add(endpoints.Tail, endpoints.Head);
            }

            Graph graph = builder.ToGraph();
            HashSet <Endpoints> expectedEdgeSet = p.Edges.ToHashSet();

            foreach (Endpoints edge in p.Edges)
            {
                if (edge.Tail == edge.Head)
                {
                    continue;
                }
                Endpoints invertedEdge = new(edge.Head, edge.Tail);
                expectedEdgeSet.Add(invertedEdge);
            }

            // Act
            HashSet <Endpoints> actualEdgeSet = new();

            for (int vertex = 0; vertex < graph.VertexCount; ++vertex)
            {
                EdgeEnumerator outEdges = graph.EnumerateOutEdges(vertex);
                while (outEdges.MoveNext())
                {
                    int  edge         = outEdges.Current;
                    bool hasEndpoints = TryGetEndpoints(graph, edge, out Endpoints endpoints);
                    if (!hasEndpoints)
                    {
                        Assert.True(hasEndpoints);
                    }

                    actualEdgeSet.Add(endpoints);
                }
            }

            // Assert
            Assert.Equal(expectedEdgeSet, actualEdgeSet, HashSetEqualityComparer);
        }