How can I implement a compact acyclic word graph (CDAWG) in C?

How to implement this data structure in C? This structure is similar, but twice as efficient as space than DAWG, more efficient than trie, which only compresses prefixes.

+4
source share
1 answer

From what I see from this paper

This is a trie with suffix compression to reduce the final state changes to match, since I was working on something similar, I also felt it was necessary to save space. This was the solution that I was thinking about the data structure, I am interested to know if there are other approaches:

struct cdawg { int issuffix:1; int length:31; char *s; // suffix if issuffix == 1, else array of valid transition chars struct cdawg *trans; // array of next states based on the index of trans char in s, null if suffix }; 
+5
source

All Articles