示例#1
0
 public static bool InEdgeSet <TVertex, TEdge>(
     IEdgeListGraph <TVertex, TEdge> graph,
     TEdge edge)
     where TEdge : IEdge <TVertex>
 {
     return(InVertexSet(graph, edge) && graph.ContainsEdge(edge));
 }
示例#2
0
        public static bool InEdgeSet <TVertex, TEdge>(
            this IEdgeListGraph <TVertex, TEdge> g,
            TEdge e)
            where TEdge : IEdge <TVertex>
        {
            Contract.Requires(g != null);
            Contract.Requires(e != null);

            return(InVertexSet(g, e) &&
                   g.ContainsEdge(e));
        }
        private static void AssertGraphsEqual(
            [NotNull] IEdgeListGraph <int, EquatableEdge <int> > expected,
            [NotNull] IEdgeListGraph <int, EquatableEdge <int> > graph)
        {
            // Check equal
            expected.AssertVertexCountEqual(graph);
            expected.AssertEdgeCountEqual(graph);

            foreach (int vertex in expected.Vertices)
            {
                Assert.IsTrue(graph.ContainsVertex(vertex));
            }
            foreach (Edge <int> edge in graph.Edges)
            {
                Assert.IsTrue(graph.ContainsEdge(new EquatableEdge <int>(edge.Source, edge.Target)));
            }
        }