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


C# Graph.AddEdges方法代码示例

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


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

示例1: AddVertices_AddParentTwice_OnlyOneNode

 public void AddVertices_AddParentTwice_OnlyOneNode()
 {
     IGraph<string> graph = new Graph<string>();
     // Act
     graph.AddEdges("Parent", new List<string>());
     graph.AddEdges("Parent", new List<string>());
     // Assert
     Assert.AreEqual(1, graph.Vertices.Count());
     Assert.AreEqual("Parent", graph.Vertices.First());
     Assert.AreEqual(0, graph.Edges.Count());
 }
开发者ID:JasonCozens,项目名称:CodeStructure,代码行数:11,代码来源:GraphTests.cs

示例2: AddVertices_AddChildTwice_OnlyOneNode

 public void AddVertices_AddChildTwice_OnlyOneNode()
 {
     IGraph<string> graph = new Graph<string>();
     // Act
     graph.AddEdges("ParentX", new List<string>() { "Child" });
     graph.AddEdges("ParentY", new List<string>() { "Child" });
     // Assert
     Assert.AreEqual(3, graph.Vertices.Count());
     Assert.AreEqual(2, graph.Edges.Count());
     Assert.IsTrue(graph.Vertices.Contains("ParentX"));
     Assert.IsTrue(graph.Vertices.Contains("ParentY"));
     Assert.IsTrue(graph.Vertices.Contains("Child"));
 }
开发者ID:JasonCozens,项目名称:CodeStructure,代码行数:13,代码来源:GraphTests.cs

示例3: AddVertices_NoChildren_ParentIsAddedAsNode

 public void AddVertices_NoChildren_ParentIsAddedAsNode()
 {
     IGraph<string> graph = new Graph<string>();
     // Act
     graph.AddEdges("Parent", new List<string>());
     // Assert
     Assert.AreEqual(1, graph.Vertices.Count());
     Assert.AreEqual("Parent", graph.Vertices.First());
     Assert.AreEqual(0, graph.Edges.Count());
 }
开发者ID:JasonCozens,项目名称:CodeStructure,代码行数:10,代码来源:GraphTests.cs

示例4: AddVertices_OneChild_NodesAndVerticesAreCorrect

 public void AddVertices_OneChild_NodesAndVerticesAreCorrect()
 {
     IGraph<string> graph = new Graph<string>();
     // Act
     graph.AddEdges("Parent", new List<string>() { "Child" } );
     // Assert
     Assert.AreEqual(2, graph.Vertices.Count());
     Assert.IsTrue(graph.Vertices.Contains("Parent"));
     Assert.IsTrue(graph.Vertices.Contains("Child"));
     var vertex = graph.Edges.First();
     Assert.AreEqual(1, graph.Edges.Count());
     Assert.AreEqual("Parent", vertex.Parent);
     Assert.AreEqual("Child", vertex.Child);
 }
开发者ID:JasonCozens,项目名称:CodeStructure,代码行数:14,代码来源:GraphTests.cs


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