summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Dyer <redpony@gmail.com>2009-12-17 19:31:41 -0500
committerChris Dyer <redpony@gmail.com>2009-12-17 19:31:41 -0500
commit40ac2d31391c27b168b0294e7683cb69da29f868 (patch)
tree2412cc09dcc032a5e45b59e3d540b5c9bfddb72a
parentbba4ff830c8722cdcaf29e36c1ff5821a912ae5d (diff)
make node order explicit in graph
-rw-r--r--decoder/hg.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/decoder/hg.cc b/decoder/hg.cc
index 7bd79394..de8e5e49 100644
--- a/decoder/hg.cc
+++ b/decoder/hg.cc
@@ -190,8 +190,17 @@ void Hypergraph::PrintGraphviz() const {
cerr << " A_" << ei << " [label=\"" << rule << " p=" << edge.edge_prob_
<< " F:" << edge.feature_values_
<< "\" shape=\"rect\"];\n";
+ Hypergraph::TailNodeVector indorder(edge.tail_nodes_.size(), 0);
+ int ntc = 0;
+ for (int i = 0; i < edge.rule_->e_.size(); ++i) {
+ if (edge.rule_->e_[i] <= 0) indorder[ntc++] = 1 + (-1 * edge.rule_->e_[i]);
+ }
for (int i = 0; i < edge.tail_nodes_.size(); ++i) {
- cerr << " " << edge.tail_nodes_[i] << " -> A_" << ei << ";\n";
+ cerr << " " << edge.tail_nodes_[i] << " -> A_" << ei;
+ if (edge.tail_nodes_.size() > 1) {
+ cerr << " [label=\"" << indorder[i] << "\"]";
+ }
+ cerr << ";\n";
}
cerr << " A_" << ei << " -> " << edge.head_node_ << ";\n";
}