  We investigate polynomial endomorphisms of graph $C^*$-algebras and Leavitt
path algebras. To this end, we define and analyze the coding graph
corresponding to each such an endomorphism. We find an if and only if condition
for the endomorphism to restrict to an automorphism of the diagonal MASA, which
is stated in terms of synchronization of a certain labelling on the coding
graph. We show that the dynamics induced this way on the space of infinite
paths (the spectrum of the MASA) is generated by an asynchronous transducer.
