nip.graph_isomorphism.dataset_generation.wl_score#
- nip.graph_isomorphism.dataset_generation.wl_score(adjacency_a: Int32[Tensor, 'batch node1 node2'], adjacency_b: Int32[Tensor, 'batch node1 node2'], max_iterations: int = 5, hash_size: int = 16777215, device: device | str | int | None = None) Int32[Tensor, 'batch'] [source]#
Compute the Weisfeiler-Lehman scores for a batch of graphs.
The score is the number of rounds of the Weisfeiler-Lehman algorithm required to determine that the graphs are not isomorphic. If the graphs are isomorphic, the score is -1.
- Parameters:
adjacency_a (Int32[Tensor, "batch node1 node2"]) – The batch of adjacency matrices for the first graph.
adjacency_b (Int32[Tensor, "batch node1 node2"]) – The batch of adjacency matrices for the second graph.
max_iterations (int, default=5) – The maximum number of iterations of the Weisfeiler-Lehman algorithm to run.
hash_size (int, default=2**24 - 1) – The size of the hash table used to store the hashes of the graphs.
device (TorchDevice, optional) – The device to use for the computation. If not given, defaults to the device of
adjacency_a
.
- Returns:
scores (Int32[Tensor, “batch”]) – The Weisfeiler-Lehman scores for each graph in the batch.