HyperGraph
Details
HyperGraph/Program.cs 24(+16 -8)
diff --git a/HyperGraph/Program.cs b/HyperGraph/Program.cs
index 93a2467..b62f312 100644
--- a/HyperGraph/Program.cs
+++ b/HyperGraph/Program.cs
@@ -96,17 +96,25 @@ namespace HyperGraph
{
// Получить результат вычислений
var result = Theorem.TheoremAutomorphism(graph);
+ // Выполняется ли условие согласно теореме 2
+ Console.WriteLine("Is Thereom 2: " + result.isSatisfyTheorem);
// Вывод числа автоморфизмов в консоль
Console.WriteLine("Count of automorphism: " + result.CountAutomorphism);
- // Вывод вершин и числа автоморфизмов в файл
- output.Write("Automorphism with nodes: ");
- foreach (var node in result.AutomorphismNodes)
- output.Write(node + " ");
- output.WriteLine("\nCount of automorphism: " + result.CountAutomorphism + "\n");
-
- // Вывести перестановки в файл
- ExampleAllTranspos(result.GraphWithoutAutoEdges, output);
+ // Выполняется ли условие согласно теореме 2
+ output.WriteLine("Is Thereom 2: " + result.isSatisfyTheorem);
+ // Если да, то вывести
+ if (result.isSatisfyTheorem)
+ {
+ // Вывод вершин и числа автоморфизмов в файл
+ output.Write("Automorphism with nodes: ");
+ foreach (var node in result.AutomorphismNodes)
+ output.Write(node + " ");
+ output.WriteLine("\nCount of automorphism: " + result.CountAutomorphism + "\n");
+
+ // Вывести перестановки в файл
+ ExampleAllTranspos(result.GraphWithoutAutoEdges, output);
+ }
// Уничтожить временный граф
result.GraphWithoutAutoEdges.Dispose();
}
HyperGraph/Theorem.cs 8(+6 -2)
diff --git a/HyperGraph/Theorem.cs b/HyperGraph/Theorem.cs
index af311a6..313ca92 100644
--- a/HyperGraph/Theorem.cs
+++ b/HyperGraph/Theorem.cs
@@ -11,6 +11,8 @@ namespace HyperGraph
// Структура для результурующих данных
public struct TheoremAuto
{
+ // Удовлетворяет ли гиперграф теореме
+ public bool isSatisfyTheorem;
// Число автоморфизмов
public Int64 CountAutomorphism;
// Список общих вершин
@@ -51,13 +53,15 @@ namespace HyperGraph
count *= Factorial(edge.Count); // *(n - k)!, где n = количество вершин в исходном гипер-ребер,
// а (n-k) = количество вершин в новом гипер-графе без общих вершин
- // Вовращаемое значение в виде структуры
- return new TheoremAuto
+ TheoremAuto result = new TheoremAuto
{
+ isSatisfyTheorem = (count > 0) ? true : false,
CountAutomorphism = count,
AutomorphismNodes = intersect,
GraphWithoutAutoEdges = graph
};
+ // Вовращаемое значение в виде структуры
+ return result;
}