summaryrefslogtreecommitdiff
path: root/rst_parser/random_tree.cc
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2012-08-07 21:26:55 -0400
committerChris Dyer <cdyer@cs.cmu.edu>2012-08-07 21:26:55 -0400
commit2a4fd2dac126cb5753ae32b6ea3ba1255551a810 (patch)
tree0f8e921cc147005598782b760f02376618f0a14f /rst_parser/random_tree.cc
parent9b96ffa040f6c05c4e597a34c316743425839fe0 (diff)
random tree code
Diffstat (limited to 'rst_parser/random_tree.cc')
-rw-r--r--rst_parser/random_tree.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/rst_parser/random_tree.cc b/rst_parser/random_tree.cc
new file mode 100644
index 00000000..23e6e7f7
--- /dev/null
+++ b/rst_parser/random_tree.cc
@@ -0,0 +1,36 @@
+#include "arc_factored.h"
+
+#include <vector>
+#include <iostream>
+#include <boost/program_options.hpp>
+#include <boost/program_options/variables_map.hpp>
+
+#include "timing_stats.h"
+#include "arc_ff.h"
+#include "dep_training.h"
+#include "stringlib.h"
+#include "filelib.h"
+#include "tdict.h"
+#include "weights.h"
+#include "rst.h"
+#include "global_ff.h"
+
+using namespace std;
+namespace po = boost::program_options;
+
+int main(int argc, char** argv) {
+ if (argc != 2) {
+ cerr << argv[0] << " N\n" << endl;
+ return 1;
+ }
+ MT19937 rng;
+ unsigned n = atoi(argv[1]);
+
+ ArcFactoredForest forest(n);
+ TreeSampler ts(forest);
+ EdgeSubset tree;
+ ts.SampleRandomSpanningTree(&tree, &rng);
+ cout << tree << endl;
+ return 0;
+}
+