### Sakallah

```Saucy3: Fast Symmetry
Discovery in Graphs
Karem A. Sakallah
Igor L. Markov
The University of Michigan
Outline








2
Graph symmetry
Implicit representation of permutation sets:
Ordered Partition Pairs (OPPs)
Basic permutation search tree
Pruning via partition refinement:
– Non-isomorphic OPP pruning
– Matching OPP pruning
Group-theoretic pruning:
– Coset pruning
– Orbit pruning
Algorithm trace
Experimental results
Conclusions
Graph Symmetry
1
2
7
5
3
14
(1(1
2 4)(2
3 4)(5
3)6)
6
is is
nota asymmetry!
symmetry!
8
2
7
5
3
4
The set of edges
is different.
unchanged.
2
4
8
3
5
6
2
4
3
6
1
7
6
5
8
Problem Statement


4
Given a graph G
– with n vertices
– and a partition p of its vertices (colors),
– with unknown set of symmetries Sym(G)p,
Find a set of symmetries S  Sym(G)p
– such that S generates Sym(G)p
– and |S| ≤ n - 1
Graph Symmetry Tools




5
Nauty (McKay, ’81)
– Blazed the trail
– Tuned to quickly find the symmetries of
large sets of small graphs
Saucy (Darga et al, DAC ’04)
– Graph symmetry can be fast for large yet
sparse graphs
– > 1000x speedup over nauty for graphs with tens of
thousands of vertices
Bliss (Junttila & Kaski, ’07)
– Efficient canonical labeling of sparse graphs
– Some improvements on Saucy
Traces (Piperno, ’08)
Permutations





6
V  1, 2,
, n
Permutation: bijection from V to V
– Tabular representation
– Cycle notation
Graph Symmetry: permutation that preserves edge
relation
Permutation Composition:   v    v     v  
Symmetric group on m-element set T: Sm(T )
– |Sm(T )| = m !
Ordered Partitions
p  W1 W2
i Wi  V ,
i  j Wi
Wi  
Wj  
1  i  m Wi


7
Unit OP: m = 1
Discrete OP: m = n
Wm 
V
Ordered Partition Pair (OPP)
pT 
 
p B 
8
T1 T 2

B1 B 2
Tm 

B k 
T i  Bi for all i

Isomorphic OPP: m = k and

Non-isomorphic OPP: m ≠ k or

Matching OPP: isomorphic and T i

Unit OPP: top and bottom ordered partitions are unit

Discrete OPP: top and bottom ordered partitions are discrete
T i  Bi for some i
 Bi for all i such that T i  1
Implicit Representation of
Permutations Sets using OPPs
Discrete OPP
(single permutation)
2 0 1 

   0 21
1 2 0
9
Implicit Representation of
Permutations Sets using OPPs
Unit OPP
(m ! permutations)
 0 , 1 , 2
0 , 1, 2   ,  01 ,  0 2  , 12  ,  012  ,  0 21 


10
Implicit Representation of
Permutations Sets using OPPs
Isomorphic OPP
2 0 , 1 

  12  ,  0 21
1 2 , 0
11
Implicit Representation of
Permutations Sets using OPPs
Matching OPP
1 0 , 2 , 4 3

  13  S 3 0 , 2 , 4
3 0 , 2 , 4 1 
12
Implicit Representation of
Permutations Sets using OPPs
Non-isomorphic OPP
0 , 2 1


1 2 , 0
13
7
Basic Search for Symmetries
1
2
67
88
7
14
X
86
7 8 6 


8
6
7


6
7
8
4
5
7 , 8 6 


7
,
8
6


X
8 7 6 


7
8
6


8
6
8 7 6 


8
7
6



7
7 , 8 6 
8

6
,
7
8


76
6

8
77
8 7 6  8 7 6 

 

7
6
8
6
7
8

 

7
8
6
68
6
77
78
8
7
66
7 , 8 6 

3
6 , 8 7 
7 8 6 


6
8
7


6 , 7 , 8 
6 , 7 , 8 


6
8
X
6
8
7
X
7
6
Vertex Partition Refinement

Try to distinguish vertices that are not symmetric
(2,1)
(3) 1
(2,1)
(3) 3



(2,1)
(3)
2
(3)
(2,1) 7 (3)
(2,1)
5
6
(7)
(2,1)
4 (3)
8 (3)
(2,1)
For each vertex v, compute a neighbor-count tuple
Partition the vertices based on these tuples
Repeat until the partition stabilizes
1, 2 , 3 , 4 , 5 , 6 , 7 , 8 
1, 2 , 3 , 4 , 5 , 6 , 7 , 8 


15
R
1 , 2 , 3 , 4 , 6 , 7 , 8 5


1
,
2
,
3
,
4
,
6
,
7
,
8
5


Search-Tree Pruning via Vertex
Refinement
6 , 7 , 8 
6 , 7 , 8 


77
8 7 6 


8 7 6 
R
7 , 8 6 


7
,
8
6


78
8 7 6 


7 8 6 
8
7
6

8
16
6

7
7
6
8
Isomorphic Refinement
1
2
5
3
1
7
4
3
8
6
4
8
Bottom
1 , 2 , 3 , 4 , 6 , 7 , 8 5


1
,
2
,
3
,
4
,
6
,
7
,
8
5


17
7
5
6
Top
R
2
12
2 , 3 , 4 , 6 , 7 , 8 1 5 


1
,
3
,
4
,
6
,
7
,
8
2
5


6 , 7 , 8 4 2 , 3 1 5


6 , 7 , 8 3 1 , 4 2 5

Non-Isomorphic Refinement
1
2
5
3
1
7
4
3
8
4
6
8
Bottom
1 , 2 , 3 , 4 , 6 , 7 , 8 5


1
,
2
,
3
,
4
,
6
,
7
,
8
5


18
7
5
6
Top
R
2
16
2 , 3 , 4 , 6 , 7 , 8 1 5 


1
,
2
,
3
,
4
,
7
,
8
6
5


 6 , 7 , 8 4 2 , 3 1 5


1, 2 , 3 , 4 7 , 8 6 5

Group Generators
identity
(1 2 4 3)
(1 4)(2 3)
(1 3 4 2)
(1 2)(3 4)
(1 3)(2 4)
(1 4)
(2 3)




19
1
2
7
5
3
4
6
8
8 vertices:
8! = 40320 permutations
48 symmetries
8 for square and 6 for triangle
Basic enumeration is inefficient
Fundamental concept: symmetry group can be represented
implicitly by an exponentially smaller set of generators
identity
(6 7 8)
(6 8 7)
(6 7)
(6 8)
(7 8)
Group Generators
1
2
7
5
3
6
4
8
Generators:
1 = (1 2)(3 4)
2 = (2 3)
3 = (6 7)
4 = (6 8)
2symmetry
(1 3 4 2)(7 8) =
is a
1343
43 = (6 8) ◦ (6 7) = (6 7 8)
343 = (6 7) ◦ (6 7 8) = (7 8)
1343 = (1 2)(3 4) ◦ (7 8) = (1 2)(3 4)(7 8)
21343 = (2 3) ◦ (1 2)(3 4)(7 8) = (1 3 4 2)(7 8)
20
Orbit Partition

1
2
3
4
{{1,2,3,4,5,6,7,8}}
7
5

6
Initial partition:
Orbit partition:
{{1,2,3,4},{5},{6,7,8}}
8

After degree refinement:
{{1,2,3,4,6,7,8},{5}}



21
Symmetry group induces an equivalence relation on vertices:
the orbit partition
Refinement provides an approximation of the orbit partition
Orbit partition:
– Built up incrementally from discovered symmetries
– Used to prune search for redundant symmetries
Cosets




22
A subgroup H of a group G partitions it into cosets
Each coset has the same number of elements as H
G can be generated by composing a single representative
from each coset with H
Used to prune search for redundant symmetries
Structure of Permutation Search Tree
23
Algorithm Outline



Phase 1: Recursive subgroup decomposition
Phase 2: Search for coset representatives … surprisingly
like SAT solving!
Four pruning mechanisms:
– Group-theoretic
Coset pruning: stop after coset representative is found
 Orbit pruning: avoid looking for coset representative

– Algorithmic (due to OPP data structure):
Matching OPP pruning: identify candidate permutation
before reaching leaves
 Non-isomorphic OPP pruning: detect absence of coset
representative in current subtree

24
Saucy 2.1 Search Tree
1
2
3
4
5
7
6
8
1, 2,3, 4, 6, 7,8 5


1,
2,3,
4,
6,
7,8
5


11
 2,3,
6, 7,8
4, 46, 2,3
7,8 1 5 
R

2,3,
6,
7,8
4,
4
6,
2,3
7,8
1
5


22
66
77
id
25
 2,3,
4, 6,
7,8 1 5 13 6,
6, 7,8
4 2,3
2,3,
7,84,|6,
4 7,8
2,3 1 55
R


 14  R
1,3,
4,
6,
7,8
2
5
1,
2,3,
4,
7,8
6
5
6,
7,8
3
1,
4
4
7,8




6, 7,8 4 3 2 1 5


6, 7,8 3 4 1 2 5
=
=
(2 3)
68
(7 8)
7,8 6 4 3 2 1 5


 6,8 7 4 3 2 1 5
76
(6 7)
24
 6, 7,8 4 3 2 1 5 


 6, 7,8 4 2 3 1 5 
67
78
21
23
6, 7,8 4 3 2 1 5


6, 7,8 4 3 2 1 5
7,8 6 4 3 2 1 5


7,8 6 4 3 2 1 5
16
12
//
x
//
≈
(1 2)(3 4)
Orbit Partition
//
{1,2,3,4}{6,7,8}
78
≈
17
18
≈ Coset pruning
// Orbit Pruning
= Matching OPP
x Non-isomorphic OPP
{2,3}{6,7,8}
{6,7,8}
{7,8}
Experimental Evaluation




26
1183 SAT 2009 competition benchmarks
– Application
– Crafted
– Random
Saucy on all 1183
Shatter on 47 most difficult benchmarks
Experiments on SUN workstation
– 3GHz Intel Dual-Core CPU
– 6MB cache
– 8GB RAM
– 64-bit Redhat Linux
Saucy Time vs. Graph Vertices
Crafted
Application
Random
1000
100
Time (s)
10
1
0.1
0.01
0.001
1.E+01
27
1.E+02
1.E+03
1.E+04
1.E+05
Graph Vertices
1.E+06
1.E+07
1.E+08
Saucy Time vs. Graph Vertices





28
Time out = 500 sec.
Sacuy finished on all but 18
– connum: 6 (solved by varying branching heuristics)
– equilarge: 3
– mod2-rand3bip: 9
Crafted category is the most challenging
Weak trend towards larger run times for larger graphs
Saucy is really fast (runtime < 1 sec.) on 93% (1101) of
all benchmarks
Saucy Group Order vs. Testcase
1.E+60
1.E+54
1.E+48
Group Order
1.E+42
Crafted
1.E+36
Application
Random
1.E+30
1.E+24
1.E+18
1.E+12
1.E+06
1.E+00
0
50
100
150
Testcase
29
200
250
300
Saucy Group Order vs. Testcase




30
323 benchmarks exhibited non-trivial symmetries
Random category:
– 606 had no symmetry
– 4 had one symmetry
Crafted category:
– 175 out of 263 (66%) had symmetry
– 18 timed out
Application category:
– 144 out of 292 (50%) had symmetry
Saucy Group Order vs. #generators
1.E+280
Crafted
1.E+245
Application
Random
Group Order
1.E+210
1.E+175
1.E+140
1.E+105
1.E+70
1.E+35
1.E+00
1
10
100
# Generators
31
1000
Saucy Group Order vs. #generators


32
Guarantee to produce no more than n - 1 generators for
n-vertex graph
The number of reported generators is significantly less
than n - 1
Shatter +SBP Variables
1.E+07
Crafted
Application
+SBP Variables
1.E+06
1.E+05
1.E+04
1.E+03
1.E+02
1.E+01
1.E+01
33
1.E+05
1.E+03
Original Variables
1.E+07
Shatter +SBP Clauses
1.E+07
Crafted
Application
+SBP Clauses
1.E+06
1.E+05
1.E+04
1.E+03
1.E+02
1.E+01
1.E+01
34
1.E+03
1.E+05
Original Clauses
1.E+07
Shatter Variables and Clauses

Shatter on 47 benchmarks
– Unsolved benchmarks or benchmarks with
run time > 1000 sec.
Application: 13
 Crafted: 34



35
# added SBP clauses
– Less than 4% for 29 benchmarks
– Ranged from 25% to 133% for 18 benchmarks
# added SBP variables
– Less than 1% for 23 benchmarks
– Ranged from 9% to an order of magnitude for 24
benchmarks
Shatter (Symmetry-Breaking) Flow




Use shatter to generate SBPs
Add SBPs to the original CNF formula
Pass the augmented CNF formula to the SAT solver
Statistical data:
– We used a re-ordering script to
Reorder variables
 Reorder clauses

– 20 re-ordered versions of each benchmark
10 for the original benchmarks
 10 for the SBP augmented benchmarks


36
Time-outs
– Crafted: 5000 sec.
– Application: 10000 sec.
Time (s)
SAT Solver Run Time

37
10000
9000
8000
7000
6000
5000
4000
3000
2000
1000
0
1. mod3block_4vars_11gates_b2
_restricted
2. mod4block_2vars_8gates_u2
3. phnf-size10-exclusive-FIFO.used-as.
Original +SPB
9
sat04-991.sat05-4192.reshuffled-07
9
4. sgp_5-5-6.sat05-2675.reshuffled-07
65
5. sgp_5-6-8.sat05-2669.reshuffled-07
4
2
6. 9dlx_vliw_at_b_iq5
10
5
7. 9dlx_vliw_at_b_iq6
3
55
51 9
1
8. 9dlx_vliw_at_b_iq7
9. 9dlx_vliw_at_b_iq8
5
5
1
10. 9dlx_vliw_at_b_iq9
11. clauses-8
12 12
13 13 12. cube-11-h14-sat
0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 910 1011 11
Benchmark
13. post-cbmc-aes-ee-r3-noholes
13 out of 47 benchmarked finished within time-outs
SAT Solver Run Time



38
SBP augmented versions led to fewer time-outs
All but 3 benchmarks were solved faster
Four benchmarks which were reported to be unsolvable
in SAT 2009 competition were solved with the addition of
SBPs
Conclusions and Future Work



For SAT: symmetry discovery is practically free
Static symmetry breaking
– Many CNF instances possess no or little symmetry
– CNF instances with a lot of symmetry may or may not
benefit from static symmetry breaking
Future work:
– SAT-inspired algorithmic enhancements:
Branching heuristics
 Learning

– Dynamic symmetry breaking:
Integrating symmetry breaking within the SAT solver
 Uncovering hidden/conditional symmetries

39
```