The commutative core of a Leavitt path algebra