The Weisfeiler-Lehman Isomorphism Test(Weisfeiler-Lehman 同构检验)

2023-11-20 15:20

本文主要是介绍The Weisfeiler-Lehman Isomorphism Test(Weisfeiler-Lehman 同构检验),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

在这里转载只是为了让不能够科学搜索的同学们看到好文章而已,个人无收益只是分享知识(顺手做个记录罢了)

原网址:The Weisfeiler-Lehman Isomorphism Test | David Bieber

Graph Isomorphism

Two graphs are considered isomorphic if there is a mapping between the nodes of the graphs that preserves node adjacencies. That is, a pair of nodes may be connected by an edge in the first graph if and only if the corresponding pair of nodes in the second graph is also connected by an edge in the same way. An example of two isomorphic graphs is shown here.

Example of isomorphic graphs

Figure: Graph 1 and Graph 2 are isomorphic. The correspondance between nodes is illustrated by the node colors and numbers.

In general, determining whether two graphs are isomorphic when the correspondance is not provided is a challenging problem; precisely how hard this problem is remains an open question in computer science. It isn’t known whether there is a polynomial time algorithm for determining whether graphs are isomorphic, and it also isn’t known whether the problem is NP-complete. The graph isomorphism problem may even be an example of an NP-intermediate problem, but this would only be possible if P≠NP.

The Weisfeiler-Lehman Isomorphism Test

Here is the algorithm for the Weisfeiler-Lehman Isomorphism Test. It produces for each graph a canonical form. If the canonical forms of two graphs are not equivalent, then the graphs are definitively not isomorphic. However, it is possible for two non-isomorphic graphs to share a canonical form, so this test alone cannot provide conclusive evidence that two graphs are isomorphic.

The Algorithm:

  • For iteration i of the algorithm we will be assigning to each node a tuple Li,n containing the node’s old compressed label and a multiset of the node’s neighbors' compressed labels. A multiset is a set (a collection of elements where order is not important) where elements may appear multiple times.
  • At each iteration we will additionally be assigning to each node n a new “compressed” label Ci,n for that node’s set of labels. Any two nodes with the same Li,n will get the same compressed label.
  1. To begin, we initialize C0,n=1 for all nodes n.
  2. At iteration i of the algorithm (beginning with i=1), for each node n, we set Li,n to be a tuple containing the node’s old label Ci−1,n and the multiset of compressed node labels Ci−1,m from all nodes m neighboring n from the previous iteration (i−1).
  3. We then complete iteration i by setting Ci,n to be a new “compressed” label, such as a hash of Li,n. Any two nodes with the same labels Li,n must get the same compressed label Ci,n.
  4. Partition the nodes in the graph by their compressed label. Repeat 2 + 3 for up to N (the number of nodes) iterations, or until there is no change in the partition of nodes by compressed label from one iteration to the next.

When using this method to determine graph isomorphism, it may be applied in parallel to the two graphs. The algorithm may be terminated early after iteration i if the sizes of partitions of nodes partitioned by compressed labels diverges between the two graphs; if this is the case, the graphs are not isomorphic.

Example of the Weisfeiler-Lehman Isomorphism Test

We demonstrate here the Weisfeiler-Lehman isomorphism test using the example graphs from above. The graphs are shown again here for completeness.

Two isomorphic graphs are shown.

Figure: Graph 1 and Graph 2 are isomorphic. We will apply the Weisfeiler-Lehman isomorphism test to these graphs as a means of illustrating the test.

To initialize the algorithm (Step 1), we set C0,n=1 for all nodes n.

Initialization: $C\_{0,n} = 1$ for all nodes $n$

For iteration 1, Step 2, we compute L1,n. The first part of a node’s L is the node’s old compressed label; the second part of a node’s L is the multiset of the neighboring nodes' compressed labels.

Iteration 1, Step 2: $L\_{1,n}$

For iteration 1, Step 3, we introduce “compressed” labels C1,n for the nodes:

Iteration 1, Step 3: $C\_{1,n}$

We now begin iteration 2. In iteration 2, Step 2, we compute L2,n:

Iteration 2, Step 2: $L\_{2,n}$

In iteration 2, Step 3, we compute C2,n:

Iteration 2, Step 3: $C\_{2,n}$

In iteration 3, Step 2, we compute L3,n:

Iteration 3, Step 2: $L\_{3,n}$

In iteration 3, Step 3, we compute C3,n:

Iteration 3, Step 3: $C\_{3,n}$

Since the partition of nodes by compressed label has not changed from C2,n to C3,n, we may terminate the algorithm here.

Concretely, the partition of nodes by compressed label may be represented as the number of nodes with each compressed label. That is: “2 7s, 1 8, and 2 9s”. This is the canonical form of our graph. Since both Graph 1 and Graph 2 have this same canonical form, we cannot rule out the possibility that they are isomorphic (they are in fact isomorphic, but the algorithm doesn’t allow us to conclude this definitively.)

Implementation Considerations

One detail omitted is that the algorithm requires canonical forms of the multisets for comparison. Placing the elements of the multiset in sorted order provides one way of doing this.

Additionally, for the representation of the graph that the algorithm emits to be deterministic, we need to establish a convention for creating compressed labels. One possible convention is to use increasing integers starting from 1, and to assign compressed labels to nodes in lexicographical order of their non-compressed labels. Another possible convention is to use the hash of the multiset to create the compressed label.

When comparing the partition of the nodes by compressed label from one iteration to the next to see whether to proceed to another iteration, it is sufficient to compare which nodes are in each partition. If the partitions change, we proceed to the next iteration. If no partition changes, the algorithm can terminate early. When comparing the partitions of the nodes across graphs to see if graphs are isomorphic, we use the canonical form as described above in the algorithm.

Finding the Correspondance Between Isomorphic Graphs

The core idea of the Weisfeiler-Lehman isomorphism test is to find for each node in each graph a signature based on the neighborhood around the node. These signatures can then be used to find the correspondance between nodes in the two graphs, which can be used to check for isomorphism.

In the algorithm descibed above, the “compressed labels” serve as the signatures. Since multiple nodes may have the same compressed label, there are multiple possible correspondances suggested by a Weisfeiler-Lehman labeling. The Weisfeiler-Lehman isomorphism test itself does not provide a way of narrowing down the possible correspondances further.

The Disappearance of Boris Weisfeiler

Boris Weisfeiler – one of the two mathematicians responsible for the Weisfeiler-Lehman isomorphism test – was a professor at Penn State University until he disappeared mysteriously in Chile in 1985. His disappearance in the 80s is unsettling, and I would encourage you to visit boris.weisfeiler.com to learn more about the search for Weisfeiler and the ongoing (2018) judicial proceedings surrounding his disappearance.

Steven List produced an award winning short film called The Colony based on the disappearance of Boris Weisfeiler, available on Vimeo here.

After a brief internet search, I have been unable to find any information about Weisfeiler’s colleague and coauthor A. Lehman, not even a first name. (Update Aug. 2020: A reader pointed me to this recent story about Andrey Leman. Thank you!)

NP-Intermediate Problems

As mentioned in the introduction, it is not known whether the graph isomorphism problem is in P or NP-complete. In fact, it is not even known whether graph isomorphism falls in either of these categories, or whether this problem is NP-intermediate. The problem of factoring integers is another problem like this, where it is unknown whether the problem is in P, NP-complete, or is NP-intermediate. Bear in mind that NP-intermediate problems can only exist if P≠NP. So if anyone were to show conclusively that factoring or graph isomorphism were NP-intermediate they would also have shown P≠NP and won the Clay Institute P vs NP Millenium Problem’s million dollar prize.

Applications of Graph Isomorphisms

Now that you’re familiar with the Weisfeiler-Lehman test for graph isomorphisms, what is the graph isomorphism problem good for?

There are applications of the graph isomorphism problem in, for example, computational chemistry and in circuit design.

In chemistry, it is common to represent a molecule as a graph, with the atoms in the molecule being the nodes of the graph and the bonds between molecules being the edges. Here, the graph isomorphism problem can be used to determine if two chemical structures are in fact the same structure. This is important for drug discovery, where scientists are working to create molecular structures that will be useful in order to fight diseases.

A circuit is commonly represented as a graph as well. The components in the circuit form the nodes of the graph, and the connections between components form the edges. The graph isomorphism problem is useful here for determining whether two circuits that are laid out different are in fact identical.

References

Weisfeiler and Lehman first proposed this method in their paper A reduction of a graph to a canonical form and an algebra arising during this reduction in 1968. An English translation of this paper, originally published in Russian, is available here.

More recently the method is also described succinctly in Weisfeiler-Lehman Graph Kernels (Shervashidze 2011).

这篇关于The Weisfeiler-Lehman Isomorphism Test(Weisfeiler-Lehman 同构检验)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/395574

相关文章

论文翻译:ICLR-2024 PROVING TEST SET CONTAMINATION IN BLACK BOX LANGUAGE MODELS

PROVING TEST SET CONTAMINATION IN BLACK BOX LANGUAGE MODELS https://openreview.net/forum?id=KS8mIvetg2 验证测试集污染在黑盒语言模型中 文章目录 验证测试集污染在黑盒语言模型中摘要1 引言 摘要 大型语言模型是在大量互联网数据上训练的,这引发了人们的担忧和猜测,即它们可能已

Golang test编译使用

创建文件my_test.go package testsimport "testing"func TestMy(t *testing.T) {t.Log("TestMy")} 通常用法: $ go test -v -run TestMy my_test.go=== RUN TestMyTestMy: my_test.go:6: TestMy--- PASS: TestMy (0.

JavaScript正则表达式六大利器:`test`、`exec`、`match`、`matchAll`、`search`与`replace`详解及对比

在JavaScript中,正则表达式(Regular Expression)是一种用于文本搜索、替换、匹配和验证的强大工具。本文将深入解析与正则表达式相关的几个主要执行方法:test、exec、match、matchAll、search和replace,并对它们进行对比,帮助开发者更好地理解这些方法的使用场景和差异。 正则表达式基础 在深入解析方法之前,先简要回顾一下正则表达式的基础知识。正则

2024年高教社杯数学建模国赛最后一步——结果检验-事关最终奖项

2024年国赛已经来到了最后一天,有必要去给大家讲解一下,我们不需要过多的去关注模型的结果,因为模型的结果的分值设定项最多不到20分。但是如果大家真的非常关注的话,那有必要给大家讲解一下论文结果相关的问题。很多的论文,上至国赛优秀论文下至不获奖的论文并不是所有的论文都可以进行完整的复现求解,大部分数模论文都为存在一个灰色地带。         白色地带即认为所有的代码均可运行、公开

mybatis if test 之 0当做参数传入出问题

首先前端传入了参数 if(StringUtils.isNotBlank(status)){requestParam.setProperty("status", Integer.parseInt(status));}List<SuperPojo> applicationList = groupDao.getApplicationListByReviewStatusAndMember(req

js正则表达式test方法的问题

今天在网上碰到一个帖子,写了一个关于Regex的奇怪现象,(文章来源http://www.php100.com/html/webkaifa/javascript/2007/0109/1866.html) 代码如下 <script type="text/javascript"><!--var re = /^\d+(?:\.\d)?$/ig; alert(re.test('112.3'

医院检验系统LIS源码,LIS系统的定义、功能结构以及样本管理的操作流程

本文将对医院检验系统LIS进行介绍,包括LIS系统的定义、功能结构以及样本管理的操作流程方面。 LIS系统定义 LIS系统(Laboratory Information System)是一种专门为临床检验实验室开发的信息管理系统,其主要功能包括实验室信息管理、样本管理、检验结果管理、质量控制管理、数据分析等。其主要作用是管理医院实验室的各项业务,包括样本采集、检验、结果录入和报告生成等。Li

浙大数据结构——03-树1 树的同构

这道题我依然采用STL库的map,从而大幅减少了代码量 简单说一下思路,两棵树是否同构,只需比较俩树字母相同的结点是否同构,即是否左==左,右==右或者左==右,右==左。 1、条件准备 atree和btree是存两个数结点字母,第几个就存输入的第几个结点的字母。 map通过结点的字母作为键,从而找到两个子节点的信息 都要用char类型 #include <iostream>#inc

c:if test=/c:if如何判断空(使用例子)

userName是登录的时候放到session中了 <c:if test="${ not empty userName }">这表示userName判断不为null `<c:if test="${empty userName }"> ` 这表示userName判断为null 使用案例 <c:if test="${ not empty userName }"><ul><li><a

[UVM]6.component driver monitor sequencer agent scoreboard env test

1.知识点回顾 (1)component需要有parent,因为参加构成组件,所以需要(继承); (2)object与component之间间隔report_object。 2.组件家族 (1)构建寄存器模型 :uvm_reg_predictor;激励器:driver/random_stimulus/sequencer_base/sequencer;监测器:monitor;