Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Performance 求GAP中图的所有最大团的有效方法_Performance_Graph Theory_Clique_Clique Problem_Gap System - Fatal编程技术网

Performance 求GAP中图的所有最大团的有效方法

Performance 求GAP中图的所有最大团的有效方法,performance,graph-theory,clique,clique-problem,gap-system,Performance,Graph Theory,Clique,Clique Problem,Gap System,我希望找到所有特殊类型的Cayley图的最大团,称为错乱图。我在GAP工作,目前使用GRAPE软件包建立以下内容: #This is a nice example to work with. grp := PrimitiveGroup(8,2); n := LargestMovedPoint(grp); #The derangement graph of grp derang := []; for x in grp do if NrMovedPoints(x) = n then

我希望找到所有特殊类型的Cayley图的最大团,称为错乱图。我在GAP工作,目前使用GRAPE软件包建立以下内容:

#This is a nice example to work with.
grp := PrimitiveGroup(8,2);
n := LargestMovedPoint(grp);

#The derangement graph of grp
derang := [];
for x in grp do 
    if NrMovedPoints(x) = n then
        AddSet(derang, x);
    fi;
od;

#This uses the GRAPE package.
Cay:=CayleyGraph(grp, derang);

#The following function returns a set of complete subgraphs of Cay (of size n) which are maximal.
#The cliques are returned as vertices of Cay.
max_clique_indices := CompleteSubgraphs(Cay,n,1);

#We convert the vertices of Cay into permutations of grp.
max_clique_perms := [];
for x in max_clique_indices do
    Add(max_clique_perms, Cay.names{x});
od;

#To find all maximum cliques, we perform the following "right translation" action.
#This is where the inefficiency is (I think). We get so many duplicates that must be removed.
maximum_cliques := [];
for x in grp do
    for cl in max_clique_perms do
        Add(maximum_cliques, x*cl);
    od;
od;

maximum_cliques := AsSet(List(maximum_cliques, AsSet));
我已经阅读了很多次GRAPE文档,但是我找不到一个生成所有最大派系的命令。在Sage中,可以调用cliquer命令(),该命令可以相当快速有效地找到所有最大的派系(根据我的经验,对于顺序<3000的组)。GAP中有这样的选择吗

注意:我还尝试使用YAGS软件包来使用“CompletesOfGivenOrder(Cay,n)”命令,但我发现它的速度非常慢。

几句话:

  • 要“找到所有最大派系”(即最大可能大小的派系),您可以要求Grape计算所有最大派系的(G-轨道代表),然后从最大规模的派系中选择一个

  • 您的测试程序在几毫秒内运行,所以我可以提供的任何优化都是假设的;最好知道哪些输入不能在几毫秒内完成

  • 为了测试,我尝试了
    PrimitiveGroup(15,2)
    ;第一个瓶颈是找到最大派系(在那个例子中需要10秒)。这可以通过使用
    有向图
    包(只需200毫秒)来克服。但这是否适合您的情况取决于您感兴趣的实际输入

  • 默认情况下,Grape只返回派系的G轨道的代表;对于Cayley图中的许多问题,处理这些就足够了。由于你没有说你想对这些派系做什么,我不能说在你的案例中是否有这样的方法,但我建议你考虑一下这种可能性,因为这将是(如果可能的话)迄今为止最有效的方法

  • 您确定为低效的位基本上是执行轨道枚举,但实际上是以一种非常低效的方式执行的。要解决这个问题,只需使用GAP丰富的动态观察功能即可

这是您的程序的一个修改版本,它计算所有最大派系。它在我的计算机上运行几毫秒,但当然,对于较大的输入,速度会慢得多

LoadPackage("grape");

grp := PrimitiveGroup(8,2);
n := LargestMovedPoint(grp);

# the derangement graph of grp; this uses the GRAPE package
Cay := CayleyGraph(grp, Filtered(grp, x -> NrMovedPoints(x) = n));

# compute a set of maximal cliques in Cay which is guaranteed to contain
# at least one representative from each orbit of maximal cliques;
# returned as lists of indices into Cay
max_clique_indices := CompleteSubgraphs(Cay,-1,1);

# compute the size of maximum clique
msize := Maximum(List(max_clique_indices, Length));

# discard all cliques which are not maximum
max_clique_indices:=Filtered(max_clique_indices, c -> Length(c) = msize);

# convert the vertices of Cay into permutations of grp.
max_clique_perms := List(max_clique_indices, i->AsSet(Cay.names{i}));

# we want all maximum cliques, so compute the orbits of the orbit representatives;
# we act on sets by right multiplication
maximum_clique_orbs := Orbits(grp, max_clique_perms, {set,perm} -> AsSet(set*perm));

# finally merge all the orbits into one
maximum_cliques := Concatenation(maximum_clique_orbs);
你也可以试试有向图;如上所述计算Cay,然后按如下方式进行:

LoadPackage("digraph");
dig:=Digraph(Cay);
max_clique_indices := DigraphMaximalCliquesReps(dig);
msize := Maximum(List(max_clique_indices, Length));
max_clique_indices:=Filtered(max_clique_indices, c -> Length(c) = msize);
maximum_clique_orbs := Orbits(AutomorphismGroup(dig), max_clique_indices, OnSets);
maximum_cliques := List(Union(maximum_clique_orbs), i->AsSet(Cay.names{i}));

反应很好!从文档中我永远无法理解GAP的“轨道”函数。我仍然有点不确定:当你定义“最大团球”时,我们有{set,perm};set是grp的元素,perm是max\U clique\U perms的元素吗?我目前正在用我的旧方法对这两种新方法进行基准测试——新方法已经快多了,而且RAM占用更少。按照从简单到困难的顺序,我用来测试的基本组(n,k)是:(8,2),(16,15),(16,13)和(16,14)。最后一个是很难与我原来的方法-你是一个巨大的进步!符号
{a,b}->…
函数(a,b)返回。。。;结束
;在这里,该函数用于定义(右)动作,如第41章“团体动作”中所述;也就是说,第二个(右)论点是表演团体的一个元素,我们对第一个论点在第二个论点作用下的形象感兴趣