예제 #1
0
        public static void PrintTestDirectedGraphWithPointID()
        {
            DirectedGraphWithPointID tempGraph = new DirectedGraphWithPointID("g1", "x", new AbstractEdgeEqualityComparer <PointWithID>());
            PointWithID x1 = new PointWithID(1, "x");
            PointWithID x2 = new PointWithID(2, "x");
            PointWithID x3 = new PointWithID(3, "x");
            PointWithID x4 = new PointWithID(4, "x");
            PointWithID x5 = new PointWithID(5, "x");
            PointWithID x6 = new PointWithID(6, "x");

            tempGraph.AddPoint(x1);
            tempGraph.AddPoint(x2);
            tempGraph.AddPoint(x3);
            tempGraph.AddPoint(x4);
            //tempGraph.AddPoint(x5);
            //tempGraph.AddPoint(x6);

            tempGraph.AddEdge(new EdgePointID("a1", x1, x2));
            tempGraph.AddEdge(new EdgePointID("a2", x2, x3));
            tempGraph.AddEdge(new EdgePointID("a3", x2, x3));
            tempGraph.AddEdge(new EdgePointID("a4", x4, x3));
            tempGraph.AddEdge(new EdgePointID("a5", x4, x3));
            //tempGraph.AddEdge(new EdgePointID("a6", x3, x5));
            //tempGraph.AddEdge(new EdgePointID("a7", x5, x3));

            Console.WriteLine(notation.ConvertFromGrapch(tempGraph));
        }
예제 #2
0
        private DiscreteMaC_Lib.Graphes.Points.Point SetDefaultClosurePoint(DirectedGraphWithPointID CurrentGraph)
        {
            int varNum = 8;

            if (CurrentGraph.PointCollection.Count(i1 => i1.ID == varNum) > 0)
            {
                return(CurrentGraph.PointCollection.SingleOrDefault((i1 => i1.ID == varNum)));
            }
            else
            {
                return(CurrentGraph.PointCollection.Last());
            }
        }
예제 #3
0
 public OneSideItem(DirectedGraphWithPointID OriginalGraph, IEnumerable <DiscreteMaC_Lib.Graphes.Points.Point> PointCollection)
 {
     if (OriginalGraph == null)
     {
         throw new Exception("OriginalGraph is null");
     }
     else
     {
         this.OriginalGraph = OriginalGraph;
     }
     if (PointCollection == null)
     {
         throw new Exception("PointCollection is null");
     }
     else
     {
         this.PointCollection = PointCollection;
     }
 }
예제 #4
0
        public static void TestPrintIncludedSubGraphes()
        {
            while (!stop)
            {
                DirectedGraphWithPointID tempGraph = GraphUtils.GenerateRandomDirectedGraphWithPointID("g1", "x", 4, 3);



                Console.WriteLine(notation.ConvertFromGrapch(tempGraph));
                PrintTransitiveClosureForAllPoints(tempGraph);
                foreach (IEnumerable <Point> collP in GraphUtils.GetCollectionPointsOneSidedCompOfGraph(tempGraph))
                {
                    Console.WriteLine("Graph: {{{0}}}", String.Join(",", collP));
                    Console.WriteLine(notation.ConvertFromGrapch(GraphUtils.GetInducedSubgraph(tempGraph, collP)));
                }

                if (Console.ReadLine() == "stop")
                {
                    stop = true;
                }
            }
        }