This repository contains the official implementation for the paper: COCO: A Cohesiveness-aware Learning Framework for Community Search over Temporal Graphs.
COCO is a cohesiveness-aware learning framework designed for community search over temporal graphs. It seamlessly integrates the classical 𝑘-core decomposition with Graph Neural Networks (GNNs). The framework addresses the temporal interval community search problem through a three-stage process: pre-training, query-driven fine-tuning, and community search.
The end-to-end workflow consists of data preprocessing, model pre-training, and query execution.
-
Download Datasets: Obtain raw temporal graph data from public repositories such as SNAP and KONECT and place them in the
datasets/directory. -
Process Graph Data: Execute the script to convert the raw graph into the required format.
python process_graph.py
- Output:
datasets/<dataset_name>.txt
- Output:
-
Perform Core Decomposition: Run the decomposition script to generate the core number file.
python decomposition.py
- Output:
datasets/<dataset_name>-core_number.txt
- Output:
-
Train HM-Index (MLP Models): Train the MLP models that constitute the Cohesiveness Prediction Index.
python MLP.py
- Output: Trained models saved in
models/<dataset_name>/
- Output: Trained models saved in
-
Pre-train the Main GNN Model: Run the main training script to pre-train the primary graph model.
python main.py
- Output: Pre-trained model weights saved in the
./directory.
- Output: Pre-trained model weights saved in the
Perform query-driven fine-tuning on the pre-trained model, and then use the fine-tuned model for search.
python single_query.py data_loader.py: Reads datasets and constructs Graph objects.extract_subgraph.py: Handles subgraph sampling and training tuple generation.loss.py: Defines loss functions for model training.model.py: Defines the AT-GNN and Adapter models.MLP_models.py: Defines the series of MLP models for the HM-Index.train.py: Implements model training and validation routines.utils.py: Contains various utility functions.
process_graph.py: Preprocesses raw graph data.decomposition.py: Performs k-core decomposition on a graph.MLP.py: Trains the HM-Index models.main.py: Pre-trains the main GNN model.single_query.py: Executes a fine-tuning and community search task for a given query.MLP_search.py: Utility script for analyzing HM-Index prediction targets.