本文整理汇总了C#中BlueSpider.Blob.Basic.Network.AdjList.BasicAdjList.RemoveEdge方法的典型用法代码示例。如果您正苦于以下问题:C# BasicAdjList.RemoveEdge方法的具体用法?C# BasicAdjList.RemoveEdge怎么用?C# BasicAdjList.RemoveEdge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlueSpider.Blob.Basic.Network.AdjList.BasicAdjList
的用法示例。
在下文中一共展示了BasicAdjList.RemoveEdge方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveEdge_Throws_When_Null_Passed_In
public void RemoveEdge_Throws_When_Null_Passed_In()
{
//Arrange
var net = new BasicAdjList(Guid.NewGuid());
//Act, Assert
var ex = Assert.Throws<ArgumentNullException>(() => net.RemoveEdge(null));
}
示例2: RemoveEdge_With_Self_Loop
public void RemoveEdge_With_Self_Loop()
{
//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.RemoveEdge(edge);
result = nodeA.SuccessorList.Contains(nodeA);
Assert.False(result);
result = nodeA.PredecessorList.Contains(nodeA);
Assert.False(result);
Assert.Equal(0, nodeA.SuccessorList.Count);
Assert.Equal(0, nodeA.PredecessorList.Count);
}
示例3: RemoveEdge_Throws_Ex_If_Edge_DNE_In_Network
public void RemoveEdge_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);
//Act, Assert
var ex = Assert.Throws<ArgumentException>(() => net.RemoveEdge(edge1));
}
示例4: RemoveEdge_Throws_When_Invalid_Type_Passed_In_For_Dest_Node
public void RemoveEdge_Throws_When_Invalid_Type_Passed_In_For_Dest_Node()
{
//Arrange
var net = new BasicAdjList(Guid.NewGuid());
//Act, Assert
var ex = Assert.Throws<ArgumentException>(() => net.RemoveEdge(new DummyBasicEdge()));
}
示例5: RemoveEdge_Does_Not_Affect_Node_Accessor_And_Predecessor_Lists
public void RemoveEdge_Does_Not_Affect_Node_Accessor_And_Predecessor_Lists()
{
//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.RemoveEdge(edge);
result = nodeA.SuccessorList.Contains(nodeB);
Assert.False(result);
result = nodeA.PredecessorList.Contains(nodeB);
Assert.False(result);
result = nodeB.PredecessorList.Contains(nodeA);
Assert.False(result);
result = nodeB.SuccessorList.Contains(nodeA);
Assert.False(result);
}
示例6: RemoveEdge
public void RemoveEdge()
{
//Arrange
var net = new BasicAdjList(Guid.NewGuid());
INode nodeA = net.CreateNode();
INode nodeB = net.CreateNode();
IEdge edge = net.CreateEdge(nodeA, nodeB);
Assert.Equal(1, net.EdgeCount);
Assert.Equal(1, net.Edges.Count);
net.RemoveEdge(edge);
Assert.Equal(0, net.EdgeCount);
Assert.Equal(0, net.Edges.Count);
}
示例7: RemoveEdges_Removes_Row_With_Matching_Key_In_EdgeData
public void RemoveEdges_Removes_Row_With_Matching_Key_In_EdgeData(int nodeCount, int edgeCount, int[] removalIndices)
{
Random rand = new Random();
var net = new BasicAdjList(Guid.NewGuid());
var table = new DataAttributeTable<IEdge>();
table.Network = net;
net.EdgeData = table;
for (int i = 0; i < nodeCount; i++)
net.CreateNode();
IList<IEdge> edges = new List<IEdge>();
for (int i = 0; i < edgeCount; i++)
{
edges.Add(
net.CreateEdge(net.Nodes[rand.Next(nodeCount)], net.Nodes[rand.Next(nodeCount)]));
}
IEdge edgeToRemove = null;
int ctr = 0;
var count = net.NodeCount;
for (int i = 0; i < removalIndices.Length; i++)
{
ctr++;
edgeToRemove = edges[removalIndices[i]];
net.RemoveEdge(edgeToRemove);
Assert.Equal((count - ctr), net.EdgeCount);
Assert.Equal((count - ctr), table.RowCount);
Assert.False(table.RowOwnerMap.ContainsKey(edgeToRemove));
}
}
示例8: ChangeEventsEnabled_When_False_Prevents_NetworkChanged_Fired_When_RemoveEdge_Is_Called
public void ChangeEventsEnabled_When_False_Prevents_NetworkChanged_Fired_When_RemoveEdge_Is_Called(int nodeCount, int edgeCount, int edgesToRemove)
{
//Arrange
var net = new BasicAdjList(Guid.NewGuid());
Random rand = new Random();
for (int i = 0; i < nodeCount; i++)
net.CreateNode();
INode nodeA = null;
INode nodeB = null;
IEdge[] edges = new IEdge[edgeCount];
for (int i = 0; i < edgeCount; i++)
{
nodeA = net.Nodes[rand.Next(nodeCount)];
nodeB = net.Nodes[rand.Next(nodeCount)];
edges[i] = net.CreateEdge(nodeA, nodeB);
}
//---------------------
var helper = new NetworkChangedEventsTestHelper();
net.NetworkChanged += new NetworkChangedEventHandler<INetwork, NetworkChangedEventArgs>(helper.NetworkChanged_DummyHandler);
net.ChangeEventsEnabled = false;
for (int i = 0; i < edges.Length; i++)
{
net.RemoveEdge(edges[i]);
}
Assert.Equal(0, helper.NetworkChanged_TimesCalled);
}
示例9: NetworkChanged_Args_Contains_Edge_After_RemoveEdge_Is_Called
public void NetworkChanged_Args_Contains_Edge_After_RemoveEdge_Is_Called()
{
//Arrange
var net = new BasicAdjList(Guid.NewGuid());
var helper = new NetworkChangedEventsTestHelper();
net.NetworkChanged += new NetworkChangedEventHandler<INetwork, NetworkChangedEventArgs>(helper.NetworkChanged_DummyHandler);
var nodeA = net.CreateNode();
var nodeB = net.CreateNode();
var nodeC = net.CreateNode();
var edgeA = net.CreateEdge(nodeA, nodeB);
var edgeB = net.CreateEdge(nodeA, nodeB);
helper.Reset();
net.RemoveEdge(edgeB);
var argItem = helper.LastArgumentRecieved.EdgeRemoved;
Assert.Same(argItem, edgeB);
}