Learning Graph Structure With A Finite-State Automaton Layer