Leveraging similarity and community-based features for link prediction in temporal social networks using attention-enabled LSTM Authors: Rohit Ahuja, Simranjit Kaur, Harish Kumar Shakya, Shashank Sheshar Singh Published: 2025 ABSTRACT AbstractLink prediction refers to predicting future or missing links within the social network. Static social networks, with their fixed topology, require less data analysis, making predicting future or missing links relatively easier than in dynamic social networks. Dynamic social networks change over time, which makes link prediction challenging. Modern similarity-based features look at the topological structure of the network but only use a single snapshot to calculate, so they miss important patterns and changes in the network over time. Community features, which divide the whole network into communities, help to improve the prediction by focusing on links between the intra-communities. Our proposed framework, SimCom-AN-LSTM, shows that combining structural and community features can leverage the strengths of both approaches. The sequence-based Long Short-Term Memory (LSTM) model processes the snapshot sequences to capture the network’s temporal dependencies. These features help the model learn temporal patterns and predict future links by capturing local interaction between the nodes, the overall network topology, and community structure. The attention mechanism enhances the performance of the LSTM model by giving more weight to the feature that yields the best results. Results indicate that the proposed framework surpasses the individual state-of-the-art algorithms.Keywords: Link prediction, Community detection, Temporal social networks, LSTM, AttentionSubject terms: Computer science, Information technology Introduction Nowadays, social networks have become an integral part of our daily lives because they allow us to create connections, communicate, and share information with people around the world1. Nearly 66% of the global population has internet access, enabling them to communicate and share information instantly, facilitating social connections. Social networks are dynamic and constantly changing, continuously forming and dissolving new links, and the interactions between the nodes change continuously. Dynamic networks are gaining importance due to their application in several fields, such as transportation systems, biology, and social networks2. These networks change over time by dissolving former links and forming newer ones. The major concern that hinders its application lies in the prediction of the evolution of networks over time. Several researchers have focused on confronting the major challenge of understanding and predicting these changes within dynamic social networks3. Social networks are complex systems because they show how different nodes are connected to each other in complex ways. Network science research used to focus on static networks, which are networks with fixed topologies that do not allow for any dynamic interaction. In contrast, many real-world systems exhibit dynamic behaviour, characterised by evolving relationships and temporal dependencies. These networks can be very accurate, efficient in terms of processing, and flexible when it comes to different types of inputs by changing their structure or parameters. Dynamic networks offer a more accurate representation of the basic relationships and processes in several domains, such as biological, social, and technological systems4,5. Dynamic networks can replicate the complexity and depth of most real-world networks, which are essentially dynamic. This is a key difference between dynamic and static networks. So, temporal characteristics are what make dynamic networks look dynamic because of how their links and information flow change over time. To understand how networks work and develop over time, it is important to be able to predict how the connections between them will change, expand, and dissolve. Additionally, because social networks are always changing, it is possible to look at how long-term network events like diffusion, contagion, and information cascades effect link production. Link prediction in dynamic networks facilitates the discovery of important nodes and connections, as well as the mechanisms influencing network dynamics, by analysing temporal dependencies6. Similarity-based features are used by traditional link prediction algorithms7. Features based on similarity look at how the network is structured topologically. There are local features, global features, and quasi-local features among these. Local features look at the node’s direct connections to other nodes and only look at its immediate neighbourhood. These characteristics, encompassing Common Neighbours (CN)8, Adamic Adar (AA)9, Jaccard’s Coefficient (JC)10, and Preferential Attachment (PA)11, consider the node’s local topology. Local features only look at a limited area of the social network, which makes them easy to compute. But these traits are short-sighted and might miss the long-term information that needs a complete understanding of the network. Global features look at the whole network topology and take into account how the network is set up as a whole. These features can be more effective in sparse networks where local features fail to predict links accurately. Global features include Shortest Path (SP)12, Cosine Similarity (COSP), Matrix Forest Index (MFI)13, and Average Commute Time (ACT). Global features are computationally expensive because they require the analysis of the entire social network. Quasi-local features help in maintaining a balance between local and global features14. They look beyond the immediate neighbourhood, but they don’t consider the entire network structure. Various quasi-local features are Local Path (LP)15, Path of Length 3 (LP), Clustering Coefficient-Based Link Prediction (CCLP)16, and Node and Link Clustering Coefficient (NLC). These features offer limited global insights and fail to predict the links between distant nodes. Community features divide the entire social network into clusters or communities. Various community detection algorithms are Diffusion Entropy Reduction (DER), Eigen Vector, Common Pott’s Matter (CPM)17, Surprise Communities (SUPR), Stochastic Block Model (SBM)18, and Leiden19. Recently, some advanced methods for link prediction have been introduced,20. For instance, in20, authors presented a fusion-based graph convolutional network model, while another study,21, introduced novel hypergraph motifs and a network embedding-based method for link prediction. The authors of22 presented a graph neural network-based link prediction method in microservice architectures. In23, the authors presented a -tree-based community-enhanced link prediction technique for dynamic networks. In24, a fuzzy-based information diffusion enabled a link prediction method in multiplex social networks. Similarly, authors of25 discussed another approach for multiplex link prediction using merged node and edge relevance. The authors of26 introduced a quantum-enabled method based on a variational quantum classifier for predicting missing links on social networks. Despite the significant progress in link prediction for temporal social networks, existing methods often struggle to effectively capture dynamic patterns of evolving relationships, leading to suboptimal performance in real-world scenarios. Traditional methods mostly look at static features or homogeneous graph structures. They do not take into account the temporal relationships and community-based impacts that are important for understanding how networks change over time. Additionally, limited research has utilised similarity measures alongside community data to improve predictive accuracy5. To fill these gaps, we propose SimCom-AN-LSTM, a new framework that combines community and similarity-based features with an attention-enabled Long Short-Term Memory (LSTM) model. This method tries to find both local and global trends in how networks change over time, which makes it easier to predict future links. The attention mechanism makes the model even better at focusing on important time-based information, which makes link prediction in temporal social networks more precise and reliable. The contributions of the manuscript are listed as follows: We have presented a novel framework, SimCom-AN-LSTM, which integrates similarity (local, global, and quasi-local) and community-based features for link prediction in temporal social networks. Similarity-based features capture structural properties and community-based feature investigates patterns and structures to enhance the predictive accuracy of the proposed framework. We have presented a novel framework, SimCom-AN-LSTM, which integrates similarity (local, global, and quasi-local) and community-based features for link prediction in temporal social networks. Similarity-based features capture structural properties and community-based feature investigates patterns and structures to enhance the predictive accuracy of the proposed framework. An attention-enabled LSTM architecture is proposed to dynamically weigh the importance of different features and time steps, allowing the model to focus on relevant features in predictions. An attention-enabled LSTM architecture is proposed to dynamically weigh the importance of different features and time steps, allowing the model to focus on relevant features in predictions. Comprehensive experiments and evaluations on seven real-world datasets have been performed to demonstrate the effectiveness of the SimCom-AN-LSTM model compared to existing methods using three performance metrics: AUC, AUPR, and precision. Comprehensive experiments and evaluations on seven real-world datasets have been performed to demonstrate the effectiveness of the SimCom-AN-LSTM model compared to existing methods using three performance metrics: AUC, AUPR, and precision. Related work Link prediction Link prediction has attracted several researchers across the globe to catalyze network analysis to identify possible links between the nodes within the social network. Several approaches ranging from machine learning to conventional graph-based algorithms have been employed for link prediction. Earlier link prediction methods relied on the structural properties of the network for predicting the future or missing links27. Graph-based approaches retrieve the similarity scores between pairs of nodes as the Adamic/Adar Index, Jaccard Coefficient, Preferential Attachment and Common Neighbors, considering the topology of the network or familiar neighbors of the node pairs. These features only capture the local view of the network, merely taking into consideration the immediate neighboring nodes, ignoring the global structure of the network. Moreover, these features generally assume homophily, i.e., similar nodes are more likely to be connected. This assumption fails in heterophilous networks where dissimilar nodes are also likely to be connected. Furthermore, community-enhanced link prediction28 assumes the associated information of node communities for better prediction accuracy and further realises that community structure indicates essential knowledge regarding network dynamics. These techniques harness the strong community structure in communities by mining interactions within as well as between communities for predicting possible links28. Deep learning techniques play a vital role in identification at every step of the link prediction process, from feature extraction to link prediction. The emergence of machine learning algorithms has accelerated the development of machine learning, which takes full advantage of the predictive variables derived from the traits of the nodes, the structures of the networks, and external data. Supervised learning techniques help to forecast the addition of new links to the network or find existing links within the network but not present in the available data. Nowadays, graph neural networks have been widely used for link prediction due to their ability to learn better representations of nodes and edges within networks29. These models might potentially mitigate the inaccuracy of link prediction by capturing complex connections and relationships in network topology. Several link prediction models have benefited from the R-Models (RMLs) neural network because it provides a deep learning solution to the link weight prediction problem by Yuchen Hou and Lawrence B. Holder30, illustrating the usage of state-of-the-art neural network models in link prediction. Deep learning techniques, such as deep neural networks, are quite useful in link prediction tasks to leverage complex neural architecture’s capacity to recognise complex patterns in network data. Link prediction relies majorly on feature engineering, where supervised machine learning models are trained using topological and aggregated data. Raeini et al.31 suggested a supervised-learning link prediction using single-layer and multiplex networks and evaluated the effectiveness of aggregated and topological features in link prediction using various supervised machine-learning methods, emphasising the importance of feature selection in link prediction, which indeed increases the ability of the model to predict future links correctly. In another study5, authors have presented machine learning models for link prediction using similarity-based and community features. Recently, few studies have focused on prediction of performance based on the question-answer interactions in temporal settings32 and urban commuting flow prediction33. Community detection Community-based features are employed to enhance the predictive accuracy of future or missing links in complex social networks. Numerous real-world networks have community structure, which offers important insights into the underlying connections between nodes. Community-based features are incorporated with an aim to enhance the link prediction algorithm because it captures the complex interactions between nodes within communities. Communities are cohesive collections of nodes within a network, identified using community detection methods such as the frequently used Greedy Modularity algorithm34. It divides nodes into communities in such a way that it maximizes the modularity of the final partition. Modularity is a quantitative measure of the quality of community structure based on the density of links inside the communities compared to random networks. The greedy modularity algorithm maximizes the overall modularity score by iteratively merging pairs of communities. It suggests changes in modularity due to the merger of two communities and chooses the merger that maximizes the rise in modularity at each stage. This process iterates until further merging no longer leads to increased modularity. The method is ideal for extensive network analysis due to its greedy nature, which ensures computational efficiency35. Clauset-Newman-Moore (CPM)36 detects cohesive clusters of nodes in a network such that the maximum modularity score is pulled up. Modularity measures the density of links within communities compared to a random network, serving as a key indicator of the community structure. CPM is a two-step process; firstly, it assigns all the nodes to a community and then merges them again and again. This process aims to find a merger that maximises the increase in modularity at each level. The gain in modularity is determined by assessing how much merging two communities enhances the overall modularity score. The process continues until further merging does not increase modularity. The statistical community technique is widely used to extract communities in networks, which groups nodes based on their statistical significance. Significance Communities37 considers the statistical significance of the observed community structure concerning random null models, in opposition to classic community identification methods that just take into account the topology of the network. Leiden19 is a community detection technique that identifies the communities in the networks by maximizing the modularity quality function. The quality of a community partition is measured by the modularity , where higher values suggest stronger connections inside communities as opposed to across communities. Leiden, which was created as an expansion of the Louvain algorithm38, provides better performance and scalability without sacrificing the quality of the community detection outcomes. The modularity used in community detection algorithms is defined as: where is the adjacency matrix representing the presence (1) or absence (0) of an edge between nodes and , and are the degrees of nodes and , respectively. is the total number of edges in the network. is the Kronecker delta function, which equals to 1 if nodes and belong to the same community and 0 otherwise, and are the community assignments of nodes and , respectively. In39, authors have presented a comprehensive survey of Spectral Clustering algorithms using graph structure. Preliminaries Local similarity-based features Local similarity-based features provide adequate connections between nodes in the network. They suggest that nodes with comparable local network topologies are more likely to form a link. These features are essential for examining the underlying connection patterns in a network by leveraging data from the nodes immediate neighbours and assessing the similarity between two nodes based on their local network context8. The goal of these attributes is to capture the idea of “homophily”, which is when nodes with a lot of similar neighbours are likely to become connected in the future. Consequently, these features provide predictive indicators regarding connection formation. Some of the most common ways to measure local similarity include following4,5: Common Neighbors: It is a measure of the number of familiar neighbors comprising of two common nodes8. Nodes that share a higher number of common neighbors seems to be more comparable and are more likely to establish connections in the near future. Common neighbor is defined as: where denotes the set of neighbors of node . Common Neighbors: It is a measure of the number of familiar neighbors comprising of two common nodes8. Nodes that share a higher number of common neighbors seems to be more comparable and are more likely to establish connections in the near future. Common neighbor is defined as: where denotes the set of neighbors of node . Jaccard Coefficient: It measures the similarity between two nodes by computing the ratio of the intersection to the union of their respective sets of neighbors. It determines the extent to which the neighbors of two nodes overlap with each other then recommends the linking of both nodes10. Jaccard coefficient can be computed using equation given below: Jaccard Coefficient: It measures the similarity between two nodes by computing the ratio of the intersection to the union of their respective sets of neighbors. It determines the extent to which the neighbors of two nodes overlap with each other then recommends the linking of both nodes10. Jaccard coefficient can be computed using equation given below: Adamic/Adam Index: Common neighbors that are less common in the network are given more weight by this index9. It enables the model to take into account the contributions of uncommon common neighbors in link prediction. It computes the sum of the reciprocals of the logarithm of the degrees of common neighbors using equation below: Adamic/Adam Index: Common neighbors that are less common in the network are given more weight by this index9. It enables the model to take into account the contributions of uncommon common neighbors in link prediction. It computes the sum of the reciprocals of the logarithm of the degrees of common neighbors using equation below: Preferential Attachment: It states that nodes with higher degrees have a tendency to form new links over time11. It states that popular nodes with a high number of connections are more likely to obtain additional links than less connected nodes. The probability of forming a link between two nodes i and j is given by the product of degrees and , divided by the sum of degrees of all nodes in the network is defined below. Preferential Attachment: It states that nodes with higher degrees have a tendency to form new links over time11. It states that popular nodes with a high number of connections are more likely to obtain additional links than less connected nodes. The probability of forming a link between two nodes i and j is given by the product of degrees and , divided by the sum of degrees of all nodes in the network is defined below. Global feature Global features provide a full understanding of how the network is structure. Global features can show patterns and characteristics of the network’s structure and behavior that local features may overlook40. Following metrics are involved in global features4,5: Shortest Path Length (SP): It counts the lowest number of edges needed to connect two nodes41. In link prediction, the shortest path is used to find out how likely it is that two nodes are linked based on how close they are to one other in the network. If two nodes have shorter paths, they are more likely to be connected. Members of social networks who have shorter paths between them are more likely to be friends or have comparable interests. This metric is crucial in understanding the efficiency of information flow and connectivity within the network. Shortest Path Length (SP): It counts the lowest number of edges needed to connect two nodes41. In link prediction, the shortest path is used to find out how likely it is that two nodes are linked based on how close they are to one other in the network. If two nodes have shorter paths, they are more likely to be connected. Members of social networks who have shorter paths between them are more likely to be friends or have comparable interests. This metric is crucial in understanding the efficiency of information flow and connectivity within the network. Average Commute Time (ACT): A global similarity metric ACT42 gives an estimate of how long it will take a random walker to move from one node to another. The basic idea behind ACT is that nodes are more likely to be connected if the travel times are shorter. In networks like transportation or communication, where the flow of resources or information is vital, the ACT is very helpful. In the context of a graph , where represents the set of nodes and represents the set of edges, the average commute time between two nodes and is defined as where denotes the probability that a random walk starting at node reaches node for the first time in exactly steps. This expression captures the cumulative probability of reaching node at each step , weighted by the number of steps . Average Commute Time (ACT): A global similarity metric ACT42 gives an estimate of how long it will take a random walker to move from one node to another. The basic idea behind ACT is that nodes are more likely to be connected if the travel times are shorter. In networks like transportation or communication, where the flow of resources or information is vital, the ACT is very helpful. In the context of a graph , where represents the set of nodes and represents the set of edges, the average commute time between two nodes and is defined as where denotes the probability that a random walk starting at node reaches node for the first time in exactly steps. This expression captures the cumulative probability of reaching node at each step , weighted by the number of steps . Matrix Forest Index: The matrix forest index (MFI) measures how crucial each edge is to enable communication among nodes in a network43. It calculates the impact of every edge on a network connection using the random walk principle. MFI enables to discover crucial links for preserving network integrity by offering insightful data on edge centrality and robustness. Given a graph , where is the set of nodes and is the set of edges, let be the Laplacian matrix of the graph. The Laplacian matrix is defined as , where is the degree matrix and is the adjacency matrix of the graph. MFI between nodes and , denoted as , is calculated as follows: where is the identity matrix, is a tuning parameter, and represents the -th entry of the inverse matrix . Matrix Forest Index: The matrix forest index (MFI) measures how crucial each edge is to enable communication among nodes in a network43. It calculates the impact of every edge on a network connection using the random walk principle. MFI enables to discover crucial links for preserving network integrity by offering insightful data on edge centrality and robustness. Given a graph , where is the set of nodes and is the set of edges, let be the Laplacian matrix of the graph. The Laplacian matrix is defined as , where is the degree matrix and is the adjacency matrix of the graph. MFI between nodes and , denoted as , is calculated as follows: where is the identity matrix, is a tuning parameter, and represents the -th entry of the inverse matrix . Cosine Similarity (COSP): It is a measure to compute the cosine of the angle between two non-zero vectors in an inner product space. This metric is often used to measure the similarity between two nodes based on their feature vectors. Given two feature vectors and corresponding to nodes and , the Cosine Similarity is defined as: where denotes the dot product of vectors , , and denote the Euclidean norms (magnitudes) of vectors and , respectively. Cosine Similarity (COSP): It is a measure to compute the cosine of the angle between two non-zero vectors in an inner product space. This metric is often used to measure the similarity between two nodes based on their feature vectors. Given two feature vectors and corresponding to nodes and , the Cosine Similarity is defined as: where denotes the dot product of vectors , , and denote the Euclidean norms (magnitudes) of vectors and , respectively. Global features capture the overall network structure and properties such as network density, diameter, degree distribution, and associativity. These features provide a more holistic view of the network and its characteristics, which is very crucial in understanding link formation. Moreover, these features are less sensitive to local perturbations or noise in the network as compared to the local features. Quasi-local feature In dynamic networks, quasi-local features provide us a better look at how nodes interact and how the network is structured. Quasi-local features take into account more contextual information, such as the structure and attributes of the network’s larger neighborhood. Quasi-local characteristics demonstrate the rationale for the clustering of nodes and links inside the network, capturing its intermediate-scale patterns and dependencies. These link prediction methods include the node clustering coefficient, the local path, the path of length, and the clustering coefficient4. Local Path: Examining pathways of a particular length between nodes in order to estimate the likelihood of a link is known as the local path feature in link prediction algorithms44. Local path feature delivers a more nuanced view of possible links between nodes by taking into account pathways of different lengths and reveals patterns of connectivity within the network. A local path between two nodes u and v in a network can be defined as a sequence of edges or nodes that connect them, with a limited length or depth. The length of the path varies depending on the specific context and the properties of the network. Local Path: Examining pathways of a particular length between nodes in order to estimate the likelihood of a link is known as the local path feature in link prediction algorithms44. Local path feature delivers a more nuanced view of possible links between nodes by taking into account pathways of different lengths and reveals patterns of connectivity within the network. A local path between two nodes u and v in a network can be defined as a sequence of edges or nodes that connect them, with a limited length or depth. The length of the path varies depending on the specific context and the properties of the network. Path of Length: In a network, path length indicates the number of different paths of a certain length that connect two nodes45. It yields information regarding network resilience, redundancy, and navigability by measuring the variety of paths that connect node pairs. In addition, provides necessary data for routing algorithms and link prediction, a path of length-based features also captures the multi-scale structure of dynamic networks. Path of Length: In a network, path length indicates the number of different paths of a certain length that connect two nodes45. It yields information regarding network resilience, redundancy, and navigability by measuring the variety of paths that connect node pairs. In addition, provides necessary data for routing algorithms and link prediction, a path of length-based features also captures the multi-scale structure of dynamic networks. Clustering Coefficient-based Link prediction: The local clustering patterns of nodes are utilized by clustering coefficient-based link prediction techniques to deduce possible links within a network46. These techniques use the overlap of local neighborhoods and the presence of shared neighbors between two nodes to calculate the probability that a link will emerge between them. Link prediction based on clustering coefficients is useful for capturing triangle closure processes and transitivity in dynamic networks. Clustering Coefficient-based Link prediction: The local clustering patterns of nodes are utilized by clustering coefficient-based link prediction techniques to deduce possible links within a network46. These techniques use the overlap of local neighborhoods and the presence of shared neighbors between two nodes to calculate the probability that a link will emerge between them. Link prediction based on clustering coefficients is useful for capturing triangle closure processes and transitivity in dynamic networks. Node and Link Clustering Coefficient: The density of connections between a node’s neighbors is measured by the node clustering coefficient47, which indicates the degree of local clustering or community structure surrounding the node. Comparably, the probability of neighboring edges forming triangles in the network is quantified by the link clustering coefficient. Node and link clustering coefficients enables to identify communities and characterize networks by providing information about the cohesiveness and modular structure of dynamic networks. NLC utilizes the concept of neighborhood overlap to predict links between nodes. It is defined as: where, is the NLC measure between nodes and . represents the set of neighbors of node . Node and Link Clustering Coefficient: The density of connections between a node’s neighbors is measured by the node clustering coefficient47, which indicates the degree of local clustering or community structure surrounding the node. Comparably, the probability of neighboring edges forming triangles in the network is quantified by the link clustering coefficient. Node and link clustering coefficients enables to identify communities and characterize networks by providing information about the cohesiveness and modular structure of dynamic networks. NLC utilizes the concept of neighborhood overlap to predict links between nodes. It is defined as: where, is the NLC measure between nodes and . represents the set of neighbors of node . Proposed work This paper proposes the SimCom-AN-LSTM framework for link prediction in temporal social networks. The proposed work aims to predict the link accurately in dynamic temporal social networks. Our approach to the problem of predicting links in dynamic networks uses a combination of community features, similarity-based features, and an enhanced Long Short-Term Memory (LSTM) network with an attention mechanism, as seen in Fig. 3. The goal is to design a multifaceted approach that can capture the complex and evolving dynamics of social networks. Firstly, we load the social network dataset for data processing and snapshot generation, retrieving information about source nodes, target nodes, and timestamps. These elements represent the interactions or connections between nodes over time. Given the dynamic nature of social networks, we partition the dataset into five snapshots, each reflecting the network at specific time intervals. These snapshots enable us to analyse the evolution of networks, which plays a vital role in predicting future links followed by future generations. The SimCom-AN-LSTM framework. Attention-enhanced LSTM framework Long Short-Term Memory (LSTM) networks are widely employed for sequence modeling as they mitigate the vanishing gradient problem inherent in Recurrent Neural Networks (RNNs) 48–50. An LSTM unit comprises of three gates input , forget , and output , together with a memory cell as depicted in Fig. 1, which enable selective retention and discarding of past information. The hidden state update is governed by: To enhance the ability of the LSTM to focus on the most informative time steps, we incorporate an attention mechanism over the hidden states as depicted in Figs. 2 and 3. The importance score of each hidden state is computed as: The context vector is then obtained as a weighted sum: Finally, the context c is concatenated with the last hidden state and passed to the output layer: This integration allows the network to dynamically highlight salient temporal features, improving both predictive performance and interpretability. A schematic of the attention-enhanced LSTM pipeline is illustrated in Fig. 2. The attention mechanism calculates weights for each feature and/or timestep, indicating their importance to the prediction at each moment. These attention weights are learned during training and enable the model to adaptively focus on informative parts of the input for each prediction. The attention-weighted representations are then used for the final output layer, making the network selectively sensitive to relevant input components.Each hidden state ht at time step t carries learned temporal features from the input sequence. The Attention layer takes the sequence of hidden states from the LSTM as input. It introduces trainable parameters (weight matrices and biases) that project each hidden state into a new representation to compute attention scores. Activation and Weight Normalization function used - sigmoid For each timestep t, a context vector is computed by taking the weighted sum of all hidden states , weighted by the attention weights. This context vector integrates information from the entire sequence, focusing on the most relevant time steps determined by the model during training. The sequence of context vectors is passed to a dense layer with sigmoid activation to produce predictions for each timestep. The attention-enhanced context allows the model to emphasize meaningful temporal features and dependencies beyond the fixed-memory nature of the LSTM alone. Architectural representation of a long short-term memory unit. Illustration of attention enabled LSTM framework. Feature generation & training dynamic snapshots The LSTM-enabled model then undergoes training using four types of features. We use four types of features: local, global, quasi-local, and community-based. By considering the network’s topological structure, we extract the first three types of similarity-based features. Local features include Common Neighbors (CN), Jaccard Coefficient (JC), Adamic/Adar Index (AA), and Preferential Attachment (PA). Global features provide a broader perspective on network connectivity, which consists of Shortest Path, Average Commute Time (ACT), Matrix Forest Index (MFI), and COSP. Local Path Index (LP), Path of Length 3 (L3), Clustering Coefficient-based Link Prediction (CCLP), and Node and Link Clustering Coefficient (NLC) are all examples of quasi-local features. We use different community detection algorithms, such as Diffusion Entropy Reducer (DER), Surprise Communities (SURP), Stochastic Block Model (SBM), LEIDEN, Eigenvector (EIGEN), and Constant Potts Model (CPM), to get information about communities. We combine these features to generate a feature set. The core of the proposed methodology is the LSTM model enhanced with attention mechanisms, as shown in Fig. 4. SIMCOM-AN-LSTM cell structure. We combined similarity-based features (local, quasi-local, and global) with community-based features when we generated the feature vector. This selection is inspired by the theoretical understanding of social network formation, wherein both local and global structural similarity (e.g., common neighbors, shortest paths) and meso-level cohesion (e.g., modular communities) collaboratively contribute link formation. We employ the attention mechanism in the LSTM to automatically give more weight to more informative features across temporal snapshots instead of manually selecting or weighting information, which may lead us to miss useful information. The attention mechanism calculates weights for each feature and/or timestep, indicating their importance to the prediction at each moment. The attention mechanism calculates weights for each feature and/or timestep, indicating their importance to the prediction at each moment. These attention weights are learned during training and enable the model to adaptively focus on informative parts of the input for each prediction. These attention weights are learned during training and enable the model to adaptively focus on informative parts of the input for each prediction. The attention-weighted representations are then used for the final output layer, making the network selectively sensitive to relevant input components. The attention-weighted representations are then used for the final output layer, making the network selectively sensitive to relevant input components. This framework makes it possible for the model to focus on the most predictive aspects by using a data-driven balance. Several community-detection methods including Louvain, Leiden, Infomap, CPM, DER, SUPR, SBM, eigenvector methods offer complementary views of network structure but rely on different heuristics and objectives. Modularity-based methods (Louvain/Leiden) are fast and scalable but suffer from resolution limits while Infomap captures multi-scale and overlapping structure yet it is computationally expensive. CPM finds overlapping communities but scales poorly, to efficiently address temporal/heterogeneous networks DER and SUPR plays a vital role but required careful tuning. SBM gives a principled generative fit, while eigenvector methods work well on moderate, well-conditioned graphs but are noise-sensitive. Combining features from multiple algorithms mitigates individual biases and yields a more robust, reliable representation for downstream analysis 51. Mathematically, let denote the set of M community detection algorithms, where is the algorithm set. For each snapshot and each algorithm , let be the set of detected communities. For each edge (u, v) in , extract a feature vector. describes the relationship between u and v under partition . The aggregated community feature vector for edge (u, v) at time t is constructed as: where denotes vector concatenation and is the feature vector. This process can be repeated for each snapshot, and concatenated with other structural/similarity features to yield the full feature tensor for temporal models. Each is subject to biases due to algorithmic design or hyperparameter sensitivity: where is the latent, bias-free community signal and is the method-specific error. Under this model, concatenating or averaging the features across all M algorithms ensures that unshared, algorithm-specific errors tend to cancel, while consistent signals are preserved. The ensemble feature thus exhibits: which implies the ensemble exhibits lower variance than individual methods and is therefore more robust to algorithm-specific biases. Testing & evaluation The LSTM network is particularly suited for handling sequential data, making it ideal for modeling dynamic networks. The attention layer utilizes the common-neighbor feature. The attention mechanism improves the model’s ability to focus on the most relevant parts of the input sequence, enhancing prediction accuracy by highlighting important temporal dependencies and patterns. We use an attention mechanism model to enhance the accuracy of the LSTM. We calculate the optimal values of several hyperparameters, including batch size, number of dense units, number of epochs, number of LSTM units, and sequence length. Finally, we evaluate the proposed SimCom-AN-LSTM model against the state-of-the-art traditional methods for performance metrics AUC, average precision, and AUPR for link prediction in a temporal social network, showcasing its performance and improvements. These results shows the proposed model outperform the compared methods for link prediction in temporal social networks. SimCom-AN-LSTM: similarity and community-based features for link prediction in temporal social networks using attention-enabled LSTM Attention LSTM Grid search algorithm to train LSTM hyperparameters Algorithm Algorithm 1 predicts future links or missing links in a temporal social network using similarity and community features using an improved LSTM model with an attention mechanism. It expresses the rationale behind link generation over time in social networks by designing a snapshot construction method and a feature extraction strategy and then using an attention-enriched LSTM model to predict forward links. LSTMs compress all sequence information into a single hidden state, which often makes it difficult to capture long-term dependencies. By introducing attention, the model learns to assign importance weights to each timestamp using Algorithm 2, ensuring that the most relevant parts of the sequence influence the prediction more strongly. Thus, not only the performance is improved but also directly enhances interpretability. Hyperparameter tuning in the attention-mechanism enhanced LSTM model is described in Algorithm 3. The algorithm first sets a sequence of the hyperparameter space (batch_size, dense_units, epochs, lstm_units, and sequence length) consecutively. Then, Algorithm 3 describes the suggested grid search method that is used in the process of fine-tuning the hyperparameters for the attention-mechanism enhanced LSTM model. Firstly, hyperparameter space, consisting of batch size, dense units, epochs, LSTM units, and the sequence length is discussed. Then, the loop iterates over all the possible combinations of hyperparameters and trains one LSTM for each combination by building the LSTM using the first four snapshots. Next, we evaluate each model using three matrices: AUC, AUPR, and average precision, comparing it to the fifth snapshot. Thus, Algorithm 3 records and updates the best-performing hyperparameters based on these metrics. After all the possible values, it outputs the optimal hyperparameter values. Experimental evaluation This section gives detailed insights into the experiment and performance. We conducted experiments on five well-known social network datasets. To evaluate the performance of our proposed SimCom-An-LSTM framework, we employed three performance metrics AUC, AUPR, and average precision. Along with that, we also calculated the performance of individual similarity-based link prediction algorithms on the above list metrics. To enhance the performance of our SIMCom-An-LSTM framework, we employed grid search for hyperparameter optimization and also used an attention mechanism. We shall see the experimental results in the following subsections on the three well-known performance metrics. Experimental setup The experiments are conducted on a system with an 11-generation Intel i5 processor and 8 GB of RAM equipped with Python version 3.11.4. The Python version was chosen based on its compatibility with the various libraries which were essential in implementing the link prediction algorithms. To implement the community detection algorithms, the Windows Subsystem for Linux (WSL) was used. WSL, specifically Ubuntu, version 2, facilitated the experimental setup. WSL works as a layer for running Linux binary executables natively on Windows 10 and later operating systems. We chose Ubuntu as the Linux environment within WSL due to its extensive package repository and strong community support. The code for generating the feature set and the proposed method SimCom-ANLSTM can be found at https://github.com/S03imran/SIMCOM-AN-LSTM. Datasets We have examined seven datasets, each providing insights into communication and human interaction. Table 1 gives information about the datasets which includes several nodes, edges, start and end time, average density, density, average shortest path, average clustering coefficient, and associativity. MIT: This dataset collects human contact data over nine months among one hundred students at MIT52. Nodes represent people, and edges represent physical interactions. MIT: This dataset collects human contact data over nine months among one hundred students at MIT52. Nodes represent people, and edges represent physical interactions. EU-Core: Provides light on professional contacts and network structures by representing email communication relationships53. EU-Core: Provides light on professional contacts and network structures by representing email communication relationships53. Radoslaw-Email: Offers an intimate glimpse into a mid-sized manufacturing company’s email communication network54, illustrating the exchange of information between staff members. Radoslaw-Email: Offers an intimate glimpse into a mid-sized manufacturing company’s email communication network54, illustrating the exchange of information between staff members. CollegeMsg: Consists of private messages between University of California, Irvine students on an online social network55, provides insights into interpersonal interactions in an academic environment. CollegeMsg: Consists of private messages between University of California, Irvine students on an online social network55, provides insights into interpersonal interactions in an academic environment. FB-Forum: Provides an insight into the composition and dynamics of online social interactions by representing the social network that was taken from Facebook56. FB-Forum: Provides an insight into the composition and dynamics of online social interactions by representing the social network that was taken from Facebook56. sx-askubuntu: The SNAP Ask Ubuntu dataset is a temporal network of interactions on the Ask Ubuntu StackExchange site, recording user-to-user events such as answering or commenting with timestamps 57. sx-askubuntu: The SNAP Ask Ubuntu dataset is a temporal network of interactions on the Ask Ubuntu StackExchange site, recording user-to-user events such as answering or commenting with timestamps 57. Bitcoin: This is who-trusts-whom network of people who trade using Bitcoin on a platform called Bitcoin Alpha58. Since Bitcoin users are anonymous, there is a need to maintain a record of users’ reputation to prevent transactions with fraudulent and risky users. Bitcoin: This is who-trusts-whom network of people who trade using Bitcoin on a platform called Bitcoin Alpha58. Since Bitcoin users are anonymous, there is a need to maintain a record of users’ reputation to prevent transactions with fraudulent and risky users. Table 1Dataset Information.DatasetSnapshotsStart TimeEnd timeAverage densityDensityAverage shortest pathAverage clustering coefficientAssociativityNodesEdgesCollegeMsg13438288108204096110853881970.00920.00923.05340.1121-0.210712224799108538819710887354330.00640.00643.45810.0577-0.15495471104108873543310920826700.00740.00743.72410.0526-0.2086458780109208267010954299060.00750.00754.03700.0284-0.2205338480109542990610987771420.00840.00844.45310.0117-0.2784Eu-core8178012013891850.80.02400.02402.84850.35620.0213823825913891850.827783701.60.02440.02442.79370.3682-0.0214880924727783701.641675552.40.02390.02392.79660.3592-0.0018789552241675552.455567403.20.01780.01783.03180.3484-0.0127533109055567403.2694592540.00770.00774.25580.2070-0.1994Fb-forum8275959108458599610874284170.01740.01742.85200.0613-0.10385771663108742841710902708380.01000.01003.68150.0158-0.04774751252109027083810931132590.01110.01113.61560.0195-0.1567408854109311325910959556800.01030.01034.06350.0312-0.0810401718109595568010987981010.00900.00904.50690.0102-0.1422Mit951792109518309610991972160.40130.40131.62710.6524-0.0269911778109919721611032113360.43420.43421.57480.6873-0.005885817110321133611072254560.22890.22891.94990.5526-0.081279622110722545611112395760.20190.20191.98930.6085-0.285660362111123957611152536960.20450.20451.98020.5847-0.4368Radoslaw-email1512019126245401012671401060.17830.17831.95590.5908-0.28051481852126714010612718262030.17030.17032.01090.5345-0.25311451294127182620312765122990.12390.12392.25770.36210.00341351237127651229912811983960.13680.13682.17440.3901-0.05721401429128119839612858844920.14690.14692.11810.4463-0.1113 Dataset Information. Performance metrics The Area Under the ROC Curve (AUC)59 is a useful measure for evaluating how well binary classification models, like those employed in link prediction work. The AUC shows how the true positive rate (sensitivity) and the false positive rate (specificity) change with different threshold values. Its value lies in the range (0,1). A value near 1 represents the models that give good performances. It measures the total discriminative capacity of a classifier over all conceivable threshold settings. It provides a comprehensive evaluation of the discrimination capacity of the link prediction model to discriminate positive instances (existing connections) from negative ones (non-existing links) in the network; hence, it gives a critical statistic on the problems concerning the link prediction. If we have data points on the ROC curve, , then for , the AUC is computed as: where is the -th point on the ROC curve, where is the false positive rate and the true positive rate at the -th threshold. Significantly, the Area Under the Precision-Recall Curve (AUPR) has been widely used in capturing the potential performance on imbalanced datasets, which is often employed in the scenario of link prediction, as the number of non-links is greater than the number of practical links. At various threshold levels, the AUPR measures the area under the curve when plotting precision (the ratio of true positives to the sum of true positives and false positives) against recall (the ratio of true positives to the sum of true positives and false negatives). AUPR values provide insight into the trade-off of precision versus recall curves for different thresholds. A higher AUPR value indicates better performance because the model maintains more precision while achieving a higher recall. AUPR is of high relevance within the context of our work, as it allows for quantifying the model performance in scenarios where the classes are imbalanced or where the absence of a link is much more common than the presence of a link. Average precision provides a way to summarize a precision-recall curve into a single number, usually representing the area under the curve. The weighted average of all possible precisions found at each threshold where recall changes determines the average precision, with the increase in recall from the previous threshold serving as the weight. It provides a single-figure measurement of quality across all levels of recall. For most tasks where false positives and false negatives are costly, a higher average precision value indicates the model’s precision across high recall levels. Parameter selection This proposed method of link prediction in temporal social networks employs LSTM to train the model on various features. To determine the optimal parameters and for the hyperparameter tuning, a grid search60 is used. Gris search is used to explore the predefined set of hyperparameters to identify the combination of parameters that yields the best performance on a given evaluation metric61. The LSTM parameters that were tuned for our experiment through grid search are given below: Batch Size: Batch size is the number of samples processed before the model’s weight is updated. We explored batch sizes of 32, and 64. Batch Size: Batch size is the number of samples processed before the model’s weight is updated. We explored batch sizes of 32, and 64. Dense Units: Dense units define the number of neurons in the densely connected layer of the LSTM model. We conducted the experiment with dense units 32, and 64. Dense Units: Dense units define the number of neurons in the densely connected layer of the LSTM model. We conducted the experiment with dense units 32, and 64. Epochs: Epoch is the complete one pass through the entire training dataset. We varied the number of epochs between 5 and 10. Epochs: Epoch is the complete one pass through the entire training dataset. We varied the number of epochs between 5 and 10. LSTM Units: LSTM units determine the number of memory cells in the LSTM layer. We tested LSTM units of 32, 64, and 128. LSTM Units: LSTM units determine the number of memory cells in the LSTM layer. We tested LSTM units of 32, 64, and 128. Sequence Length: Sequence length defines the length of input sequences fed into the LSTM model. We ran the code for sequence lengths of 5 and 10. Sequence Length: Sequence length defines the length of input sequences fed into the LSTM model. We ran the code for sequence lengths of 5 and 10. After running the code for grid search, the best combination of hyperparameters that maximized the performance for our model are given in Table 2. These optimal parameters yield the best results on the performance metrics that were used in the experiment. These values of hyperparameters enhance the predictive capability of our model while avoiding overfitting or underfitting. Hyperparameter tuning was conducted using a grid search strategy, as shown in Table 3. While grid search provides a systematic exploration of parameter combinations, it is computationally expensive, especially when scaling to larger datasets or more complex models. In this study, the parameter space was moderate, making grid search feasible. However, for larger-scale applications, more efficient alternatives such as Bayesian optimization, random search, or adaptive methods could be considered to reduce computational overhead while maintaining optimization quality. Table 2Best parameters for LSTM using grid search.ParameterValueBatch Size32Dense Units32Epochs5LSTM Units32Sequence Length5 Best parameters for LSTM using grid search. Table 3The comparison of grid search optimization vs Bayesian optimization with respect to time and memory.Grid search optimizationBayesian optimizationDatasetAUC scoreTime (in sec.)Time per loopMemory (in KB)AUC scoreTime (in sec.)Time per loopMemory (in KB)Fb-forum0.998217461.021.52110.993513564.8741.0360.865Mit0.98754531.03310.9833469.150.9490.86CollegeMsg0.97920317.321.32310.988516617.660.7720.86Eu-core0.99219680.671.420.90.992815830.70.7120.85Facebook0.968727821.552.10281.040.97918612.11.2031.02Bitcoin0.99829551.012.3631.10.998720316.111.5851.05 The comparison of grid search optimization vs Bayesian optimization with respect to time and memory. Performance analysis In this section, we are going to discuss the detailed comparison and analysis of the proposed SimCom-AN-LSTM framework and the performance of our approach against the similarity-based algorithms using the three evaluation metrics: Area under the ROC curve (AUC), Area under the Precision-Recall curve (AUPR), and average precision. We conduct the evaluation on five well-known social network datasets. ROC curve Figure 5 presents the ROC curves of SimCom-AN-LSTM across 7 datasets. The proposed framework consistently demonstrates superior separation between true positives and false positives, aligning with the high AUC values presented in Table 4. Therefore, SimCom-AN-LSTM achieves optimal performance on dense and well-connected datasets (e.g., MIT, Fb-forum, Bitcoin), the curves demonstrates that little drops in performance for sparser or imbalanced datasets such as CollegeMsg and sx-askubuntu. This highlight that minority link classes remain challenging to predict, reflecting inherent limitations in capturing weak interactions. These insights focus on the importance of further exploring imbalance data methods to improve the proposed model robustness across diverse networks. Illustration of ROC curve of SimCom-AN-LSTM over various datasets. Table 4Performance of individual feature-based link prediction algorithms and SimCom-AN-LSTM on 7 datasets on AUC.DatasetRatioJCAACNPANLCCCLPCOSPSPL3LOCALRAACTMFILGBMT-GCNSimComPATHAN-LSTMMit0.10.8540.8560.8550.8220.8720.8580.880.8420.8460.8420.8630.8380.8550.9520.90.9860.20.8460.8520.8490.8180.8690.8490.870.8380.8430.8360.8540.8310.8480.9480.80.9870.30.8340.8420.8390.8140.8610.8410.8580.8340.8280.8340.8460.8230.8420.9470.80.987Fb-forum0.10.6510.690.0070.8270.7060.6940.650.658490.4720.8140.681870.6860.6960.9520.70.99280.20.6430.6730.0120.8250.6840.6760.6420.654850.4770.8080.723120.6610.6780.9510.50.99820.30.6320.6550.0170.8210.6590.6540.6310.64370.4830.8020.698230.6360.6580.9510.50.9982Radoslaw-email0.10.8550.9120.910.9070.9240.9120.8760.790.9080.9110.9180.8980.9120.9130.90.9130.20.8490.9090.9070.9050.9210.910.8640.7960.90.9090.9150.8920.9070.9120.80.9250.30.8390.9060.9020.9040.9190.9070.850.7990.8790.9070.910.890.9020.9170.80.925Eu-core0.10.9290.9440.9380.8590.9460.9440.9340.8820.8360.9250.9480.9230.9370.9800.70.9910.20.9230.9390.9340.860.9420.940.9270.8830.7750.9240.9430.9190.9330.9900.60.9910.30.9150.9320.9270.8580.9360.9330.9180.8820.6840.9230.9350.9120.9260.9900.60.992CollegeMsg0.10.9290.9440.9380.8590.9460.9440.9340.8890.8360.180.652280.737510.82930.9670.60.9750.20.9230.9390.9340.860.9420.940.9270.8870.7750.330.656430.752730.83440.9660.50.9790.30.9150.9320.9270.8580.9360.9330.9180.8850.6840.450.660.764740.860.9660.50.979sx-askubuntu0.10.5650.7880.870.810.8580.9410.8360.9210.7650.5650.6480.7980.980.75890.90.96870.20.5410.7320.8610.780.8230.930.8210.9190.740.5310.5810.7910.9760.75810.90.9670.30.4680.6510.8580.7330.7760.930.8010.90.7110.5270.580.780.9750.75810.80.96Bitcoin0.10.75660.86850.90160.69850.63410.9020.88080.76540.89750.86480.69260.56610.56070.82840.70.99870.20.7540.83450.90.68640.61590.87860.870.72650.88660.8560.67530.53490.53970.82620.60.99810.30.71660.80450.8970.64680.60330.86180.86670.72190.8850.83840.64490.50290.53390.82590.60.998Significant values are in bold. Performance of individual feature-based link prediction algorithms and SimCom-AN-LSTM on 7 datasets on AUC. Significant values are in bold. AUC The AUC metric evaluates the ability of the model to distinguish between positive and negative links. Higher AUC values indicate better performance, with 1 indicating perfect discrimination between positive and negative links and 0.5 indicating random guessing. Table 4 shows the performance of state-of-the-art algorithms and SimCom-AN-LSTM on the performance metric AUC. Table 4 clearly shows that the SimCom-AN-LSTM framework consistently achieves higher AUC scores as compared to similarity-based algorithms across all datasets. Specifically for the Mit dataset, the SimCom-AN-LSTM framework achieves an AUC value of 0.987 which significantly outperforms the similarity-based algorithm COSP which gives an AUC of 0.88. In dataset Fb-forum, the AUC value for SimCom-AN-LSTM is 0.9982, compared to 0.827 for PA which is the highest in the state-of-the-art algorithm. For the dataset, Radoslaw-email, SimCom-AN-LSTM achieves 0.925 while the similarity-based algorithm RA scores 0.948. In eu-core, the AUC is 0.992 for SimCom-AN-LSTM and 0.948 for RA. In CollegeMsg, SimCom-AN-LSTM score 0.979 whereas NLC scores 0.9446. Similarly, our method performs better than compared method with AUC score 998 in Bitcoin dataset. However, in sx-askubuntu dataset, SimCom-AN-LSTM is second best method with AUC score 0.967 compared to best method MFI score 0.976. These results indicate that the attention-enhanced LSTM model effectively captures the complex temporal dynamics and structural features of the social networks, leading to superior performance in link prediction. The consistent improvement in the AUC scores across all datasets demonstrates the robustness and reliability of the SimCom-AN-LSTM framework. AUPR The AUPR metric is particularly useful for evaluating performance in imbalanced datasets, where the number of positive links is much smaller than the number of negative links. A higher AUPR indicates better performance in identifying true positive links while maintaining a low false positive rate. According to Table 5, the SimCom-AN-LSTM framework outperforms the similarity-based algorithms in terms of AUOR across all datasets. For instance, in the dataset, Mit SimCom-AN-LSTM achieves AUPR values of 0.9716, while the similarity-based algorithm NLC gives the highest accuracy of 0.793 among all the traditional algorithms. In the Fb-forum dataset, SimCom-AN-LSTM achieves an AUPR score of 0.73, while the highest-performing similarity-based algorithm, SP, achieves an AUPR value of 0.521. For the Radoslaw-email dataset, the AUPR for SimCom-AN-LSTM is 0.625, compared to 0.49 for AA. In Eu-core SimCom-AN-LSTM achieves an AUPR value of 0.978 which is significantly higher than 0.236 for AA. In the dataset, CollegeMsg, the AUPR is 0.81, while it is 0.29 for the similarity-based method LP. Similarly, our method performs better than compared method with AUPR score 0.8135 and 0.565 in Bitcoin and sx-askubuntu datasets respectively. The results highlight the effectiveness of the SimCom-AN-LSTM framework in maintaining high precision and recall. The attention mechanism within the LSTM model allows it to prioritize the most relevant features, leading to better identification of the positive links and minimizing the false positives. Table 5Performance of individual feature-based link prediction algorithms and SimCom-AN-LSTM on 7 datasets on AUPR.DatasetRatioJCAACNPANLCCCLPCOSPSPL3LOCALRAACTMFILGBMT-GCNSimComPATHAN-LSTMMit0.10.3760.4210.4220.4430.6030.4310.5910.4560.4160.4570.4220.4310.4220.90950.80.97160.20.5130.5560.5520.5740.6960.5560.6740.5830.5480.580.5530.5520.5520.90840.50.97360.30.5820.6190.6160.6430.7390.6230.7080.6460.6050.6460.6220.6150.6190.90840.50.9782Fb-forum0.10.0030.0060.0070.0120.010.0070.0030.340.420.0110.0770.0080.0070.5640.50.710.20.0060.0120.0120.0240.0180.0130.0060.4560.440.020.1280.0150.0130.5830.50.7290.30.0090.0170.0170.0340.0240.0180.0090.5210.450.0280.1580.0210.0190.6020.50.73Radoslaw-email0.10.1410.2970.2960.3480.4360.3040.1930.0970.2860.3320.3030.3130.2990.5530.50.6250.20.2250.4220.4160.4620.5380.4270.2750.1780.3930.4550.4320.420.4130.5280.40.6250.30.2750.490.4790.5340.5980.4930.3130.2440.4460.520.5010.4840.4770.5270.40.613Eu-core0.10.0770.1120.1020.0470.1760.120.0970.030.1010.0840.1290.0890.1010.600.50.6780.20.1280.1850.170.0850.2640.1990.1470.0590.1590.1430.2080.150.1690.6120.30.6710.30.1580.2360.2180.1170.3180.2510.1710.0840.1840.1910.2580.1930.2160.6130.30.66CollegeMsg0.10.0020.0070.0070.0150.0160.0090.0020.0160.0110.2950.1740.4190.120.6060.60.7690.20.0040.0130.0120.0290.0280.0170.0040.0280.0220.290.2910.4220.1260.6140.50.8010.30.0070.0190.0170.0420.0360.0230.0070.0360.0350.222850.380.4250.130.6160.50.81sx-askubuntu0.10.1210.320.3650.130.42720.2670.3910.1360.2240.1410.4690.38250.2160.5230.40.5650.20.1120.3180.34510.1180.4240.250.38760.1310.2210.1240.4620.38110.21590.5050.40.5440.30.110.3150.340.11760.4110.2510.38510.12890.2220.120.4620.38070.2140.5050.30.532Bitcoin0.10.19170.01770.48870.36150.21350.0580.28080.0960.23770.11290.36010.23680.30130.4560.30.81350.20.14430.01640.4670.340.2240.054110.25620.0910.23210.10120.35950.20970.28130.4330.20.80530.30.11260.0150.45040.31730.23220.540.21470.09020.21140.110.3540.20780.280.4260.20.8074Significant values are in bold. Performance of individual feature-based link prediction algorithms and SimCom-AN-LSTM on 7 datasets on AUPR. Significant values are in bold. Average precision Average precision provides a single-valued summary of the precision-recall curve, accounting for all precision-recall pairs. It is a crucial metric for evaluating model performance in scenarios with imbalanced datasets. Table 6 indicates that the SimCom-AN-LSTM framework achieves higher average precision scores than the similarity-based algorithms. In the Mit dataset, the average precision value for SimCom-AN-LSTM is 0.736, while it is 0.739 for NLC. In the Fab-forum dataset, SimCom-AN-LSTM achieves an average precision of 0.84, which is significantly higher than the 0.26 achieved by L3, which is the highest in state-of-the-art algorithms. For the Radoslaw-email dataset, the average precision is 0.6505 for SimCom-AN-LSTM, whereas it is 0.598 for NLC. In the Eu-core dataset, the average precision value for SimCom-AN-LSTM is 0.491, while it is 0.258 for RA. The CollegeMsg dataset scores an average precision of 0.557 for SimCom-AN-LSTM and 0.419 for the similarity-based approach, NLC. Similarly, our method performs better than compared method with precision score 0.825 and 0.78 in Bitcoin and sx-askubuntu datasets respectively. The SimCom-AN-LSTM’s higher average precision scores demonstrate its effectiveness in identifying true positive links across various recall levels. This is particularly important in social network analysis, where correctly identifying connections is critical for understanding network structures and dynamics. Table 6Performance of individual feature-based link prediction algorithms and SimCom-AN-LSTM on 7 datasets on Average Precision.DatasetRatioJCAACNPANLCCCLPCOSPSPL3LOCALRAACTMFILGBMT-GCNSimComPATHAN-LSTMMit0.10.3780.4230.4220.4460.6040.4330.5910.4590.4180.460.4250.4330.4230.7150.70.7260.20.5140.5580.5510.5750.6960.5570.6740.5840.5480.5810.5550.5530.5520.7060.50.7320.30.5820.620.6140.6430.7390.6240.7090.6470.6040.6470.6230.6160.620.7050.50.736Fb-forum0.10.0030.0060.0050.0130.010.0070.0030.0990.2360.0110.1130.0080.0070.76140.40.81320.20.0050.0110.010.0240.0170.0120.0050.1640.250.020.1850.0130.0120.76100.20.82440.30.0070.0150.0130.0340.0210.0160.0070.2080.260.0270.2360.0170.0170.75950.20.84Radoslaw-email0.10.1410.2990.2920.350.4370.3060.1950.0970.2860.3340.3050.3140.30.5670.50.63130.20.2250.4230.4090.4630.5380.4280.2760.1780.3930.4560.4330.420.4140.5630.40.64220.30.2750.4910.4690.5340.5980.4940.3130.2440.4420.520.5020.4840.4770.5710.30.6505Eu-core0.10.0770.1130.0990.0470.1770.120.0970.030.2360.0840.1290.0890.1010.30.10.490.20.1280.1850.1640.0860.2640.1990.1470.0590.250.1430.2080.150.1680.30.10.490.30.1580.2360.2080.1170.3180.250.1710.0840.260.1910.2580.1930.2150.30.10.491CollegeMsg0.10.0020.0070.0060.0150.0160.0090.0020.0160.0020.190.1750.2030.190.4520.20.5530.20.0030.0120.010.0290.0270.0160.0030.0270.0030.330.2910.3310.330.4630.10.5560.30.0050.0170.0140.0420.0340.0210.0050.0340.0030.440.380.4190.440.4660.10.557sx-askubuntu0.10.460.3590.0320.710.1970.06570.04270.57750.3820.4060.56220.012140.5450.6940.60.780.20.4410.34780.025670.61050.1830.06470.03890.5740.3750.40420.56170.0121320.54230.6950.60.77860.30.3850.340.02310.6110.0180.06010.03880.5710.3250.4020.56110.01210.5410.7060.60.778Bitcoin0.10.04160.27130.19860.41880.21820.57750.97830.43530.3570.06650.40870.11720.63460.6470.70.8250.20.0270.25030.15330.40910.19840.51440.9530.41430.33290.064050.38020.11490.6320.6530.60.8250.30.01930.23970.19690.39340.17270.50750.9150.32830.32640.06330.3780.10880.61450.6880.50.8021Significant values are in bold. Performance of individual feature-based link prediction algorithms and SimCom-AN-LSTM on 7 datasets on Average Precision. Significant values are in bold. We have also compared the proposed method with only similarity-based features (SimOnly-AN-LSTM) and only community-based features (ComOnly-AN-LSTM) aganist the integartion of both features in proposed framework to further validate the benefits of integrating similarity and community features for link prediction. The results are illustrated in Table 7 over various datasets and evaluation metrics. The combined SimCom-AN-LSTM model consistently outperforms both SimOnly-AN-LSTM and ComOnly-AN-LSTM. For example, on the MIT dataset, the comined model achieves an AUC of 0.987, compared to 0.921 (SimOnly) and 0.905 (ComOnly). Similar results are observed for AUPR and Average Precision, highlighting that both feature contribute uniquely to link prediction performance. Table 7Illustration of comparison of proposed model using only similarity features, only community features, and the combination of both features.DatasetSimOnly-AN-LSTMComOnly-AN-LSTMSimCom-AN-LSTMAUCAUPRPrec.AUCAUPRPrec.AUCAUPRPrec.MIT0.9210.8520.7010.9050.8310.6880.9870.9710.736Fb-forum0.9120.6340.7120.8880.6010.6950.9980.7300.840Radoslaw-email0.8940.5810.6120.8760.5520.5980.9250.6250.650Eu-core0.9320.6120.4520.9180.5880.4410.9920.6780.491CollegeMsg0.9010.5230.5010.8850.4980.4870.9790.8100.557sx-askubuntu0.8920.5010.7120.8700.4780.6980.9670.5650.778Bitcoin0.9450.7120.7450.9280.6890.7310.9980.8130.825Significant values are in bold. Illustration of comparison of proposed model using only similarity features, only community features, and the combination of both features. Significant values are in bold. Statistical significance test In this section, we present the significance testing over different parameters based paired (dependent) t-test on AUC score. We compare AUC scores of each algorithm with proposed algorithm SIMCOM-AN-LSTM (control algorithm), for each dataset. Each pair of AUC values consist of one from SIMCOM-AN-LSTM and one from compared algorithms, both measured on the same dataset and split ratio. The paired nature controls for random variability and differences between algorithm performances are not affected by split-to-split variance in the data, since both algorithms see the same train/test sets or folds. This design is more sensitive than treating the results as independent, because the paired samples remove the noise of between split variation. The exact hypothesis used for experiments are as follows. Null hypothesis: The average difference in AUC between the two algorithms is zero (). Null hypothesis: The average difference in AUC between the two algorithms is zero (). Alternative hypothesis: The average difference is not zero (), i.e., one model is better. Alternative hypothesis: The average difference is not zero (), i.e., one model is better. The p-value indicates the probability of observing such a difference (or larger) by random chance under the null hypothesis. Table 8 presents the description of different parameter of t-test based on AUC score. For each dataset and comparison, we have reported both compared algorithms mean and standard deviation, the t-statistic, degrees of freedom (n?1), the p-value, and whether significant at 0.05. If difference is significant, claim a statistically-validated advantage; if not, claim equivalence can’t be rejected at the 0.05 level. Table 8Illustration of t-tests to show statistical significance.DatasetAlgorithmAlgo MeanAlgo StdSIMCOM MeanSIMCOM Stdt-statisticp-valueSignificant?MitJC0.8450.0080.9870-23.34470.00183YesAA0.850.0060.9870-30.99310.001039YesCN0.8480.0070.9870-28.17820.001257YesPA0.8180.0030.9870-64.78670.000238YesNLC0.8670.0050.9870-33.82780.000873YesCCLP0.8490.0070.9870-26.37560.001434YesCOSP0.8690.0090.9870-17.66640.003189YesSP0.8380.0030.9870-57.10440.000307YesCAR0.8390.0080.9870-25.53410.00153YesLOCAL_PATH0.8370.0030.9870-54.73190.000334YesL30.8540.0070.9870-25.41530.001545YesACT0.8310.0060.9870-33.7750.000875YesMFI0.8480.0050.9870-34.11280.000858YesT-GCN0.8330.0470.9870-4.55450.044981YesFb-forumJC0.6420.0080.9960.002-51.08450.000383YesAA0.6730.0140.9960.002-27.98380.001275YesCN0.0120.0040.9960.002-590.60.000003YesPA0.8240.0020.9960.002-53.50670.000349YesNLC0.6830.0190.9960.002-20.86830.002288YesCCLP0.6750.0160.9960.002-24.75990.001627YesCOSP0.6410.0080.9960.002-51.22870.000381YesSP0.6520.0060.9960.002-62.45950.000256YesCAR0.4770.0040.9960.002-259.50.000015YesLOCAL_PATH0.8080.0050.9960.002-37.83520.000698YesL30.7010.0170.9960.002-27.72810.001298YesACT0.6610.020.9960.002-21.09150.00224YesMFI0.6770.0160.9960.002-25.6780.001513YesT-GCN0.5670.0940.9960.002-6.28780.024372YesEu-coreJC0.9220.0060.9910-15.82970.003967YesAA0.9380.0050.9910-13.99920.005064YesCN0.9330.0050.9910-16.53590.003637YesPA0.8590.0010.9910-150.05190.000044YesNLC0.9410.0040.9910-15.55430.004108YesCCLP0.9390.0050.9910-14.83510.004513YesCOSP0.9260.0070.9910-13.17690.00571YesSP0.88200.9910-188.79350.000028YesCAR0.7650.0620.9910-5.08970.036501YesLOCAL_PATH0.9240.0010.9910-76.34880.000172YesL30.9420.0050.9910-12.04410.006823YesACT0.9180.0050.9910-20.7880.002306YesMFI0.9320.0050.9910-16.81940.003516YesT-GCN0.6330.0470.9910-10.68620.008644YesDatasetAlgorithmAlgo MeanAlgo StdSIMCOM MeanSIMCOM Stdt-statisticp-valueSignificant?Radoslaw-emailJC0.8480.0070.9210.006-8.95170.01225YesAA0.9090.0020.9210.006-2.15530.16392NoCN0.9060.0030.9210.006-2.44070.134756NoPA0.9050.0010.9210.006-3.23560.083701NoNLC0.9210.0020.9210.0060.06210.956105NoCCLP0.910.0020.9210.006-2.16340.162978NoCOSP0.8630.0110.9210.006-5.19730.035084YesSP0.7950.0040.9210.006-72.74610.000189YesCAR0.8960.0120.9210.006-2.14020.165691NoLOCAL_PATH0.9090.0020.9210.006-2.38420.139927NoL30.9140.0030.9210.006-1.10940.382787NoACT0.8930.0030.9210.006-4.35040.048988YesMFI0.9070.0040.9210.006-2.10260.170226NoT-GCN0.8330.0470.9210.006-2.34820.143359NoCollegeMsgJC0.9220.0060.9780.002-10.62710.008739YesAA0.9380.0050.9780.002-8.49380.013579YesCN0.9330.0050.9780.002-10.30770.009281YesPA0.8590.0010.9780.002-81.6720.00015YesNLC0.9410.0040.9780.002-8.95970.012229YesCCLP0.9390.0050.9780.002-8.92310.012328YesCOSP0.9260.0070.9780.002-8.87640.012455YesSP0.8870.0020.9780.002-37.71960.000702YesCAR0.7650.0620.9780.002-4.70070.042398YesLOCAL_PATH0.320.110.9780.002-8.55110.013401YesL30.6560.0030.9780.002-241.250.000017YesACT0.7520.0110.9780.002-33.97770.000865YesMFI0.8410.0140.9780.002-15.46340.004156YesT-GCN0.5330.0470.9780.002-12.81730.006032YesDatasetAlgorithmAlgo MeanAlgo StdSIMCOM MeanSIMCOM Stdt-statisticp-valueSignificant?sx-askubuntuJC0.4290.0320.7790.001-15.95540.003905YesAA0.3490.0080.7790.001-87.17010.000132YesCN0.0270.0040.7790.001-361.24910.000008YesPA0.6440.0470.7790.001-4.15370.053364NoNLC0.1330.0810.7790.001-11.34770.007676YesCCLP0.0640.0030.7790.001-536.50.000003YesCOSP0.040.0020.7790.001-837.56930.000001YesSP0.5740.0030.7790.001-140.86130.00005YesCAR0.3610.0250.7790.001-24.0150.001729YesLOCAL_PATH0.4040.0020.7790.001-649.51910.000002YesL30.56200.7790.001-6520.000002YesACT0.01200.7790.001-1328.4830.000001YesMFI0.5430.0020.7790.001-354.50.000008YesT-GCN0.600.7790.001-310.03710.00001YesBitcoinJC0.0290.010.8170.011-157.60.00004YesAA0.2540.0130.8170.011-92.11460.000118YesCN0.1830.0210.8170.011-32.06140.000971YesPA0.4070.0110.8170.011-138.49830.000052YesNLC0.1960.0180.8170.011-88.41410.000128YesCCLP0.5330.0320.8170.011-14.78620.004543YesCOSP0.9490.0260.8170.01111.25710.007799YesSP0.3920.0460.8170.011-16.83910.003508YesCAR0.3390.0130.8170.011-67.84460.000217YesLOCAL_PATH0.0650.0020.8170.011-109.27230.000084YesL30.3890.0140.8170.011-49.53310.000407YesACT0.1140.0030.8170.011-131.17120.000058YesMFI0.6270.0090.8170.011-109.69660.000083YesT-GCN0.60.0820.8170.011-4.24160.051341No Illustration of t-tests to show statistical significance. Conclusion In summary, this study presents a novel approach to link prediction in temporal social networks by proposing the SimCom-AN-LSTM framework. By integrating similarity-based features including local, global, and quasi-local metrics with community detection and an attention-enhanced LSTM model, we capture the complex, evolving dynamics that characterize real-world networks. The inclusion of an attention mechanism allows the model to focus on the most relevant temporal patterns, improving predictive accuracy and adaptability. Experimental results across five diverse social network datasets demonstrate the superior performance of our approach over traditional algorithms in terms of AUC, AUPR, and average precision. These findings highlight not only the potential of hybrid deep learning methods for dynamic network analysis, but also the importance of combining structural and contextual features to enhance link prediction problem. In future work, the framework can be extended to directed and weighted temporal graphs considering real-world networks. Moreover, incorporating multi-relational temporal dynamics will allow the proposed model to address heterogeneous relationships across domains such as citation, biological, and knowledge networks. These extensions would further broaden the applicability and robustness of SimCom-AN-LSTM. Acknowledgements The authors would like to acknowledge that language editing tools (Grammarly and QuillBot) were used to only assist with grammar and spelling refinement during the preparation of this manuscript. Author contributions Rohit Ahuja: Methodology, Validation, Formal Analysis, Investigation, Writing original draft preparation. Simranjit Kaur: Conceptualization, Methodology, Validation, Formal Analysis, Investigation, Writing original draft preparation. Shashank Sheshar Singh: Conceptualization, Methodology, Validation, Formal Analysis, Writing original draft preparation, Writing review and editing. Harish Kumar Shakya: Conceptualization, Methodology, Validation, Formal Analysis, Investigation. Funding Open access funding provided by Manipal University Jaipur. Data Availability The datasets used and/or analysed during the current study available from the corresponding author on request. The code of the proposed method can be found at https://github.com/S03imran/SIMCOM-AN-LSTM Declarations Ethics approval No Human subject or animals are involved in the research. Consent to participate All authors have mutually consented to participate. Consent to publication All the authors have consented the Journal to publish this paper. Competing interests The authors declare no competing interests. Footnotes Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. Contributor Information Harish Kumar Shakya, Email: harish.shakya@jaipur.manipal.edu. Shashank Sheshar Singh, Email: shashank.sheshar@gmail.com. References Associated Data Data Availability Statement The datasets used and/or analysed during the current study available from the corresponding author on request. The code of the proposed method can be found at https://github.com/S03imran/SIMCOM-AN-LSTM