本文整理汇总了C#中Sequence.MakeSequence方法的典型用法代码示例。如果您正苦于以下问题:C# Sequence.MakeSequence方法的具体用法?C# Sequence.MakeSequence怎么用?C# Sequence.MakeSequence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sequence
的用法示例。
在下文中一共展示了Sequence.MakeSequence方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
UndirectedGraph<int> lGraph = new UndirectedGraph<int>();
lGraph.AddVertex(1);
lGraph.AddVertex(2);
lGraph.AddVertex(3);
lGraph.AddVertex(4);
lGraph.AddVertex(5);
lGraph.AddVertex(6);
lGraph.AddVertex(7);
lGraph.AddVertex(8);
lGraph.Connect(lGraph[1], lGraph[2]);
lGraph.Connect(lGraph[2], lGraph[3]);
lGraph.Connect(lGraph[7], lGraph[3]);
lGraph.Connect(lGraph[5], lGraph[7]);
lGraph.Connect(lGraph[2], lGraph[6]);
lGraph.Connect(lGraph[5], lGraph[4]);
lGraph.Connect(lGraph[4], lGraph[3]);
lGraph.Connect(lGraph[7], lGraph[8]);
lGraph.Connect(lGraph[7], lGraph[1]);
foreach (var lVertex in lGraph.GetVertices())
{
Console.WriteLine("Stupeň uzlu {0} = {1}",lVertex.Value, lGraph.GetVertexDegree(lVertex));
}
ISequence<int> lSeq = new Sequence<int>();
lSeq.MakeSequence(new Edge<int>(8, 2), new Edge<int>(2, 5), new Edge<int>(5, 1), new Edge<int>(1, 3));
//Console.WriteLine("Is Closed Sequence: " + lSeq.IsClosedSquence());
Console.WriteLine("Is Graph Sequence: " + lSeq.IsGraphSequence(lGraph));
Console.WriteLine("Is Move: " + lSeq.IsMove());
Console.WriteLine("Is Path: " + lSeq.IsPath());
foreach (var lVertex in lGraph.GetVertices())
{
var lSousedi = lGraph.GetVertices(lVertex);
Console.Write("Sousedé uzlu {0} = ", lVertex.Value);
foreach (var nVertex in lSousedi)
{
Console.Write("{0}, ", nVertex.Value);
}
Console.WriteLine("");
}
var lGr = new UndirectedGraph<int>();
lGr.AddVertex(18);
lGr.AddVertex(20);
lGr.AddVertex(13);
lGr.AddVertex(11);
lGr.AddVertex(20);
lGr.Connect(lGr[13], lGr[11]);
lGr.Connect(lGr[20], lGr[11]);
lGr.Connect(lGr[13], lGr[18]);
lGr.Connect(lGr[18], lGr[13]);
lGr.Connect(lGr[11], lGr[18]);
lGr.Connect(lGr[20], lGr[13]);
lGraph.Join(lGr, new Edge<int>(1, 11));
foreach (var lVertex in lGraph.GetVertices())
{
var lSousedi = lGraph.GetVertices(lVertex);
Console.Write("Sousedé uzlu {0} = ", lVertex.Value);
foreach (var nVertex in lSousedi)
{
Console.Write("{0}, ", nVertex.Value);
}
Console.WriteLine("");
}
var lGraf = new UndirectedValuedGraph<int>();
lGraf.AddVertex(1);
lGraf.AddVertex(2);
lGraf.AddVertex(3);
lGraf.AddVertex(4);
lGraf.AddVertex(5);
lGraf.AddVertex(6);
lGraf.Connect(lGraf[1], lGraf[2], 2);
lGraf.Connect(lGraf[1], lGraf[3], 2);
lGraf.Connect(lGraf[1], lGraf[4], 1);
lGraf.Connect(lGraf[1], lGraf[5], 2);
lGraf.Connect(lGraf[1], lGraf[6], 3);
lGraf.Connect(lGraf[2], lGraf[3], 3);
lGraf.Connect(lGraf[2], lGraf[4], 4);
lGraf.Connect(lGraf[2], lGraf[5], 1);
lGraf.Connect(lGraf[2], lGraf[6], 3);
lGraf.Connect(lGraf[3], lGraf[4], 1);
lGraf.Connect(lGraf[3], lGraf[5], 2);
lGraf.Connect(lGraf[3], lGraf[6], 1);
lGraf.Connect(lGraf[4], lGraf[5], 2);
lGraf.Connect(lGraf[4], lGraf[6], 3);
lGraf.Connect(lGraf[5], lGraf[6], 3);
var lVys = lGraf.GetSpanningTree();
var lSeznam = lVys.WideSearch(lGraf[6]);
Console.ReadKey();
}