Builds a port-one tree: a spanning tree in which every node has at least one incident tree edge carrying port 1 at one of its two ends. Each edge is classified by the pair of port numbers at its ends — tp1, t11, t1q or tpq, where tpq is the only kind with port 1 at neither end — and the DFS prefers them in the order tp1 > t11 ~ t1q > tpq. A node reached only through a tpq edge cannot keep it as its parent, so it is parked as partiallyVisited and waits; when the DFS later arrives from that node's port-1 neighbour, the tree edge is swapped for the port-1 one and the node becomes ordinary. Agents settle one per node as the DFS discovers them, which is the dispersion.
Parallel probe: the scouts take a port each and step out together, then all return in the next round reporting what they found, so a neighbourhood search costs two rounds rather than two per port. The parent port is skipped. With fewer scouts than ports the assignment repeats.
Vacating: a settled agent whose node can spare it travels with the head as a scout, which is what keeps enough scouts to probe in parallel once every agent has settled. A closing retrace walks the tree in post-order and puts each scout back on the node it owns.
Implements Definition 1, Algorithm 2 (DFS_P1Tree), the parallel probe, vacating and retrace of Pattanayak, Kshemkalyani, Kumar, Molla and Sharma, Optimal Dispersion Under Asynchrony (arXiv:2507.01298). The scheduler here is synchronous, so these round counts are not the paper's O(k) epoch bound. Flowchart and code · implementation notes