I wrote a LabVIEW wire routing algorithm in LabVIEW that is similar (but constrained to only vertical or horizontal lines). I would recommend an A* algorithm. They are easy to implement and you can find lots of pseudocode and info with a bit of searching. I believe I posted at least the priority queue on these forums, but the search is down at the moment, so I can't find it. If you cannot find it, let me know and I can post it again.