transform graph algorithm