当前位置: 首页>>代码示例>>C#>>正文


C# BasicAdjList.ReverseEdge方法代码示例

本文整理汇总了C#中BlueSpider.Blob.Basic.Network.AdjList.BasicAdjList.ReverseEdge方法的典型用法代码示例。如果您正苦于以下问题:C# BasicAdjList.ReverseEdge方法的具体用法?C# BasicAdjList.ReverseEdge怎么用?C# BasicAdjList.ReverseEdge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BlueSpider.Blob.Basic.Network.AdjList.BasicAdjList的用法示例。


在下文中一共展示了BasicAdjList.ReverseEdge方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReverseEdge_WithSelfLoop

        public void ReverseEdge_WithSelfLoop()
        {
            //Arrange
            var net = new BasicAdjList(Guid.NewGuid());
            Type expectedType = typeof(BasicEdge);
            INode nodeA = net.CreateNode();
            IEdge edge = net.CreateEdge(nodeA, nodeA);

            bool result = nodeA.SuccessorList.Contains(nodeA);
            Assert.True(result);
            result = nodeA.PredecessorList.Contains(nodeA);
            Assert.True(result);

            Assert.Equal(1, nodeA.SuccessorList.Count);
            Assert.Equal(1, nodeA.PredecessorList.Count);

            net.ReverseEdge(edge);

            result = nodeA.SuccessorList.Contains(nodeA);
            Assert.True(result);
            result = nodeA.PredecessorList.Contains(nodeA);
            Assert.True(result);

            Assert.Equal(1, nodeA.SuccessorList.Count);
            Assert.Equal(1, nodeA.PredecessorList.Count);
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:26,代码来源:BasicAdjListFixture.cs

示例2: ReverseEdge_Throws_When_Null_Passed_In

 public void ReverseEdge_Throws_When_Null_Passed_In()
 {
     //Arrange
     var net = new BasicAdjList(Guid.NewGuid());
     var ex = Assert.Throws<ArgumentNullException>(() => net.ReverseEdge(null));
 }
开发者ID:BgRva,项目名称:Blob1,代码行数:6,代码来源:BasicAdjListFixture.cs

示例3: ReverseEdge_Throws_When_Invalid_Type_Passed_In_For_Dest_Node

 public void ReverseEdge_Throws_When_Invalid_Type_Passed_In_For_Dest_Node()
 {
     //Arrange
     var net = new BasicAdjList(Guid.NewGuid());
     var ex = Assert.Throws<ArgumentException>(() => net.ReverseEdge(new DummyBasicEdge()));
 }
开发者ID:BgRva,项目名称:Blob1,代码行数:6,代码来源:BasicAdjListFixture.cs

示例4: ReverseEdge_Throws_Ex_If_Edge_DNE_In_Network

        public void ReverseEdge_Throws_Ex_If_Edge_DNE_In_Network()
        {
            //Arrange
            var net = new BasicAdjList(Guid.NewGuid());
            INode nodeA = net.CreateNode();
            INode nodeB = net.CreateNode();
            IEdge edge0 = net.CreateEdge(nodeA, nodeB);

            var net2 = new BasicAdjList(Guid.NewGuid());
            INode node0 = net2.CreateNode();
            INode node1 = net2.CreateNode();
            IEdge edge1 = net2.CreateEdge(node0, node1);

            var ex = Assert.Throws<ArgumentException>(() => net.ReverseEdge(edge1));
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:15,代码来源:BasicAdjListFixture.cs

示例5: ReverseEdge_DoesNotAffectNodeAccessorAndPredecessorLists

        public void ReverseEdge_DoesNotAffectNodeAccessorAndPredecessorLists()
        {
            //Arrange
            var net = new BasicAdjList(Guid.NewGuid());
            Type expectedType = typeof(BasicEdge);
            INode nodeA = net.CreateNode();
            INode nodeB = net.CreateNode();
            IEdge edge = net.CreateEdge(nodeA, nodeB);

            bool result = nodeA.SuccessorList.Contains(nodeB);
            Assert.True(result);
            result = nodeA.PredecessorList.Contains(nodeB);
            Assert.False(result);

            result = nodeB.PredecessorList.Contains(nodeA);
            Assert.True(result);
            result = nodeB.SuccessorList.Contains(nodeA);
            Assert.False(result);

            net.ReverseEdge(edge);

            result = nodeA.SuccessorList.Contains(nodeB);
            Assert.False(result);
            result = nodeA.PredecessorList.Contains(nodeB);
            Assert.True(result);

            result = nodeB.PredecessorList.Contains(nodeA);
            Assert.False(result);
            result = nodeB.SuccessorList.Contains(nodeA);
            Assert.True(result);
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:31,代码来源:BasicAdjListFixture.cs

示例6: ReverseEdge

        public void ReverseEdge()
        {
            //Arrange
            var net = new BasicAdjList(Guid.NewGuid());
            Type expectedType = typeof(BasicEdge);
            INode nodeA = net.CreateNode();
            INode nodeB = net.CreateNode();
            IEdge edge = net.CreateEdge(nodeA, nodeB);

            Assert.Same(nodeA, edge.SourceNode);
            Assert.Same(nodeB, edge.DestinationNode);

            net.ReverseEdge(edge);

            Assert.NotNull(edge.SourceNode);
            Assert.NotNull(edge.DestinationNode);

            Assert.Same(nodeB, edge.SourceNode);
            Assert.Same(nodeA, edge.DestinationNode);
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:20,代码来源:BasicAdjListFixture.cs


注:本文中的BlueSpider.Blob.Basic.Network.AdjList.BasicAdjList.ReverseEdge方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。