Skip to main content
. 2026 Sep 17;26(18):5888. doi: 10.3390/s26185888
Algorithm 2 Temporal Similarity Graph Learning
Input: refined tokens Zm∈RB×T×Dm.
Output: classification logits y^.
Graph node preparation:
    Compress the feature dimension and obtain node features Xg∈RB×N×Dg.
Graph structure construction:
    Build self-loop edges Aself to preserve token identity.
    Build temporal-chain edges Achain within window r to retain local continuity.
    Compute cosine similarity S between normalized node features.
    Apply temporal penalty S˜ij=Sij−γ|i−j|/(N−1).
    Select top-k neighbors and form similarity edges Asim.
    Fuse edges: A=clip(Aself+Achain+Asim,0,1).
Hierarchical graph learning:
    Compute assignment and embedding matrices with DenseSAGEConv blocks.
    Apply DiffPool twice to obtain coarsened graph representations.
    Refine the final graph with DenseSAGEConv and average node embeddings.
return y^=MLP(g).