There are various algorithms to find the shortest path between two points on a given interconnected network (pipes, communication, roads, etc.).
In AutoCAD Map, you can effeciently solve this task using topologies (including throughput parameters, asymmetry, penalty functions). In plain AutoCAD, you can find the shortest connection between 2 network nodes using the freeware LISP utility CADstudio SPath.
Download the SPath.vlx file from www.cadstudio.cz/download, load it into AutoCAD with APPLOAD and type the SPATH command. Select the lines and polylines defining the network and pick two node-points on this network (precisely, use osnap). SPath will compute and generate a red polyline of the shortest path copying segments and nodes on the given network. Adjacent segment nodes must match. The number of selected network segments directly influences computing time of the optimal path.
Example of using SPath on a road network map of the Czech Republic - from the DWG block SilniceTematicky:
see also YouTube
To generate the shortest path connecting multiple points, use the ShortPath utility (travelling salesman problem, TSP).
(original algorithm: H.Schröder)