如果您从 R 中使用 igraph,请使用此选项
canonical_permutation {igraph} | R 文档 |
规范排列将每个同构图转换为相同的(标记)图。
canonical_permutation(
graph,
colors,
sh = c("fm", "f", "fs", "fl", "flm", "fsm")
)
图 |
输入图,视为无向图。 |
colors |
图中各个顶点的颜色;只有颜色相同的顶点才允许在自同构中相互匹配。 如果省略,igraph 将使用顶点的 |
sh |
用于 BLISS 算法的启发式类型。 有关可能的值,请参见详细信息。 |
canonical_permutation
计算一个排列,该排列将图带入规范形式,由 BLISS 算法定义。 所有同构图都具有相同的规范形式。
有关 BLISS 的详细信息,请参见下面的论文。 此信息以及更多信息可在 http://www.tcs.hut.fi/Software/bliss/index.html 中找到。
sh
参数的可能值为
第一个非单例单元格。
第一个最大的非单例单元格。
第一个最小的非单例单元格。
第一个最大非平凡连接的非单例单元格。
最大非平凡连接的非单例单元格。
最小最大非平凡连接的非单例单元格。
有关这些的详细信息,请参见参考文献中的论文。
具有以下成员的列表
labeling |
将输入图带入规范形式的规范排列。 一个数字向量,第一个元素是顶点 0 的新标签,第二个元素是顶点 1 的新标签,等等。 |
info |
有关 BLISS 计算的一些信息。 一个命名的列表,包含以下成员
|
Tommi Junttila 用于 BLISS,Gabor Csardi csardi.gabor@gmail.com 用于 igraph 和 R 接口。
Tommi Junttila 和 Petteri Kaski:Engineering an Efficient Canonical Labeling Tool for Large and Sparse Graphs, Proceedings of the Ninth Workshop on Algorithm Engineering and Experiments and the Fourth Workshop on Analytic Algorithms and Combinatorics. 2007.
permute
用于将排列应用于图,graph.isomorphic
用于确定图同构,可能基于规范标签。
## Calculate the canonical form of a random graph
g1 <- sample_gnm(10, 20)
cp1 <- canonical_permutation(g1)
cf1 <- permute(g1, cp1$labeling)
## Do the same with a random permutation of it
g2 <- permute(g1, sample(vcount(g1)))
cp2 <- canonical_permutation(g2)
cf2 <- permute(g2, cp2$labeling)
## Check that they are the same
el1 <- as_edgelist(cf1)
el2 <- as_edgelist(cf2)
el1 <- el1[ order(el1[,1], el1[,2]), ]
el2 <- el2[ order(el2[,1], el2[,2]), ]
all(el1 == el2)