Namespace AS2.Subroutines.SingleSourceSP
Classes
Sub1SPF
Subroutine implementation of the single-source shortest path algorithm (SingleSourceSPParticle).
Usage:
- Initialize by calling Init(bool, bool, bool, List<Direction>, int). There must be exactly one source in each connected set of amoebots running this subroutine.
- Run SetupPC(PinConfiguration), then ActivateSend() to start the procedure.
- In the round immediately following a ActivateSend() call, ActivateReceive() must be called. There can be an arbitrary break until the next pin configuration setup and ActivateSend() call. Continue this until the procedure is finished.
- You can call IsFinished() immediately after ActivateReceive() to check whether the procedure is finished. If it is, you can find each amoebot's parent direction in the resulting shortest path tree using Parent(). Some amoebots may not be part of a shortest path to a destination, so they will have no parent.