Using multiple breadth-first search to find separators of a graph

Using multiple breadth-first search
to find separators of a graph
Cleve Ashcraft, Roger Grimes
LSTC
[email protected], [email protected]
Sparse Days Meeting 2013 at CERFACS
June 17-18, 2013
Toulouse, FRANCE
1
Goal of the work
V =⇒
B
S
MBB
B
B
B
W
split(V)
find vertex separator S
split(B)
split(W)
B
W
S
• S separates B from W
• E ∩ (B × W) = ∅
• |S| small, |B| ≈ |W| good balance
• cost function, quantify goodness of partition
• recursive algorithm, finds low-fill matrix orderings
2
Outline of talk
• “Cold Start” to find separator
• Improve the partition
• Expand to “wide” separator
• Multiple breadth first search
• MPP Experiments
• Extensions and related work
3
Outline of talk
• “Cold Start” to find separator
– Single source level sets, George & Liu, 1981
– Dual source level sets
• Improve the partition
• Expand to “wide” separator
• Multiple breadth first search
• MPP Experiments
• Extensions and related work
4
Outline of talk
• “Cold Start” to find separator
• Improve the partition
– Max Flow solver, A. & Liu, 1998
– “Trimming”, one sided improvement
• Expand to “wide” separator
• Multiple breadth first search
• MPP Experiments
• Extensions and related work
5
Outline of talk
• “Cold Start” to find separator
• Improve the partition
• Expand to “wide” separator
– Expand by levels, A. & Liu, 1998
– “Cutting Corners”, selective expansion
• Multiple breadth first search
• MPP Experiments
• Extensions and related work
6
Outline of talk
• “Cold Start” to find separator
• Improve the partition
• Expand to “wide” separator
• Multiple breadth first search
– Find pseudodiameter pair via sequential MBFS
– Find many pseudodiameter pairs via independent
MBFS
• MPP Experiments
• Extensions and related work
7
Outline of talk
• “Cold Start” to find separator
• Improve the partition
• Expand to “wide” separator
• Multiple breadth first search
• MPP Experiments
• Extensions and related work
– Linelets – preconditioners from CFD
– k-way partitions using MIBFS
– Beyond bisection
8
Outline of talk
• “Cold Start” to find separator
– Single source level sets, George & Liu, 1981
– Dual source level sets
• Improve the partition
• Expand to “wide” separator
• Multiple breadth first search
• MPP Experiments
• Extensions and related work
9
Single source level sets −→ (B, S, W) partition
• level(u) = dist(u, s)
1
• source node in green
0.8
0.6
• B nodes in blue
0.4
0.2
• W nodes in red
0
• S nodes in black
−0.2
−0.4
• nodes connected
by level set
−0.6
−0.8
−1
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
• separator minimal
10
Level weights histogram
CIRC351 :level sets and their weights
25
weight of level sets
20
15
10
5
0
0
2
4
6
8
10
12
21 levels
11
14
16
18
20
22
Level sets tridiagonal matrix
CIRC351 : tridiagonal matrix and BSW partition
350
Cost Function(α, β)
300
abs(|B|−|W |)
diff = |B|+|S|+|W |
max(|B|,|W |)
imbalance = min(|B|,|W |)
if imbalance ≤ α
partition is acceptable
cost = |S|(1 + β · diff)
else
cost = ∞
endif
250
200
150
100
50
0
0
50
100
150
200
250
300
12
350
GENAND (George and Liu, 1983)
GENAND(V, E)
• Find pseudoperipheral node s
• create compressed tridiagonal matrix
from the level sets of s
• find best (B, S, W) partition
• order S last
• GENAND(B, E ∩ (B × B))
• GENAND(W, E ∩ (W × W ))
13
Regular grid, 9-point operator, corner starting node
CIRC351 : |S| = 25, bestcost = 40.9
• h × k grid
1
0.9
• perfect balance,
√
α = 1, |S| = 2 h k
0.8
0.7
0.6
• in general,√
|S| = √ 2
hk
0.5
0.4
1+α
0.3
• relative size
|S|
1 ≤ min(h,k) ≤ 2
0.2
0.1
0
0
0.2
0.4
0.6
0.8
1
14
1.2
1.4
Dual source level half-sets −→ (B, S, W) partition
• level(u) = dist(u, s) − dist(u, t)
CIRC351 : (B,S,W) = (155,23,173), cost 23.354
• two source nodes
in green
1
0.8
0.6
• B nodes in blue
0.4
0.2
• W nodes in red
0
−0.2
• S nodes in black
−0.4
• adjacent half-sets
form a separator
−0.6
−0.8
−1
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
• separator NOT minimal
15
Dual source level half-sets −→ (B, S, W) partition
1
1
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
0
0
−0.2
−0.2
−0.4
−0.4
−0.6
−0.6
−0.8
−0.8
−1
−1
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
−1
16
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
Level weights histogram
CIRC351 : half level sets and their weights
14
12
weight of half level sets
10
8
6
4
2
0
0
5
10
15
20
41 levels
17
25
30
35
40
Level half-sets pentadiagonal matrix
CIRC351 : pentadiagonal matrix and BSW partition
350
Cost Function(α, β)
300
abs(|B|−|W |)
diff = |B|+|S|+|W |
max(|B|,|W |)
imbalance = min(|B|,|W |)
if imbalance ≤ α
partition is acceptable
cost = |S|(1 + β · diff)
else
cost = ∞
endif
250
200
150
100
50
0
0
50
100
150
200
250
300
18
350
Outline of talk
• “Cold Start” to find separator
• Improve the partition
– Max Flow solver, A. & Liu, 1998
– “Trimming”, one sided improvement
• Expand to “wide” separator
• Multiple breadth first search
• MPP Experiments
• Extensions and related work
19
Improve partition (B, S, W), using max flow
CIRC351 : width 2, (B,S,W) = (175,58,118), cost 60.826
1
• compress B to the source s
0.8
0.6
• compress W to the sink t
0.4
• expand S into a network of
nodes and arcs
0.2
0
−0.2
• solve the max flow problem
−0.4
−0.6
• A. & Liu, SIMAX 1998
−0.8
−1
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
20
Network max flow partition improvement
partition close to sink, <B,S,W> = <212,21,118>, cost = 351.00
partition close to source, <B,S,W> = <177,21,153>, cost = 21.43
1
1
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
0
0
−0.2
−0.2
−0.4
−0.4
−0.6
−0.6
−0.8
−0.8
−1
−1
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
21
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
Improve partition (B, S, W), via trimming
• basic idea, choose one of two moves
• while still improving
• Partition separator S into four disjoint sets.
S = S 00 ⊔ S 01 ⊔ S 10 ⊔ S 11
S 11 = ∂B ∩ ∂W
adjacent to both
S 10 = ∂B \ ∂W
adjacent to B, not W
S 01 = ∂W \ ∂B
adjacent to W, not B
S 00 = S \ ∂W \ ∂B not adjacent to W or B
• Return best partition from (B, S, W),
(B ∪ S 10, S \ S 10, W) and (B, S \ S 01, W ∪ S 01)
22
(1)
(2)
(3)
(4)
Partition before and after trimming
CIRC351 : width 2, (B,S,W) = (175,58,118), cost 60.826
CIRC351 : trimmed width 2, (B,S,W) = (175,22,154), cost 22.395
1
1
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
0
0
−0.2
−0.2
−0.4
−0.4
−0.6
−0.6
−0.8
−0.8
−1
−1
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
−1
23
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
Outline of talk
• “Cold Start” to find separator
• Improve the partition
• Expand to “wide” separator
– Expand by levels, A. & Liu, 1998
– “Cutting Corners”, selective expansion
• Multiple breadth first search
• MPP Experiments
• Extensions and related work
24
Expand minimal separator to wide separator
add layers on one or both sides, A. & Liu, 1998
expand towards B
expand towards W
1
1
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
0
0
−0.2
−0.2
−0.4
−0.4
−0.6
−0.6
−0.8
−0.8
−1
−1
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
25
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
“Cutting Corners”, selective widening
original partition
trimmed partition
initial partition, <B,S,W> = < 424, 50, 288 >
trimmed partition, <B,S,W> = < 424, 31, 307 >
1
1
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
0
0
−0.2
−0.2
−0.4
−0.4
−0.6
−0.6
−0.8
−0.8
−1
−1
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
−1
26
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
“Cutting Corners”, selective widening (continued)
wide separator
max flow separator
best partition, <B,S,W> = <398,31,333>, cost = 31.79
wide partition, 4 steps, <B,S,W> = < 398, 80, 284 >
1
1
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
0
0
−0.2
−0.2
−0.4
−0.4
−0.6
−0.6
−0.8
−0.8
−1
−1
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
27
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
“Cutting Corners”, selective widening (continued)
wide separator
max flow separator
best partition, <B,S,W> = <366,31,365>, cost = 31.01
wide partition, 4 steps, <B,S,W> = < 366, 101, 295 >
1
1
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
0
0
−0.2
−0.2
−0.4
−0.4
−0.6
−0.6
−0.8
−0.8
−1
−1
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
28
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
Algorithm : (B, S, W) = findpartition(V, E)
( 1)
( 2)
( 3)
( 4)
( 5)
( 6)
( 7)
( 8)
( 9)
(10)
(11)
(B 0, S 0, W 0) = coldstart(V, E)
(B 1, S 1, W 1) = trim(B, S, W)
(B, S, W) = better of (B 0, S 0, W 0) and (B 1, S 1, W 1)
while 1
b S,
b W)
c = expand(B, S, W)
(B,
b S,
b W)
c
(B ∗, S ∗, W ∗) = improve(B,
if (B ∗, S ∗, W ∗) is no better than (B, S, W) then
return(B, S, W)
end if
(B, S, W) = (B ∗, S ∗, W ∗)
end while
29
Outline of talk
• “Cold Start” to find separator
• Improve the partition
• Expand to “wide” separator
• Multiple breadth first search
– Find pseudodiameter pair via sequential MBFS
– Find many pseudodiameter pairs via independent
MBFS
• MPP Experiments
• Extensions and related work
30
Find pseudo-diameter pair
• s and t are a diameter pair if d(s, t) = max d(u, v)
u,v
• s and t are a pseudo-diameter pair
d(s, t) = max d(s, u) = max d(t, u)
u
u
• s = random vertex ; maxdist = 0
while 1
drop BFS from s
find t s.t. d(s, t) ≥ d(s, u) for all u
if d(s, t) = maxdist break
s = t ; maxdist = d(s, t)
end
• fast convergence, 3 or 4 iterations required
31
CIRC 2055, triangulated disk, cost distribution
• dual source (B, S, W)
followed by trimming
CIRC_2055 : cost of partitions using dual source level sets
• used each of the 2055
nodes as the seed
53.5
53
• 582 unique pseudodiameter pairs
cost
52.5
52
• average of 2.99 BFS
used for each run,
min 2, max 5
51.5
51
50.5
0
100
200
300
400
582 pseudo−diameter pairs
500
600
32
• cost varies by a factor
of 1.07
37 × 44 9-pt grid, cost distribution
• dual source (B, S, W)
followed by trimming
GRID_37_44 : cost of partitions using dual source level sets
• used each of the 1628
nodes as the seed
75
70
65
• 1094 unique pseudodiameter pairs
cost
60
55
• average of 3.11 BFS
used for each run,
min 2, max 5
50
45
40
0
200
400
600
1077 pseudo−diameter pairs
800
1000
• cost varies by a factor
of 2
33
Some pseudo-diameter pairs are good, some bad
initial partition, <B,S,W> = < 101, 25, 112 >
initial partition, <B,S,W> = < 112, 14, 112 >
1.2
1.2
1
1
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
0
0
0
0.2
0.4
0.6
0.8
1
0
34
0.2
0.4
0.6
0.8
1
MIBFS – Multiple Independent Breadth First Searches
• k different root vertices
• compute k different distance vectors
• k(k-1)/2 different dual source pairs
• k(k-1)/2 different trimmed partitions
• In MPP distributed memory
• All k BFS can be done together,
graph is that of Ik ⊗ A
• Dual source partitions can be done together
• Trimming can also be done together
35
37 × 44 9-pt grid, MIBFS cost distribution
GRID_37_44 : cost of partitions using dual source level sets
pseudo−diameter pairs in blue
75
1,3,6,... k(k−1)/2 random pairs in red
70
65
• k ≥ 4 better than
pseudo-diameter
pairs
cost
60
55
50
45
40
0
200
400
600
1084 pseudo−diameter pairs
800
1000
36
Outline of talk
• “Cold Start” to find separator
• Improve the partition
• Expand to “wide” separator
• Multiple breadth first search
• MPP Experiments
• Extensions and related work
37
MPP experiments – work in progress
• MIBFS “vectorized” across processors
• cost for k = 4 almost the same as k = 1.
• trimming “vectorized” across processors
• To Do :
• “vectorize” expansion to wide separators
• explore several expansions simultaneously
• gather one network onto one processor,
improve via max flow
38
Outline of talk
• “Cold Start” to find separator
• Improve the partition
• Expand to “wide” separator
• Multiple breadth first search
• MPP Experiments
• Extensions and related work
– Linelets
– Extension of farthest point clustering
– Beyond bisection
39
Idea for dual source level sets comes from “linelets”
map(u) = ⌊(dist(u, s) + dist(u, t)⌋
map(u) = ⌈(dist(u, s) + dist(u, t)⌉
1
1
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
0
0
−0.2
−0.2
−0.4
−0.4
−0.6
−0.6
−0.8
−0.8
−1
−1
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
−1
40
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
Farthest point clustering (Gonzales, 1985)
• Goal : edge-based domain decomposition
• Strategy : find set of k maximally dispersed vertices
to form centers of the domains
• Key point : given {c1, c2, · · · , ck−1}, find new center
ck s.t. min dist(ck , ci) is maximized
i
• Sequential process :
– start with random point c1, perform BFS from c1
– find c2 farthest from c1, perform BFS from c2
– find c3 farthest from c1 and c2,
perform BFS from c3, etc.
41
Extension of farthest point clustering
Choose random {c1, c2, · · · , ck−1}
Perform MIBFS from {c1, c2, · · · , ck−1}
while not satisfied
for each i independently
remove ci from set
find best b
ci with respect to others
evaluate scattering of the centers
end for
replace one or more centers, perform MIBFS
end while
42
Beyond bisection
• Instead of (B, S, W) bisection,
consider trisection, quadrisection, octasection
• Find two or more levels of separators at once
• Replace dist(u, s) − dist(u, t)
with function of dist(u, s1), dist(u, s2), dist(u, s3), etc
• Multiple component trimming
• Multiple component expansion
• Multiple component max flow solvers
43
Summary
• Three improvements
– single source vs dual source level sets
– max flow (expensive) vs trimming (cheap)
– expansion by levels vs selective expansion
• MIBFS (Multiple independent breadth first search)
– cheap in MPP, # of communication steps is
bounded above by the diameter of the graph
• Trimming the wide separator
– cheap in MPP, # of communication steps is
bounded above by the maximum width of a wide
separator
44