Semantic Node Similarity in Graphs Using Transformer-Based Embeddings
Abstract
Semantic similarity between nodes in graphs with textual attributes is crucial for numerous graph analytics tasks, such as clustering, inference, and latent relationship detection. Traditional structure-based similarity measures capture only topological information and fail to exploit the semantic content embedded in node descriptions. In this work, we propose a transformer-based semantic similarity framework that leverages contextual embeddings from pretrained Sentence-Transformer models to represent node textual content in a high-dimensional continuous space. Cosine similarity between node embeddings quantifies semantic relatedness, enabling the identification of semantically coherent node pairs and latent clusters, even when nodes are structurally distant or described with different vocabularies. We validate the approach on synthetic graphs inspired by investigative scenarios from the FALCON project and compare its performance against structure-only baselines such as SimRank and node2vec. Results show that the transformer-based method effectively captures hidden semantic relationships, outperforming structural approaches in precision, MAP, and cluster purity, demonstrating the potential of deep contextual embeddings to enrich graph analysis with latent semantic understanding.