Skip to main content
. 2021 May 19;21(10):3520. doi: 10.3390/s21103520
Algorithm 2 Identifying mobility patterns.
  • Input: 

    GridTk: sequence of previously visited locations;

  • Output: 

    pattern type (“direct”, “random”, “lapping”, or “pacing”)

  • 1:

    if(gridTagridTb) where ab then

  • 2:

     label “direct” for the GridTk;

  • 3:

    else

  • 4:

     Find circles in GridTk;

  • 5:

     label pacing for points in the circle whose length is 2;

  • 6:

     label lapping for points in the circle whose length is between 3 and δ;

  • 7:

    for each unlabeled sub-sequence Sij of GridTk do

  • 8:

      if (gridTigridTj) where ij then

  • 9:

       label “direct” for Sij ;

  • 10:

      else

  • 11:

       label “random” for Sij;

  • 12:

      end if

  • 13:

    end for

  • 14:

    Ra,La,Pa = the number of sub-patterns labeled as “random”, “lapping”, and “pacing” respectively;

  • 15:

    max=Max(Ra,La,Pa);

  • 16:

    if max==Ra then

  • 17:

      label “random” for the GridTk;

  • 18:

    else

  • 19:

      if max==La then

  • 20:

       label “lapping” for the GridTk;

  • 21:

      else

  • 22:

       label “pacing” for the GridTk;

  • 23:

      end if

  • 24:

    end if

  • 25:

    end if