Some examples of very optimized pathfinding can be found in the node
A Better Word Morph Builder. I think that the general idea for solving your problem is giving each machine an unique number (which is already done if the network map is implemented as you described), buiding a datastructure like
%network_map = (
12567 => # the machine id
[335, 456, 338], # the id's of machines it is directly connected to
335 => [12657, 558, 667, 333]
# etc
)
and browsing this datastructure with some tree search algorithm. I myself prefer
bidirectional search, the working example is given e.q. in
this node, but i think that your network is small enough for using the
breadth-first search without any significant performance loss.
Sorry for my English :)
s;;Just-me-not-h-Ni-m-P-Ni-lm-I-ar-O-Ni;;tr?IerONim-?HAcker ?d;print