PlanetAlign.utils

Anchor Preprocessing and Utility Functions

get_anchor_pairs

Get anchor node pairs between two graphs identified by gid1 and gid2.

get_pairwise_anchor_pairs

Get anchor node pairs for all pairs of graphs.

get_anchor_embeddings

Generate one-hot anchor embeddings for nodes in a graph based on given anchor nodes.

get_rwr_embeddings

Compute Random Walk with Restart (RWR) embeddings for nodes in a graph based on given anchor nodes.

merge_pyg_graphs_on_anchors

Merge multiple PyG graphs into a single graph based on anchor links.

infer_anchors_from_degree

Infer anchor node pairs based on degree similarity.

infer_anchors_from_attributes

Infer anchor node pairs based on attribute similarity.

Noise Injection

add_edge_noises

Add structural noise to graphs in a PlanetAlign dataset by perturbing edges.

add_attr_noises

Add attribute noise to graphs in a PlanetAlign dataset by perturbing node attributes.

add_sup_noises

Add supervision noise to graphs in a PlanetAlign dataset by injecting noisy anchors.

Visualization Functions

plot_alignment_matrix

Visualize an alignment matrix as a heatmap.

plot_alignment_matrix_topk

Visualizes an alignment matrix as a scatter plot of the top-k largest entries.