40
Fast Generation of Cubic Graphs Gunnar Brinkmann and Jan Goedgebeur [email protected] [email protected] Faculty of Science

Fast Generation of Cubic Graphs - Universiteit Gent

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Fast Generation of Cubic Graphs - Universiteit Gent

Fast Generation of

Cubic Graphs

Gunnar Brinkmann and Jan Goedgebeur

[email protected]

[email protected]

Faculty of Science

Page 2: Fast Generation of Cubic Graphs - Universiteit Gent

Cubic graphs are graphs where every vertex

has degree 3 (3 edges meet in every

vertex).

Faculty of Science

Page 3: Fast Generation of Cubic Graphs - Universiteit Gent

They are very interesting in chemistry as

models of molecules (vertices are e.g.

Carbon atoms as in fullerenes)

They are very interesting in mathematics

(for a lot of conjectures smallest possible

counterexamples are cubic graphs)

Faculty of Science

Page 4: Fast Generation of Cubic Graphs - Universiteit Gent

Enumeration of cubic graphs

1889 De Vries – up to 10 vertices

1966/67 Balaban – up to 12 vertices

(computer)

1968 Bussemaker, Seidel – up to 10 vertices

(by hand)

1971 Imrich – up to 10 vertices (by hand)

Page 5: Fast Generation of Cubic Graphs - Universiteit Gent

1974 A.L. Petrenjuk, A.W. Petrenjuk

– up to 12 vertices

1976 Bussemaker, Cobeljic, Cvetkovic,

Seidel – up to 14 vertices

1976 Faradzev – up to 18 vertices

1985 McKay, Royle – up to 20 vertices

Page 6: Fast Generation of Cubic Graphs - Universiteit Gent

1992 Brinkmann – up to 24 vertices

(In the meantime the same program –

minibaum – has been used up to

30 vertices, that are 845.480.228.069 graphs.)

1999 Meringer – general regular graphs gen-

erator – faster for small vertex numbers,

slower for large vertex numbers.

2000 McKay, Sanjmyatav – fast specialized

algorithm, but was never released

Faculty of Science

Page 7: Fast Generation of Cubic Graphs - Universiteit Gent

The following algorithm is faster than any

previously developed algorithm.

It uses a construction that is folklore (and

was already used by De Vries and McKay,

Sanjmyatav), some standard isomorphism

rejection techniques (McKay’s canonical

construction path method), well known

efficient datastructures. . .

. . . plus one simple new idea.

Faculty of Science

Page 8: Fast Generation of Cubic Graphs - Universiteit Gent

The generation algorithm consists of

2 steps:

Tetrahedron

Prime graphs

All (remaining) cubic graphs

Faculty of Science

Page 9: Fast Generation of Cubic Graphs - Universiteit Gent

Operations of De Vries (1889)

Start from the tetrahedron. . .

(1)

(2)(3)

can be thesame

Page 10: Fast Generation of Cubic Graphs - Universiteit Gent

Small modification

(3)

can be thesame

(1)

(2)(2a)

Faculty of Science

Page 11: Fast Generation of Cubic Graphs - Universiteit Gent

Operations to generate . . .

(2)(2a)

(1)

prime graphs remaining cubic graphs

(3)

can be thesame

Faculty of Science

Page 12: Fast Generation of Cubic Graphs - Universiteit Gent

Now first only the operations (1),(2),(2a)can be applied – and operation (3) last.

So we first generate all graphs of the form

Faculty of Science

Page 13: Fast Generation of Cubic Graphs - Universiteit Gent

. . . these are the prime graphs.

There are relatively few prime graphs – for

26 vertices 0.0000025% of all graphs – and

the rate is decreasing fast.

So for this part of the generation,

efficiency is not the issue.

Faculty of Science

Page 14: Fast Generation of Cubic Graphs - Universiteit Gent

Generation of remaining cubicgraphs

The following operation remains(and completely determines the efficiency):

can be the

same

Faculty of Science

Page 15: Fast Generation of Cubic Graphs - Universiteit Gent

Isomorphism rejection (McKay’s

canonical construction path method)

• Assign a unique inverse operation for

every graph (except the prime graphs) to

obtain an ancestor.

• Make sure that from the same graph you

don’t obtain the same ancestor twice in

the same way.

Faculty of Science

Page 16: Fast Generation of Cubic Graphs - Universiteit Gent

• Assign a unique inverse operation for

every graph (except the startgraphs) to

obtain an ancestor:

Assign up to isomorphism an edge that

must be removed (i.e. the canonical edge).

First use some cheap criteria and only in

case these don’t help use nauty to compute

a canonical form.

Faculty of Science

Page 17: Fast Generation of Cubic Graphs - Universiteit Gent

Cheap criterion to determine thecanonical edge

E.g.: first choose the removable edges thathave as few as possible vertices at

distance at most 2.

Faculty of Science

Page 18: Fast Generation of Cubic Graphs - Universiteit Gent

Cheap criterion to determine thecanonical edge

E.g.: first choose the removable edges thathave as few as possible vertices at

distance at most 2.

Faculty of Science

Page 19: Fast Generation of Cubic Graphs - Universiteit Gent

Cheap criterion to determine thecanonical edge

E.g.: first choose the removable edges thathave as few as possible vertices at

distance at most 2.

8

Faculty of Science

Page 20: Fast Generation of Cubic Graphs - Universiteit Gent

Cheap criterion to determine thecanonical edge

E.g.: first choose the removable edges that

have as few as possible vertices at

distance at most 2.

8

9

9

9

Faculty of Science

Page 21: Fast Generation of Cubic Graphs - Universiteit Gent

• Make sure that from the same graph you

don’t obtain the same ancestor twice in

the same way:

Approximately: Compute the orbits of the

automorphism group on the pairs of edges

that can be chosen for extension.

Faculty of Science

Page 22: Fast Generation of Cubic Graphs - Universiteit Gent

The red pair and the green pair (and lots of

others) give the same result.

Faculty of Science

Page 23: Fast Generation of Cubic Graphs - Universiteit Gent

So the rough pseudocode is

recursion(n) {// check canonicity of last operation// this may require to compute the groupif (canonical) {

if (n=wanted number of vertices)write up

else {// compute possible extensionscompute group // if not yet knowncompute equivalence classes (needs group)for each class choose extension i {

// choose extension iextend(i)recursion(n+1)

}}

}}

Page 24: Fast Generation of Cubic Graphs - Universiteit Gent

Just applying this (with some technical

optimizations and a good implementation)

already gives an algorithm that works quite

well!

This is (more or less) the way the program

of McKay and Sanjmyatav works.

Faculty of Science

Page 25: Fast Generation of Cubic Graphs - Universiteit Gent

Expensive parts are

• determining whether the last operation

was canonical

• computing the symmetry group

Faculty of Science

Page 26: Fast Generation of Cubic Graphs - Universiteit Gent

Around 80% of the graphs have triangles –

if this part could be optimized. . .

=

Faculty of Science

Page 27: Fast Generation of Cubic Graphs - Universiteit Gent

Simple new idea

Reduction: (determine ancestor)

Collapse all independent triangles (trianglesthat don’t share an edge with other

triangles) to a point –alltogether in one operation.

well . . . cheating a little bit. . .

Faculty of Science

Page 28: Fast Generation of Cubic Graphs - Universiteit Gent

The inverse operation:

Compute orbits of sets of vertices so that

each triangle contains at least one. Blow

these vertices up – no canonicity check.

And no non-canonical graphs!

Faculty of Science

Page 29: Fast Generation of Cubic Graphs - Universiteit Gent

26 vertices

graphs with 0 triangles: 20.66%

graphs with 1 triangles: 32.45%

graphs with 2 triangles: 25.72%

graphs with 3 triangles: 13.59%

graphs with 4 triangles: 5.36%

graphs with 5 triangles: 1.66%

graphs with 6 triangles: 0.42%

graphs with 7 triangles: 0.08%

etc.

Faculty of Science

Page 30: Fast Generation of Cubic Graphs - Universiteit Gent

Expensive parts are

• determining whether the last operation

was canonical

• computing the symmetry group

Faculty of Science

Page 31: Fast Generation of Cubic Graphs - Universiteit Gent

Adding an edge can change the group

dramatically – the group can get larger

and can get smaller.

Faculty of Science

Page 32: Fast Generation of Cubic Graphs - Universiteit Gent

So in case of adding an edge no

information about the group can be reused.

Faculty of Science

Page 33: Fast Generation of Cubic Graphs - Universiteit Gent

Blowing up vertices to (all) triangles leads

to subgroups (in a certain sense. . . ).

A lot of information about the group can

be reused to speed up the computation of

the group – and in case of a trivial group

we know that the group after the

construction is trivial too!

Faculty of Science

Page 34: Fast Generation of Cubic Graphs - Universiteit Gent

Faculty of Science

Page 35: Fast Generation of Cubic Graphs - Universiteit Gent

Combined with look ahead for small cycles:

graphs with girth 4 or 5 can be generated

efficiently!

Ongoing work: similar principle of

simultaneaous blow up for 4-gons.

Faculty of Science

Page 36: Fast Generation of Cubic Graphs - Universiteit Gent

Results: (Intel 64bit 2.33 GHz)

20 vertices: 80.000 graphs/sec 510.489 graphs

22 vertices: 88.000 graphs/sec 7.319.447 graphs

24 vertices: 93.000 graphs/sec 117.940.535 graphs

26 vertices: 95.000 graphs/sec 2.094.480.864 graphs

Speedup 3.76 to 3.3 compared to

minibaum.

Faculty of Science

Page 37: Fast Generation of Cubic Graphs - Universiteit Gent

But well, . . . in principle minibaum was fast

enough.

Everything you wanted to do with the

graphs took longer than the generation. . .

Faculty of Science

Page 38: Fast Generation of Cubic Graphs - Universiteit Gent

So it is partly record hunting,

but the most important reason for the

development of the new generator is the

efficient generation of the subclass known

as Snarks.

Faculty of Science

Page 39: Fast Generation of Cubic Graphs - Universiteit Gent

There are only very few Snarks among the

cubic graphs

This construction method allows early

detection of a lot of non-Snarks, so it is

much faster than just applying a filter.

Faculty of Science

Page 40: Fast Generation of Cubic Graphs - Universiteit Gent

Thanks for your attention

Faculty of Science