Extract common code for copy edges in filterNodes
Fix a bug in compound graph copy + refactorings