Move duplicate code in InputGraphs to the parent class.