nip.graph_isomorphism.dataset_generation

nip.graph_isomorphism.dataset_generation#

Functions for generating a dataset of pairs of graphs with WL scores.

The main function is generate_gi_dataset, which generates a dataset of pairs of graphs with WL scores.

Graphs are generated using the Erdős-Rényi model. The dataset is generated in three steps:

  1. Generate prop_non_isomorphic non-isomorphic graphs. The pairs are divided equally between the different graph sizes and edge probabilities. The number of graphs with a score of 1, 2 and greater than 2 are divided according to the proportions non_iso_prop_score_1 and non_iso_prop_score_2.

  2. Generate (1 - prop_non_isomorphic) * iso_prop_from_non_iso isomorphic graphs, by sampling from the non-isomorphic graph pairs and shuffling the nodes.

  3. Generate the remaining (1 - prop_non_isomorphic) * (1 - iso_prop_from_non_iso) isomorphic graphs, by generating new graphs and shuffling the nodes.

Functions

_generate_isomorphic_graphs(config, ...)

Generate isomorphic graphs.

_generate_non_isomorphic_graphs(config, ...)

Generate non-isomorphic graphs.

generate_er_graphs(num_graphs, graph_size, ...)

Generate a batch of Erdős-Rényi graphs.

generate_gi_dataset(config, name[, ...])

Generate a dataset of pairs of graphs with WL scores.

shuffle_adjacencies(adjacencies, sizes)

Shuffle the nodes in a batch of adjacency matrices of varying sizes.

wl_score(adjacency_a, adjacency_b[, ...])

Compute the Weisfeiler-Lehman scores for a batch of graphs.

Classes

GraphIsomorphicDatasetConfig(num_samples, ...)

Configuration for a graph isomorphism dataset.