There are a few algorithms out there for chemical applications that convert molecular graphs into line representations. One output format is called the SMILES format. http://pubs.acs.org/doi/abs/10.1021/ci00062a008
you could use the same concept to convert your graph into a single word. If the number of of nodes in your graph is n, then the number of characters in your "SMILES" word is also n