HyperGraph
Changes
HyperGraph/Program.cs 29(+25 -4)
Details
HyperGraph/Program.cs 29(+25 -4)
diff --git a/HyperGraph/Program.cs b/HyperGraph/Program.cs
index b62f312..99baa20 100644
--- a/HyperGraph/Program.cs
+++ b/HyperGraph/Program.cs
@@ -98,22 +98,43 @@ namespace HyperGraph
var result = Theorem.TheoremAutomorphism(graph);
// Выполняется ли условие согласно теореме 2
Console.WriteLine("Is Thereom 2: " + result.isSatisfyTheorem);
- // Вывод числа автоморфизмов в консоль
- Console.WriteLine("Count of automorphism: " + result.CountAutomorphism);
-
+ if (result.isSatisfyTheorem)
+ {
+ // Вывод числа автоморфизмов в консоль
+ Console.WriteLine("Count of automorphism: " + result.CountAutomorphism);
+ }
// Выполняется ли условие согласно теореме 2
output.WriteLine("Is Thereom 2: " + result.isSatisfyTheorem);
// Если да, то вывести
if (result.isSatisfyTheorem)
{
// Вывод вершин и числа автоморфизмов в файл
- output.Write("Automorphism with nodes: ");
+ output.WriteLine("Automorphism with nodes: ");
foreach (var node in result.AutomorphismNodes)
output.Write(node + " ");
+ output.WriteLine();
+ // Вывод всех перестановок общих вершин
+ List<List<string>> transpos = Combinatorics<string>.Transposition(result.AutomorphismNodes);
+ // Вывод начальной перестановки
+ output.Write("1:");
+ for (int g = 0; g < result.AutomorphismNodes.Count; g++)
+ output.Write(" {0}", result.AutomorphismNodes[g]);
+ output.WriteLine("\n\t-----------");
+ // Алгоритм перестановок не учитывает начальную, а начинает со следующей
+ for (int g = 0; g < transpos.Count; g++)
+ {
+ output.Write("{0}: ", g + 2);
+ for (int f = 0; f < transpos[g].Count; f++)
+ output.Write("{0} ", transpos[g][f]);
+ output.WriteLine("\n\t-----------");
+ }
+
output.WriteLine("\nCount of automorphism: " + result.CountAutomorphism + "\n");
// Вывести перестановки в файл
ExampleAllTranspos(result.GraphWithoutAutoEdges, output);
+ output.Write("Automorphism with nodes: ");
+
}
// Уничтожить временный граф
result.GraphWithoutAutoEdges.Dispose();