graph swap using a different approach