GRAPEパッケージのインストールと例

目次へ(GAP)

Graph Theory using the GRAPE package

GAP の GRAPE パッケージを利用する例をよく見かける。入力してみるが動かない。パッケージGRAPE をインストールする必要がある。

grape のインストール

/gap4r7/pkg の中に grape のソースは入っている。 ダウンロードする必要はない。

$ cd /gap4r7/pkg/grape
$ ./configure ../..
$ make

これでインストールは終了。

使用法

gap> LoadPackage( "grape" );
─────────────────────────────────────────────────────────────────────────────
Loading  GRAPE 4.6.1 (GRaph Algorithms using PErmutation groups)
by Leonard H. Soicher (http://www.maths.qmul.ac.uk/~leonard/).
Homepage: http://www.maths.qmul.ac.uk/~leonard/grape/
─────────────────────────────────────────────────────────────────────────────
true
gap> IsIsomorphicGraph( JohnsonGraph(7,3), JohnsonGraph(7,4) );
true
gap> Size( AutGroupGraph( JohnsonGraph(4,2) ) ); 
48
gap> quit;

GRAPE (A package of GAP) document に載っている例

$ gap
 ┌───────┐   GAP, Version 4.6.5 of 20-Jul-2013 (free software, GPL)
 │  GAP  │   http://www.gap-system.org
 └───────┘   Architecture: x86_64-pc-linux-gnu-x86_64-linux-gnu-gcc-default64
 Libs used:  gmp, readline
 Loading the library and packages ...
 Components: trans 1.0, prim 2.1, small* 1.0, id* 1.0
 Packages:   AClib 1.2, Alnuth 3.0.0, AtlasRep 1.5.0, AutPGrp 1.6, 
             CRISP 1.3.8, Cryst 4.1.12, CrystCat 1.1.6, CTblLib 1.2.2, 
             FactInt 1.5.3, FGA 1.2.0, GAPDoc 1.5.1, IRREDSOL 1.2.4, 
             Polenta 1.3.2, Polycyclic 2.11, RadiRoot 2.7, Sophus 1.23, 
             SpinSym 1.5, TomLib 1.2.4
 Try '?help' for help. See also  '?copyright' and  '?authors'
gap> RequirePackage("grape");
─────────────────────────────────────────────────────────────────────────────
Loading  GRAPE 4.6.1 (GRaph Algorithms using PErmutation groups)
by Leonard H. Soicher (http://www.maths.qmul.ac.uk/~leonard/).
Homepage: http://www.maths.qmul.ac.uk/~leonard/grape/
─────────────────────────────────────────────────────────────────────────────
true
gap> P := Graph( SymmetricGroup(5), [[1,2]], OnSets,
>       function(x,y) return Intersection(x,y)=[]; end );
rec( adjacencies := [ [ 3, 5, 8 ] ], 
  group := Group([ (1,2,3,5,7)(4,6,8,9,10), (2,4)(6,9)(7,10) ]), 
  isGraph := true, 
  names := [ [ 1, 2 ], [ 2, 3 ], [ 3, 4 ], [ 1, 3 ], [ 4, 5 ], [ 2, 4 ], 
      [ 1, 5 ], [ 3, 5 ], [ 1, 4 ], [ 2, 5 ] ], order := 10, 
  representatives := [ 1 ], schreierVector := [ -1, 1, 1, 2, 1, 1, 1, 1, 2, 2 
     ] )
gap> Diameter(P);
2
gap> Girth(P);
5
gap> EP := EdgeGraph(P);
rec( adjacencies := [ [ 2, 3, 7, 8 ] ], 
  group := Group([ (1,4,7,2,5)(3,6,8,9,12)(10,13,14,15,11), 
      (4,9)(5,11)(6,10)(7,8)(12,15)(13,14) ]), isGraph := true, 
  isSimple := true, 
  names := [ [ [ 1, 2 ], [ 3, 4 ] ], [ [ 1, 2 ], [ 4, 5 ] ], 
      [ [ 1, 2 ], [ 3, 5 ] ], [ [ 2, 3 ], [ 4, 5 ] ], [ [ 2, 3 ], [ 1, 5 ] ], 
      [ [ 2, 3 ], [ 1, 4 ] ], [ [ 3, 4 ], [ 1, 5 ] ], [ [ 3, 4 ], [ 2, 5 ] ], 
      [ [ 1, 3 ], [ 4, 5 ] ], [ [ 1, 3 ], [ 2, 4 ] ], [ [ 1, 3 ], [ 2, 5 ] ], 
      [ [ 2, 4 ], [ 1, 5 ] ], [ [ 2, 4 ], [ 3, 5 ] ], [ [ 3, 5 ], [ 1, 4 ] ], 
      [ [ 1, 4 ], [ 2, 5 ] ] ], order := 15, representatives := [ 1 ], 
  schreierVector := [ -1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 1, 1, 1, 2 ] )
gap> GlobalParameters(EP);
[ [ 0, 0, 4 ], [ 1, 1, 2 ], [ 1, 2, 1 ], [ 4, 0, 0 ] ]
gap> 

Ipython notebook の例

目次へ(GAP)