Skip to main content
. 2026 Feb 11;26(4):1170. doi: 10.3390/s26041170
Algorithm 1. Feature Extraction Algorithm Based on GraphSAGE.
Input: directed graph G, initial node feature vector {x0,x1,,xNs1}, sample size s, sampling depth K, weight matrix Wk, nonlinear activation function σ(·), aggregation function Mean
Output: Hidden feature vector of each node {hi(K),niNs}
  • 1:

    initial state of each node in the network hi0xi,niNs

  • 2:

    for k = 1, 2, …, K

  • 3:

    for niNs

  • 4:

    Sample s neighbor nodes of ni and aggregate them using a mean aggregator:

    hAdj(ni)kMean({hvk1,vAdj(ni)})

  • 5:

    Concatenate the aggregated neighbor features hAdj(ni)k with the node features hnik1:

    hnikσ(Wk·CONCAT(hnik1,hAdj(ni)k))

  • 6:

    end

  • 7:

    Normalize the result using a norm hnikhnik/||hnik||2

  • 8:

    end

  • 9:

    Obtain the final hidden feature vector of the node hihi(K),niNs