Text this: A nanophotonic laser on a graph