Faster Force-Directed Graph Drawing
with the Well-Separated Pair Decomposition
Fabian Lipp
Alexander Wolff
Johannes Zink
Julius-Maximilians-Universität Würzburg
September 24, Graph Drawing 2015
Introduction
Classical force-directed algorithm
[Eades, 1984, Fruchterman & Reingold, 1991]
Attracting forces: O(m) time with m = #edges
Repulsive forces: Θ(n2 ) time with n = #vertices
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
1 / 11
Introduction
Classical force-directed algorithm
[Eades, 1984, Fruchterman & Reingold, 1991]
Attracting forces: O(m) time with m = #edges
Repulsive forces: Θ(n2 ) time with n = #vertices
Many speed-up techniques for force-directed algorithms known:
Hierarchical O(n log n) force-calculation [Barnes & Hut, 1986]
Potential-field-based multilevel algorithm [Hachul & Jünger,
2005]
Evaluation of multilevel layout methods [Bartel et al., 2011]
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
1 / 11
Introduction
Classical force-directed algorithm
[Eades, 1984, Fruchterman & Reingold, 1991]
Attracting forces: O(m) time with m = #edges
Repulsive forces: Θ(n2 ) time with n = #vertices
Many speed-up techniques for force-directed algorithms known:
Hierarchical O(n log n) force-calculation [Barnes & Hut, 1986]
Potential-field-based multilevel algorithm [Hachul & Jünger,
2005]
Evaluation of multilevel layout methods [Bartel et al., 2011]
Our approach
Using well-separated pair decomposition to speed up repulsive
force calculation to O(n log n) time.
Can be combined with other speed-up techniques.
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
1 / 11
Well-Separated Pairs
A
Definition
Let s > 0. A and B in R2 are s-well-separated
iff there are two balls CA and CB with
A ⊆ CA and B ⊆ CB ,
radius r := r (CA ) = r (CB ), and
distance ≥ s · r .
[Callahan & Kosaraju, 1995]
B
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
2 / 11
Well-Separated Pairs
CA
A
Definition
Let s > 0. A and B in R2 are s-well-separated
iff there are two balls CA and CB with
A ⊆ CA and B ⊆ CB ,
radius r := r (CA ) = r (CB ), and
distance ≥ s · r .
CB
[Callahan & Kosaraju, 1995]
B
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
2 / 11
Well-Separated Pairs
CA
r
Definition
A
Let s > 0. A and B in R2 are s-well-separated
iff there are two balls CA and CB with
A ⊆ CA and B ⊆ CB ,
radius r := r (CA ) = r (CB ), and
distance ≥ s · r .
CB
r
[Callahan & Kosaraju, 1995]
B
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
2 / 11
Well-Separated Pairs
CA
r
Definition
A
Let s > 0. A and B in R2 are s-well-separated
iff there are two balls CA and CB with
≥s ·r
A ⊆ CA and B ⊆ CB ,
radius r := r (CA ) = r (CB ), and
distance ≥ s · r .
CB
r
[Callahan & Kosaraju, 1995]
B
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
2 / 11
Well-Separated Pairs
CA
r
Definition
A
Let s > 0. A and B in R2 are s-well-separated
iff there are two balls CA and CB with
≥s ·r
A ⊆ CA and B ⊆ CB ,
radius r := r (CA ) = r (CB ), and
distance ≥ s · r .
CB
r
[Callahan & Kosaraju, 1995]
B
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
2 / 11
Well-Separated Pair Decomposition (WSPD)
Definition
Let S be a finite set in R2 . A WSPD for
S with respect to s > 0 is a sequence
{A1 , B1 }, {A2 , B2 }, . . . , {Ak , Bk }
of s-well-separated pairs Ai , Bi such
that
Ai , Bi ⊆ S, and
∀a 6= b ∈ S there is exactly one i
with a ∈ Ai and b ∈ Bi or vice
versa.
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
3 / 11
Well-Separated Pair Decomposition (WSPD)
Definition
Let S be a finite set in R2 . A WSPD for
S with respect to s > 0 is a sequence
{A1 , B1 }, {A2 , B2 }, . . . , {Ak , Bk }
of s-well-separated pairs Ai , Bi such
that
Ai , Bi ⊆ S, and
∀a 6= b ∈ S there is exactly one i
with a ∈ Ai and b ∈ Bi or vice
versa.
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
3 / 11
Well-Separated Pair Decomposition (WSPD)
Definition
Let S be a finite set in R2 . A WSPD for
S with respect to s > 0 is a sequence
{A1 , B1 }, {A2 , B2 }, . . . , {Ak , Bk }
of s-well-separated pairs Ai , Bi such
that
Ai , Bi ⊆ S, and
∀a 6= b ∈ S there is exactly one i
with a ∈ Ai and b ∈ Bi or vice
versa.
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
3 / 11
Well-Separated Pair Decomposition (WSPD)
Definition
Let S be a finite set in R2 . A WSPD for
S with respect to s > 0 is a sequence
{A1 , B1 }, {A2 , B2 }, . . . , {Ak , Bk }
of s-well-separated pairs Ai , Bi such
that
Ai , Bi ⊆ S, and
∀a 6= b ∈ S there is exactly one i
with a ∈ Ai and b ∈ Bi or vice
versa.
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
3 / 11
Well-Separated Pair Decomposition (WSPD)
Definition
Let S be a finite set in R2 . A WSPD for
S with respect to s > 0 is a sequence
{A1 , B1 }, {A2 , B2 }, . . . , {Ak , Bk }
of s-well-separated pairs Ai , Bi such
that
Ai , Bi ⊆ S, and
∀a 6= b ∈ S there is exactly one i
with a ∈ Ai and b ∈ Bi or vice
versa.
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
3 / 11
Well-Separated Pair Decomposition (WSPD)
Definition
Let S be a finite set in R2 . A WSPD for
S with respect to s > 0 is a sequence
{A1 , B1 }, {A2 , B2 }, . . . , {Ak , Bk }
of s-well-separated pairs Ai , Bi such
that
Ai , Bi ⊆ S, and
∀a 6= b ∈ S there is exactly one i
with a ∈ Ai and b ∈ Bi or vice
versa.
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
3 / 11
Well-Separated Pair Decomposition (WSPD)
Definition
Let S be a finite set in R2 . A WSPD for
S with respect to s > 0 is a sequence
{A1 , B1 }, {A2 , B2 }, . . . , {Ak , Bk }
of s-well-separated pairs Ai , Bi such
that
Ai , Bi ⊆ S, and
∀a 6= b ∈ S there is exactly one i
with a ∈ Ai and b ∈ Bi or vice
versa.
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
3 / 11
Computation of WSPD
Theorem
Let S be a set of n points in R2 . For any s > 0, a WSPD
consisting of O(n) pairs can be computed in O(n log n) time.
[Callahan & Kosaraju, 1995]
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
4 / 11
Repulsive Force Calculation
|B| · Frep
|A| · Frep
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
5 / 11
Repulsive Force Calculation
|B| · Frep
|A| · Frep
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
5 / 11
Repulsive Force Calculation
|B| · Frep
|A| · Frep
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
5 / 11
Repulsive Force Calculation
|B| · Frep
|A| · Frep
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
5 / 11
Repulsive Force Calculation
|B| · Frep
|A| · Frep
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
5 / 11
Repulsive Force Calculation
|B| · Frep
|A| · Frep
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
5 / 11
Repulsive Force Calculation
|B| · Frep
|A| · Frep
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
5 / 11
Repulsive Force Calculation
|B| · Frep
|A| · Frep
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
5 / 11
Repulsive Force Calculation
|B| · Frep
|A| · Frep
Compute forces for Θ(n2 ) pairs of vertices
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
5 / 11
Repulsive Force Calculation
|B| · Frep
|A| · Frep
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
5 / 11
Repulsive Force Calculation
|B| · Frep
|A| · Frep
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
5 / 11
Repulsive Force Calculation
|B| · Frep
|A| · Frep
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
5 / 11
Repulsive Force Calculation
|B| · Frep
|A| · Frep
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
5 / 11
Repulsive Force Calculation
|B| · Frep
A
|A| · Frep
B
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
5 / 11
Repulsive Force Calculation
|B| · Frep
A
|A| · Frep
B
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
5 / 11
Repulsive Force Calculation
|B| · Frep
|A| · Frep
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
5 / 11
Repulsive Force Calculation
|B| · Frep
|A| · Frep
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
5 / 11
Repulsive Force Calculation
|B| · Frep
|A| · Frep
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
5 / 11
Repulsive Force Calculation
|B| · Frep
|A| · Frep
Compute forces for k ∈ O(n) well-separated pairs
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
5 / 11
Using the Split Tree
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
6 / 11
Using the Split Tree
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
6 / 11
Using the Split Tree
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
6 / 11
Using the Split Tree
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
6 / 11
Using the Split Tree
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
6 / 11
Using the Split Tree
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
6 / 11
Running time
Compute the WSPD using a split tree
Compute forces for every pair
Propagate forces in the split tree
Total
Fabian Lipp, Alexander Wolff, Johannes Zink
O(n log n)
O(n)
O(n)
O(n log n)
Force-Directed Graph Drawing with WSPD
7 / 11
Experiments
Implementation
in Java
based on FRLayout in Jung (Java Universal Network/Graph
Framework)
Comparison to similar speed-up techniques:
Quadtree based [Barnes & Hut, 1986]
Grid variant [Fruchterman & Reingold, 1991]
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
8 / 11
Running time in seconds
Experiments: Running time
0.03
0.02
0.01
0
10
20
30
40 50 60 70
Number of vertices
FRLayout (JUNG)
FR+Grid
Fabian Lipp, Alexander Wolff, Johannes Zink
80
90
100
FR+Quad, Θ = 1.0
FR+WSPD, s = 0.1
Force-Directed Graph Drawing with WSPD
9 / 11
Standard deviation of edge length
Experiments: Quality
0.35
better
0.3
50
100
150
200
250
Number of edge crossings
300
FRLayout (JUNG) FR+Quad, Θ = 1.0
FR+WSPD, s = 0.1
FR+Grid
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
10 / 11
Standard deviation of edge length
Experiments: Quality
0.35
better
0.3
50
100
150
200
250
Number of edge crossings
300
FRLayout (JUNG) FR+Quad, Θ = 1.0
FR+WSPD, s = 0.1
FR+Grid
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
10 / 11
Standard deviation of edge length
Experiments: Quality
0.35
better
0.3
50
100
150
200
250
Number of edge crossings
300
FRLayout (JUNG) FR+Quad, Θ = 1.0
FR+WSPD, s = 0.1
FR+Grid
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
10 / 11
Standard deviation of edge length
Experiments: Quality
0.35
better
0.3
50
100
150
200
250
Number of edge crossings
300
FRLayout (JUNG) FR+Quad, Θ = 1.0
FR+WSPD, s = 0.1
FR+Grid
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
10 / 11
Standard deviation of edge length
Experiments: Quality
0.35
better
0.3
50
100
150
200
250
Number of edge crossings
300
FRLayout (JUNG) FR+Quad, Θ = 1.0
FR+WSPD, s = 0.1
FR+Grid
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
10 / 11
Summary
Asymptotic running time of O(n log n) for each iteration
Notably faster than unmodified algorithm
Similar to unmodfied algorithm in terms of quality
Better quality than Grid variant of Fruchterman & Reingold
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
11 / 11
Summary
Asymptotic running time of O(n log n) for each iteration
Notably faster than unmodified algorithm
Similar to unmodfied algorithm in terms of quality
Better quality than Grid variant of Fruchterman & Reingold
Demonstration during the poster session this afternoon
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
11 / 11
Summary
Asymptotic running time of O(n log n) for each iteration
Notably faster than unmodified algorithm
Similar to unmodfied algorithm in terms of quality
Better quality than Grid variant of Fruchterman & Reingold
Demonstration during the poster session this afternoon
Thank you!
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
11 / 11
APPENDIX
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
1/7
Example drawings
FRLayout (JUNG)
Fabian Lipp, Alexander Wolff, Johannes Zink
FR+WSPD, s = 0.1
Force-Directed Graph Drawing with WSPD
2/7
Example drawings
FRLayout (JUNG)
Fabian Lipp, Alexander Wolff, Johannes Zink
FR+WSPD, s = 0.1
Force-Directed Graph Drawing with WSPD
3/7
Running time in seconds
Experiments: Running time on large graphs
150
100
50
0
0
20,000
40,000
60,000
80,000
Number of vertices
FRLayout (JUNG)
FR+Grid
Fabian Lipp, Alexander Wolff, Johannes Zink
100,000
FR+Quad, Θ = 1.0
FR+WSPD, s = 0.1
Force-Directed Graph Drawing with WSPD
4/7
Running time in seconds
Experiments: Running times compared to OGDF
0.03
0.02
0.01
0
10
20
30
40 50 60 70
Number of vertices
FRLayout (JUNG)
FR+Grid
FR+Quad, Θ = 1.0
FR+WSPD, s = 0.1
Fabian Lipp, Alexander Wolff, Johannes Zink
80
90
100
FRExact (OGDF)
FM3 (OGDF)
FM3 single (OGDF)
GEM (OGDF)
Force-Directed Graph Drawing with WSPD
5/7
Running time in seconds
Experiments: Running times compared to OGDF
150
100
50
0
0
20,000
40,000
60,000
80,000
Number of vertices
FRLayout (JUNG)
FR+Grid
FR+Quad, Θ = 1.0
FR+WSPD, s = 0.1
Fabian Lipp, Alexander Wolff, Johannes Zink
100,000
FRExact (OGDF)
FM3 (OGDF)
FM3 single (OGDF)
GEM (OGDF)
Force-Directed Graph Drawing with WSPD
6/7
Standard deviation of edge length
Experiments: Quality compared to OGDF
0.35
0.3
50
100
150
200
250
Number of edge crossings
300
FR+WSPD, s = 0.1 FM3 (OGDF)
GEM (OGDF)
3
FRExact (OGDF)
FM single (OGDF)
Fabian Lipp, Alexander Wolff, Johannes Zink
Force-Directed Graph Drawing with WSPD
7/7
© Copyright 2026 Paperzz