+ return tNode->data();
+ }
+
+};
+
+template<class Payload>
+struct GraphTraits<Trie<Payload> > {
+ typedef typename Trie<Payload>::Node NodeType;
+ typedef typename std::vector<NodeType*>::iterator ChildIteratorType;
+
+ static inline NodeType *getEntryNode(const Trie<Payload>& T) {
+ return T.getRoot();
+ }
+
+ static inline ChildIteratorType child_begin(NodeType *N) {
+ return N->Children.begin();
+ }
+ static inline ChildIteratorType child_end(NodeType *N) {
+ return N->Children.end();
+ }
+
+ typedef typename std::vector<NodeType*>::const_iterator nodes_iterator;
+
+ static inline nodes_iterator nodes_begin(const Trie<Payload>& G) {
+ return G.Nodes.begin();
+ }
+ static inline nodes_iterator nodes_end(const Trie<Payload>& G) {
+ return G.Nodes.end();
+ }
+
+};
+
+template<class Payload>
+struct DOTGraphTraits<Trie<Payload> > : public DefaultDOTGraphTraits {
+ typedef typename Trie<Payload>::Node NodeType;
+ typedef typename GraphTraits<Trie<Payload> >::ChildIteratorType EdgeIter;
+
+ static std::string getGraphName(const Trie<Payload>& T) {
+ return "Trie";
+ }
+
+ static std::string getNodeLabel(NodeType* Node, const Trie<Payload>& T) {
+ if (T.getRoot() == Node)
+ return "<Root>";
+ else
+ return Node->label();
+ }
+
+ static std::string getEdgeSourceLabel(NodeType* Node, EdgeIter I) {
+ NodeType* N = *I;
+ return N->label().substr(0, 1);
+ }
+
+ static std::string getNodeAttributes(const NodeType* Node,
+ const Trie<Payload>& T) {
+ if (Node->data() != T.Empty)
+ return "color=blue";
+
+ return "";