We propose to improve the efficiency of genetic programming, a method to automatically evolve computer programs. We use graph-based data mining to identify common aspects of highly fit individuals and modularizing them by creating functions out of the subprograms identified. Empirical evaluation on the lawnmower problem shows that our approach is successful in reducing the number of generations needed to find target programs. Even though the graph-based data mining system requires additional processing time, the number of individuals required in a generation can also be greatly reduced, resulting in an overall speed-up.