Add merging function for flowgraph API