change graph to be direct base class (no inheritance) and expand leaf
node to be mark: supports leaf and epsilon.