This post provides a macro to look at a connected network of shapes, i.e., nodes and allows various viewing options. All of these options are available from a non-modal userform. These include showing either incoming, outgoing or either (i.e., both = all) connections. Connections are 1-D shapes that can be either connector or line objects. In fact, everything is DRIVEN from the userform. It remains open until the user cancels it. Just park it out of the way.
A second main option is to choose whether or not to calculate and show the shortest path. The method is based upon Dijkstra's method as previously posted by Yacine. It deviates from that method in that: 1.) It doesn't pre-calc all of the connected pair distances, but only those that are needed, 2.) it doesn't pre-sort based upon shortest distance 1st, 3.) it allows for connector directionality, 4.) it colors the nodes and the connectors, and 5.) it is Visio-centric in that it uses connector collections to form "the neighborhood" of connected nodes. One mode thing, there is no hard-coded limit to the number of shapes and connectors, which was preset to 100.
Concerning (1): when analyzing directional shapes, it is not necessary to pre-calc all of the shape pair distances. Thus, this potentially saves some time.
Concerning (2): pre-sorting based upon distance is unnecessary as the comparison requires looking at all viable paths. So, there's no advantage to do this.
Concerning (3): this requires a few more conditional case conditions, so the sorting algorithm is slightly more complicated.
The attached Visio file has two pages...(1) is a simple diagram to facilitate code checking, and (2) is a more complex diagram.
The code is heavily commented to facilitate it's understanding. Where appropriate, it calls sub-routines. Some of the code is taken verbatim from Yacine's post.
Enjoy!
HTH
Wapperdude