Esempio n. 1
0
 public State(Graph g, int start, int end)
 {
     s = start;
     t = end;
     graph = g;
     ComputeFrontier();
 }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Graph graph = new Graph();

            // グラフ(隣接リスト)を標準入力から読み込む
            string adj_text = "";
            string line = Console.ReadLine();
            while (line != null)
            {
                adj_text += line + "\r\n";
                line = Console.ReadLine();
            }
            graph.ParseAdjListText(adj_text);

            State state = new State(graph, 1, graph.GetNumberOfVertices());

            // 入力グラフの頂点の数と辺の数を出力
            Console.Error.WriteLine("# of vertices = " + graph.GetNumberOfVertices()
                + ", # of edges = " + graph.GetEdgeList().Count);

            ZDD zdd = FrontierAlgorithm.Construct(state); // フロンティア法によるZDD構築

            // 作成されたZDDのノード数と解の数を出力
            Console.Error.WriteLine("# of nodes of ZDD = " + zdd.GetNumberOfNodes());
            Console.Error.WriteLine("# of solutions = " + zdd.GetNumberOfSolutions());

            // ZDDを標準出力に出力
            Console.Write(zdd.GetZDDString());
        }