Exemple #1
0
        public static bool DotIsRegular(Dot dot, Edge edge, Function function)
        {
            Sheaf      sheaf = new Sheaf(dot, function);
            List <Dot> coveredBySheafDots = new List <Dot>();

            foreach (Edge currentEdge in sheaf.Edges)
            {
                if (!ExtraData.EdgesAreEqual(edge, currentEdge))
                {
                    foreach (Dot currentDot in currentEdge.DotList)
                    {
                        if (!ExtraData.ListContainsDot(currentDot, edge.DotList))
                        {
                            coveredBySheafDots.Add(currentDot);
                        }
                    }
                }
            }
            foreach (Dot currentDot in coveredBySheafDots)
            {
                Sheaf currentSheaf = new Sheaf(currentDot, function);
                if (ExtraData.SheafIsSubsheaf(sheaf, currentSheaf))
                {
                    return(true);
                }
            }
            return(false);
        }
Exemple #2
0
        public static bool DotIsNuclear(Function function, Dot dot)
        {
            if (!dot.Value)
            {
                Console.WriteLine("Вы реально балбес-_-");
                return(false);
            }
            List <Edge> edges = new Sheaf(dot, function).Edges;

            return(edges.Count == 1);
        }
Exemple #3
0
 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);
 }