improved graph_custom merging