A simple Linear Time Algorithm for
Computing a (2π β 1)-Spanner of
π ππ1+1/π Size in Weighted Graphs
Surender Baswana and Sandeep Sen
Slides and Presentation By: Nadav Hollander
So, what exactly is a
π‘-spanner?
β’
A π‘-spanner is a subgraph of a given graph that
preserves approximate distance between each pair of
vertices.
β’
More precisely, a π‘-spanner of a graph is a subgraph
where for any pair of vertices, their distance in the
subgraph is at-most π‘ times their distance in the
original graph.
β’
The parameter π‘ is called the stretch factor.
3-Spanner Subgraph
Original Graph
3
3
1
1
2
2
1
1
4
4
3
2
4
3
2
3 + 1 + 2 β€ 3 β
4 = 12
Trivial Example
Not a 3-Spanner
Subgraph
Original Graph
4+3+1β°3β
2=6
3
3
1
2
1
1
4
4
3
2
1
4
4
2
Example 2
3
Not a 3-Spanner
Subgraph
Original Graph
3
3
1
2
1
5
1
4
4
3
2
4
2
3
2
Example 3
1
Spanner fun facts!
β’
When discussing spanners, usually the original graph is
connected (two vertices without a path between
them are βinfiniteβ distance apart).
β’
Every π‘-spanner is a spanning subgraph (not so
surprising). That is, the graph and its spanner both have
the vertex set π.
β’
Every connected graph is a 1-spanner of itself.
β’
Every MST π of a graph πΊ(π, πΈ) where
π = π is at least a (π β 1)-spanner of πΊ.
Motivation for Using
π‘-Spanners
β’
Quite useful in distributed systems and
communication networks.
β’
Basically any time a sparse representation of an
existing graph is needed, while keeping a some
relation of the original βdistanceβ between any two
vertices.
Previous Work
Reliance on global or local distance computation
(derived from computing full shortest path trees
from few vertices, determining the pair-wise
distance, building BFS trees up to a level π etc.)
The presented algorithm
Functions without any sort of distance computation
whatsoever, be it global or local.
Computing a
(ππ β π)-Spanner
The Main Tool
As we compute the spanner, we will remove edges
from the graph. We do so in a way that ensures for
each edge π removed, we will maintain the following
proposition π«π π :
π«π‘ π₯, π¦ : The vertices π₯, π¦ are connected in the
subgraph πΊ(π, πΈπ ) by a path consisting of at-most π‘
edges, and the weight of each edge on this path is not
more than that of edge (π₯, π¦).
The Main Tool
π‘ edges, each β€ πΌ
β€πΌ
β€πΌ
β€πΌ
β€πΌ
x
π€ π =πΌ
ππ (π) holds for π
y
(Basically, the definition
of π‘-Spanner)
A Quick Overview
β’
At the 1st stage of the algorithm, we partition the
vertex set π into clusters (in a randomized manner).
β’
The formation of clusters will involve deleting edges
from the graph (for which π«π‘ will hold).
β’
A cluster is a group of vertices which are βcloserβ in a
sense to each other than to other vertices outside the
cluster.
β’
We will define said βclosenessβ as the radius of the
cluster (pretty soon).
A Quick Overview
β’
Some clusters will form and get bigger (their radius
will increase) at every iteration of 1st stage.
β’
At some point, the algorithm will be satisfied with the
clusters formed (no more iterations).
β’
Enter the 2nd stage: the algorithm will then connect
said clusters to each other, which will then form the
spanner in question.
Letβs talk about clusters, shall
we?
Definition 1
β’ A cluster is a subset of vertices. A partition of a set π β²
β π into clusters is called Clustering.
β’ each cluster is a singleton set in the beginning, and
other vertices are added to the cluster as the
algorithm proceeds.
β’ We shall denote this (unique) oldest member of a
cluster as the center of the cluster.
Is the center of its
respective cluster
(Weβll talk about how to choose
vertices to form clusters in the
algorithm itself)
Letβs talk about clusters, shall
we?
Definition 2
β’ Given a graph πΊ(π, πΈ), a set of edges β° β πΈ induces a
partition of π into clusters in the following way:
β’ Two vertices belong to a cluster if they are connected
by a path Ξ β β°.
β’ (In other words, each connected component is a
cluster).
β’ We refer to this clustering as the clustering induced by
β°.
Is the center of its
respective cluster
The clustering
induced by β° β πΈ
Still Talking About Clusters
Definition 3
β’ Consider a clustering π induced by some β° β πΈ in a
given graph. The radius of a cluster π β π is the
smallest integer π such that the following holds:
For each edge π₯, π¦ adjacent to a cluster
(π₯ β π β§ π¦ β π), there is a path in β° from π₯ to π£ (the
center of π) of at most π edges, each having weight
not more than that of the edge (π₯, π¦).
π1
β€ πΌ, πΎ
πΌ
Is the center of its
respective cluster
πΎ
The clustering
induced by β° β πΈ
π1 is a cluster of
radius 1, π2 is a
cluster of radius 2
β€πΌ
β€πΌ
π2
β€π½
β€π½
π½
Still Talking About Clusters
Definition 4
β’ A clustering π induced by β° β πΈ is a clustering of
radius β€ π in the graph if each of its clusters has radius
β€ π.
Further Notations
β’ β° π₯, π1 : the edges from the set β° that are incident
from the vertices of the cluster π1 to the vertex π₯.
β’ β° π1 , π2 : the set of edges between vertices of cluster
π1 and vertices of cluster π2 that belong to the set β°.
π1
β€ πΌ, πΎ
πΌ
Is the center of its
respective cluster
πΏ
πΎ
The clustering
induced by β° β πΈ
π1 is a cluster of
radius 1, π2 is a
cluster of radius 2
β€πΌ
β€π½
β€π½
π½
X
β€πΌ
π = {π1 , π2 } is a
clustering of radius 2
πΈ π₯, π2 = {π½, πΏ}
π2
πΏ
πΈ π1 , π2 = {πΌ, πΏ}
Weβll Talk a Lot More About
Clusters
β’ Before we go on to the description of the algorithm,
thereβs still something to observe about the behavior of
clusters, which weβll cover in the following two
Lemmas.
Lemma 3
β’
Let π be a clustering of radius π induced by β° in a
graph πΊ π β² , β° βͺ πΈ β² , and let π β π be a cluster.
β’
For any vertex π’ β π, picking the least weight
edge from the set πΈβ²(π’, π) in the spanner will
ensure that the proposition π«2π+1 holds for each
edge e β πΈβ²(π’, π).
LEMMA 3
1. πΈ β² π’, π = π’, π¦ , π’, π₯ , β¦
2. πΌ β€ π½
3. π is a cluster of radius β€ π
π₯
π’
πΌ
π¦
weight β€ π β
πΌ
πΌ + ππΌ + ππ½ β€ π½ + ππ½ + ππ½ = 2π + 1 π½
β π«2π+1 π
holds for each π β πΈ π’, π !
π
π£
Lemma 4
β’
For a given graph πΊ π β² , πΈ β² βͺ β° , let π be a
clustering induced by β° and let π1 , π2 β π be two
clusters having radius π and π respectively.
β’
Adding the least weight edge of the set πΈ β² π1 , π2
to the spanner will ensure that the proposition
π«2π+2π+1 holds true for the entire set πΈβ²(π1 , π2 ).
β’
(Pretty much an extension for clusters of Lemma
3)
LEMMA 4
1. πΈ β² π1 , π2 = π¦1 , π¦2 , π₯1 , π₯2 , β¦
2. πΌ β€ π½
3. π1 is a cluster of radius β€ π
4. π2 is a cluster of radius β€ π
π1
π£1
π½
π₯1
weight β€ π β
πΌ
π¦1
πΌ
π₯2
π¦2
holds for each π β πΈ π1 , π2 !
π£2
weight β€ π β
πΌ
ππ½ + ππΌ + πΌ + ππΌ + ππ½ β€ ππ½ + ππ½ + π½ + ππ½ + ππ½ = (2π + 2π + 1)π½
β π«2π+2π+1 π
π2
Phase 1 of the Algorithm: forming the
clusters
β’
β’
β’
β’
β’
β’
This phase executes βπ/2β iterations.
In each iteration π we deal with π β² , πΈ β² , ππβ1 .
πβ² is a set of vertices weβll handle this iteration
(consists of clusters and their neighbors in previous
iteration).
πΈβ² is the set of edges for which π«2π+1 does not hold
yet. Edges from πΈβ² will either be deleted or added to
the (2π β 1)-spanner.
ππβ1 is a clustering from the previous iteration.
At 1st iteration: π β² = π,πΈ β² = πΈ, πΈπ = β
,
π1 = π£ π£ β π .
Phase 1 of the Algorithm: forming the
clusters
Picking a sample βπ of clusters from ππβ1
independently with probability πβ1/π .
2. ππ is initialized to βπ .
3. For each π£ β π β² β βπ :
β¦ If π£ is not adjacent to any sampled cluster:
ο Then for each cluster π β ππβ1 adjacent to π£ we
add to the spanner the least weight edge from π£ to
π.
1.
Phase 1 of the Algorithm: forming the
clusters
β¦ Else, (π£ is adjacent to 1 or more sampled clusters):
ο Let π β βπ be the cluster with least weight edge to
π£. We add said edge to the spanner and π£ to the
cluster π (This is how clusters expand).
ο In addition, for each cluster πβ² β ππβ1 adjacent to π£
with an edge of weight less than the one just
added, we add the least weight edge from π β² to π£.
Phase 1 of the Algorithm: forming the
clusters
4.
Lastly, we remove intra-cluster edges (edges whose
both endpoints belong to same cluster) of clusters
formed this iteration.
5.
Observation: In the clustering ππ induced by β°π ,
each cluster π β ππ is the union of a sampled
cluster from βπ with the set of vertices for whom the
cluster was the nearest neighboring
sampled cluster in ππβ1 .
(Again, this is how clusters expand).
PHASE 1 OF THE ALGORITHM: FORMING THE CLUSTERS
Theorem 1
β’
β’
The following assertion holds for each iteration π
β₯ 0:
π(π) : The clustering ππ induced by the set β°π in
the algorithm is a clustering of radius π.
Theorem 1
β’ Proof by induction.
β’ Corollary- For each edge π β πΈβ² eliminated from the
graph in the 1st phase, the proposition π«2π+1 holds
true.
β’ Since there are π = π/2 iterations in the 1st phase, it
follows from the corollary that π«π+1 holds for each
edge eliminated from the graph until now.
β’ Letβs assume we have π = 81 vertices, and π = 4.
β’ At 1st iteration we pick a sample from 81 clusters with
4
probability of π1/π = 1/ 81 = 1/3.
β’ We expect a sample β1 of size somewhere around 27
clusters which will be of radius 1 at the end of the
iteration.
β’ At 2nd iteration, we pick a sample β2 from
π1 = 27 clusters, again with probability 1/3.
β’ At the end of the 2nd iteration, weβll probably have
somewhere around 9 clusters of radius 2.
β’ We could go on, but after π/2 iterations we stop.
Phase 2 of the Algorithm:
cluster-cluster joining
ο
From theorem 1, we know π π/2 is a clustering of
radius π/2 .
ο
If π is odd, then for each pair of clusters
π1 , π2 β π π/2 , we add the least weight edge between
the two clusters to the spanner.
ο
If π is even, then for each pair of neighboring clusters π1
β π π/2 , π2 β π π/2 β1 we add the least weight edge
between the two clusters to the spanner.
PHASE 2: K IS ODD
1. πΈ β² π1 , π2 = π¦1 , π¦2 , π₯1 , π₯2 , β¦
2. πΌ β€ π½
3. π1 is a cluster of radius β€ π/2
4. π2 is a cluster of radius β€ π/2
π1
π£1
π½
π₯2
π₯1
weight β€ π/2 πΌ
π¦1
πΌ
π¦2
π2
π£2
weight β€ π/2 πΌ
π/2 π½ + π/2 πΌ + πΌ + π/2 πΌ + π/2 π½ β€ 2 π/2 + 2 π/2 + 1 π½ = 2π β 2 + 1 π½
β π«2πβ1 π
holds for each π β πΈβ² π1 , π2 !
PHASE 2: K IS EVEN
1. πΈ β² π1 , π2 = π¦1 , π¦2 , π₯1 , π₯2 , β¦
2. πΌ β€ π½
3. π1 is a cluster of radius β€ π/2
4. π2 is a cluster of radius β€ π/2 -1
π1
π£1
π½
π₯2
π₯1
weight β€ π/2 πΌ
π¦1
πΌ
π¦2
π2
π£2
weight β€
π/2 β 1 πΌ
π/2 π½ + πΌ + πΌ + ( π/2 β 1)(πΌ + π½) β€ 2 π/2 + 2( π/2 β 1) + 1 π½ = 2π β 1 π½
β π«2πβ1 π
holds for each π β πΈβ² π1 , π2 !
Running Time and Size Bounds
ο
From probability computations, we find the expected
number of edges contributed to the spanner by a
vertex π£ in iteration π is π1/π .
ο
Thus we get a total upper bound of π(ππ1+1/π ) edges
in the spanner at the end of 1st phase.
ο
From probability computations (again), we find the
expected number of edges contributed to the spanner
in the 2nd phase is π π1+1/π .
ο
We get a total size of π(ππ1+1/π ) for the spanner.
Running Time and Size Bounds
ο
ο
At 1st phase, at each iteration the algorithm picks a
random sample of clusters and finds the neighboring
sampled cluster nearest to each
vertex.
Also at each iteration, the algorithm selects
min πΈ β² π£, π for each π£ β πβ².
ο
Thus, every iteration takes π πΈ β²
ο
The 2nd phase can be completed in π πΈ β²
π(π) extra space).
ο
Therefore the total running time is π(ππ).
= π(π) time.
time (with
Theorem 3
β’
From the running time of the algorithm, its
correctness and the size of the
(2π β 1)-spanner computed we can conclude:
β’
Given a weighted graph πΊ(π, πΈ) and integer
π > 1, a spanner of stretch (2π β 1) and
π ππ1+1/π size can be computed in expected
π(ππ) time.
Implementation in
Distributed Model
A Quick Recap
The Distributed Model
β’ Each node has its own local memory and processor.
β’ computation takes place in synchronous rounds, where
each round involves passing of messages.
β’ 3 measures of complexity: number of rounds, total
number of messages and maximum length of any
message.
β’ computation performed locally at a node in each round
is free.
Implementation in Distributed
Model
β’ Each link in the distributed network has some positive
length (weight) associated with it.
β’ The aim is to select π ππ1+1/π edges (links) ensuring
a stretch of (2π β 1) for any missing link.
β’ The algorithm can be adapted in the distributed
environment to compute a (2π β 1)-spanner in π(π 2 )
rounds and π(ππ) communication complexity.
Implementation in Distributed
Model
β’ As a local information each node stores the weight of
each of its links.
β’ each node also maintains information about the
respective clusters to which it and each of its
neighbors belong as the algorithm proceeds.
β’ This information is updated through message passing
along the links after each iteration.
β’ An πth iteration of phase 1 of the algorithm will be
executed in π(π) rounds with π(π) messages passed.
π-th Iteration of Distributed
algorithm
Step 1: Forming a sample of clusters
ο
ο
ο
ο
ο
Center of each cluster π β ππβ1 declares π to be
sampled with probability πβ1/π .
The center passes this information to its neighbors on
cluster π.
On receiving such message, these neighbors in turn
pass the message to their neighbors in cluster π.
Since the cluster radius is at most (π β 1), it will take
(π β 1) rounds till each vertex determines whether or
not it belongs to a sampled cluster.
Also note that the total number of messages passed is
π(π).
π-th Iteration of Distributed
algorithm
Step 2: Finding nearest neighboring sampled clusters
ο
Each vertex of a sampled cluster now
declares to each of its neighbors that it is now a
member of a sampled cluster.
ο
Following this, each vertex computes its nearest
neighboring sampled cluster.
π-th Iteration of Distributed
algorithm
Step 3: Adding edges to the spanner
ο
Each vertex selects the edges to be added to the
spanner.
ο
Then it joins the appropriate cluster in the clustering
ππ if needed.
ο
Every two neighboring nodes exchange the
information about their new cluster in ππ , and discard
the link if they belong to the same cluster.
Running Time and Size Bounds
β’
Weβve seen that πth iteration gets executed in π(π)
rounds and total messages passed in these rounds is
π(π).
β’
Therefore the total number of rounds for the
algorithm is π π 2 .
β’
Total number of messages communicated is π(ππ).
β’
Also note that each message is of size π log π .
β’
The spanner computed will have expected
π ππ1+1/π edges.
© Copyright 2026 Paperzz