本文整理汇总了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);
}
示例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));
}
示例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()));
}
示例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));
}
示例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);
}
示例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);
}