Skip to main content
. 2019 Mar 6;21(3):254. doi: 10.3390/e21030254
Algorithm 1 Sampling context algorithm
Input: Network G, node attributes A, parameters r1, r2, q, e and d;
Output: (xi,xc,γ);
  • 1:

    ifrandom1<r1then

  • 2:

    γ+1;

  • 3:

    else

  • 4:

    γ1;

  • 5:

    end if

  • 6:

    ifrandom2<r2then

  • 7:

     Uniformly sample a random-walk sequence S of length q;

  • 8:

    if γ=+1 then

  • 9:

      Under the condition |ic|<d, sample (xi,xc) in S;

  • 10:

    else

  • 11:

      Sample xc in C;

  • 12:

    end if

  • 13:

    else

  • 14:

    if γ=+1 then

  • 15:

      Uniformly sample (xi,xc) which satisfies ai=ac;

  • 16:

    else

  • 17:

      Uniformly sample (xi,xc) which satisfies aiac;

  • 18:

    end if

  • 19:

    end if