From 08e9a6f71c80fc7327d1758312b40bd5ba763dc9 Mon Sep 17 00:00:00 2001
From: Patrick Simianer
Date: Sun, 20 Jul 2014 15:08:12 +0200
Subject: a lot
---
fast/hypergraph.hh | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
(limited to 'fast/hypergraph.hh')
diff --git a/fast/hypergraph.hh b/fast/hypergraph.hh
index 2e30911..530fbe6 100644
--- a/fast/hypergraph.hh
+++ b/fast/hypergraph.hh
@@ -1,7 +1,5 @@
#pragma once
-#include "grammar.hh"
-#include "semiring.hh"
#include
#include
#include
@@ -12,17 +10,19 @@
#include
#include
#include
+#include
+#include "grammar.hh"
+#include "semiring.hh"
#include "dummyvector.h"
-#include
using namespace std;
typedef double score_t;
typedef double weight_t;
-namespace Hg {
+namespace Hg {
struct Node;
@@ -31,11 +31,11 @@ struct Edge {
vector tails;
score_t score;
string rule; //FIXME
- DummyVector f; //FIXME
+ DummyVector f; //FIXME
unsigned int arity;
- unsigned int mark;
+ unsigned int mark = 0;
- bool is_marked();
+ inline bool is_marked() { return mark >= arity; }
friend std::ostream& operator<<(std::ostream& os, const Edge& s);
size_t head_id_;
@@ -47,19 +47,17 @@ struct Edge {
struct Node {
size_t id;
string symbol;
- unsigned short left;
- unsigned short right;
+ short left;
+ short right;
score_t score;
vector incoming;
vector outgoing;
unsigned int mark;
- bool is_marked();
+ inline bool is_marked() { return mark >= incoming.size(); };
friend std::ostream& operator<<(std::ostream& os, const Node& n);
- vector incoming_ids_; // edge ids
- vector outgoing_ids_; // edge ids
- MSGPACK_DEFINE(id, symbol, left, right, score, incoming_ids_, outgoing_ids_);
+ MSGPACK_DEFINE(id, symbol, left, right, score);
};
struct Hypergraph {
@@ -96,6 +94,5 @@ manual(Hypergraph& hg);
} // namespace
-
} // namespace
--
cgit v1.2.3