An automatic router for diagrams/circuits