Exemplo n.º 1
0
		static void Main(string[] args) {
			Graph graph = new Graph();

			// グラフ(隣接リスト)を標準入力から読み込む
			string adj_text = "";
			string line = Console.ReadLine();
			while(line.Length > 0) {	// while(line != null)から変更
				adj_text += line + "\n";
				line = Console.ReadLine();
			}
			graph.ParseAdjListText(adj_text); //隣接行列つくる

			// グラフの特徴をもつクラス
			//引数は(Graphクラス, グラフの始点, グラフの終点)
			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());
			System.Console.ReadLine();
		}
Exemplo n.º 2
0
		public State(Graph g, int start, int end) {
			s = start;
			t = end;
			graph = g;
			ComputeFrontier();
		}