public static bool DotIsRegular(Dot dot, Edge edge, Function function) { Sheaf sheaf = new Sheaf(dot, function.Values); List <Dot> coveredBySheafDots = new List <Dot>(); foreach (Edge currentEdge in sheaf.Edges) { if (!ExtraData.EdgesAreEqual(edge, currentEdge)) { foreach (Dot currentDot in currentEdge.DotList) { coveredBySheafDots.Add(currentDot); } } } foreach (Dot currentDot in coveredBySheafDots) { Sheaf currentSheaf = new Sheaf(currentDot, function.Values); if (ExtraData.SheafIsSubsheaf(sheaf, currentSheaf)) { return(true); } } return(false); }
public static bool DotIsNuclear(Dot[,] dots, Dot dot) { if (!dot.Value) { Console.WriteLine("Вы реально балбес-_-"); return(false); } List <Edge> edges = Sheaf.GetSheaf(dots, dot); return(edges.Count == 1); }
public string GetNukeConsoleOutputString() { StringBuilder str = new StringBuilder(); str.Append(string.Format("Ядро функции {0}:\n", ToString())); foreach (Dot dot in NuclearDotsList) { str.Append(string.Format("\tГрань {0}, ядровая точка - {1}\n", Sheaf.GetSheaf(Values, dot)[0].GetCommonDotsString(), dot)); } return(str.ToString()); }
public List <Edge> GetNuke() { List <Edge> result = new List <Edge>(); foreach (Dot dot in NuclearDotsList) { if (!ExtraData.ListContainsEdge(Sheaf.GetSheaf(Values, dot)[0], result)) { result.Add(Sheaf.GetSheaf(Values, dot)[0]); } } return(result); }
public static List <Edge> GetMaxEdges(Dot[,] functionValues) { List <Edge> result = new List <Edge>(); foreach (Dot dot in functionValues) { if (dot.Value) { AddEdges(Sheaf.GetSheaf(functionValues, dot), result); } } return(result); }
public static bool SheafIsSubsheaf(Sheaf motherSheaf, Sheaf subsheaf) { if (subsheaf.CoveredDotsList.Count > motherSheaf.CoveredDotsList.Count) { return(false); } foreach (Dot currentDot in subsheaf.CoveredDotsList) { bool covered = false; foreach (Edge currentEdge in motherSheaf.Edges) { if (ListContainsDot(currentDot, currentEdge.DotList)) { covered = true; break; } } if (!covered) { return(false); } } return(true); }