<s>
In	O
statistics	O
,	O
single-linkage	B-Algorithm
clustering	I-Algorithm
is	O
one	O
of	O
several	O
methods	O
of	O
hierarchical	B-Algorithm
clustering	I-Algorithm
.	O
</s>
<s>
It	O
is	O
based	O
on	O
grouping	O
clusters	O
in	O
bottom-up	O
fashion	O
(	O
agglomerative	B-Algorithm
clustering	I-Algorithm
)	O
,	O
at	O
each	O
step	O
combining	O
two	O
clusters	O
that	O
contain	O
the	O
closest	O
pair	O
of	O
elements	O
not	O
yet	O
belonging	O
to	O
the	O
same	O
cluster	O
as	O
each	O
other	O
.	O
</s>
<s>
In	O
the	O
beginning	O
of	O
the	O
agglomerative	B-Algorithm
clustering	I-Algorithm
process	O
,	O
each	O
element	O
is	O
in	O
a	O
cluster	O
of	O
its	O
own	O
.	O
</s>
<s>
The	O
function	O
used	O
to	O
determine	O
the	O
distance	O
between	O
two	O
clusters	O
,	O
known	O
as	O
the	O
linkage	O
function	O
,	O
is	O
what	O
differentiates	O
the	O
agglomerative	B-Algorithm
clustering	I-Algorithm
methods	O
.	O
</s>
<s>
In	O
single-linkage	B-Algorithm
clustering	I-Algorithm
,	O
the	O
distance	O
between	O
two	O
clusters	O
is	O
determined	O
by	O
a	O
single	O
pair	O
of	O
elements	O
:	O
those	O
two	O
elements	O
(	O
one	O
in	O
each	O
cluster	O
)	O
that	O
are	O
closest	O
to	O
each	O
other	O
.	O
</s>
<s>
The	O
method	O
is	O
also	O
known	O
as	O
nearest	B-Algorithm
neighbour	I-Algorithm
clustering	I-Algorithm
.	O
</s>
<s>
The	O
result	O
of	O
the	O
clustering	O
can	O
be	O
visualized	O
as	O
a	O
dendrogram	B-Application
,	O
which	O
shows	O
the	O
sequence	O
in	O
which	O
clusters	O
were	O
merged	O
and	O
the	O
distance	O
at	O
which	O
each	O
merge	O
took	O
place	O
.	O
</s>
<s>
The	O
following	O
algorithm	O
is	O
an	O
agglomerative	B-Algorithm
scheme	O
that	O
erases	O
rows	O
and	O
columns	O
in	O
a	O
proximity	O
matrix	O
as	O
old	O
clusters	O
are	O
merged	O
into	O
new	O
ones	O
.	O
</s>
<s>
This	O
corresponds	O
to	O
the	O
expectation	O
of	O
the	O
ultrametricity	B-Algorithm
hypothesis	O
.	O
</s>
<s>
Because	O
of	O
the	O
ultrametricity	B-Algorithm
constraint	O
,	O
the	O
branches	O
joining	O
or	O
to	O
,	O
and	O
to	O
,	O
and	O
also	O
to	O
are	O
equal	O
and	O
have	O
the	O
following	O
total	O
length	O
:	O
</s>
<s>
The	O
dendrogram	B-Application
is	O
now	O
complete	O
.	O
</s>
<s>
It	O
is	O
ultrametric	B-Algorithm
because	O
all	O
tips	O
(	O
,	O
,	O
,	O
,	O
and	O
)	O
are	O
equidistant	O
from	O
:	O
</s>
<s>
The	O
dendrogram	B-Application
is	O
therefore	O
rooted	O
by	O
,	O
its	O
deepest	O
node	O
.	O
</s>
<s>
The	O
naive	O
algorithm	O
for	O
single	B-Algorithm
linkage	I-Algorithm
clustering	I-Algorithm
is	O
essentially	O
the	O
same	O
as	O
Kruskal	B-Algorithm
's	I-Algorithm
algorithm	I-Algorithm
for	O
minimum	O
spanning	O
trees	O
.	O
</s>
<s>
However	O
,	O
in	O
single	B-Algorithm
linkage	I-Algorithm
clustering	I-Algorithm
,	O
the	O
order	O
in	O
which	O
clusters	O
are	O
formed	O
is	O
important	O
,	O
while	O
for	O
minimum	O
spanning	O
trees	O
what	O
matters	O
is	O
the	O
set	O
of	O
pairs	O
of	O
points	O
that	O
form	O
distances	O
chosen	O
by	O
the	O
algorithm	O
.	O
</s>
<s>
Alternative	O
linkage	O
schemes	O
include	O
complete	B-Algorithm
linkage	I-Algorithm
clustering	I-Algorithm
,	O
average	O
linkage	O
clustering	O
(	O
UPGMA	B-Algorithm
and	O
WPGMA	B-Algorithm
)	O
,	O
and	O
Ward	B-Algorithm
's	I-Algorithm
method	I-Algorithm
.	O
</s>
<s>
In	O
the	O
naive	O
algorithm	O
for	O
agglomerative	B-Algorithm
clustering	I-Algorithm
,	O
implementing	O
a	O
different	O
linkage	O
scheme	O
may	O
be	O
accomplished	O
simply	O
by	O
using	O
a	O
different	O
formula	O
to	O
calculate	O
inter-cluster	O
distances	O
in	O
the	O
algorithm	O
.	O
</s>
<s>
+	O
Comparison	O
of	O
dendrograms	B-Application
obtained	O
under	O
different	O
clustering	O
methods	O
from	O
the	O
same	O
distance	O
matrix	O
.	O
</s>
<s>
The	O
naive	O
algorithm	O
for	O
single-linkage	B-Algorithm
clustering	I-Algorithm
is	O
easy	O
to	O
understand	O
but	O
slow	O
,	O
with	O
time	O
complexity	O
.	O
</s>
<s>
In	O
1973	O
,	O
R	O
.	O
Sibson	O
proposed	O
an	O
algorithm	O
with	O
time	O
complexity	O
and	O
space	O
complexity	O
(	O
both	O
optimal	O
)	O
known	O
as	O
SLINK	B-Algorithm
.	O
</s>
<s>
The	O
slink	B-Algorithm
algorithm	O
represents	O
a	O
clustering	O
on	O
a	O
set	O
of	O
numbered	O
items	O
by	O
two	O
functions	O
.	O
</s>
<s>
As	O
Sibson	O
shows	O
,	O
when	O
a	O
new	O
item	O
is	O
added	O
to	O
the	O
set	O
of	O
items	O
,	O
the	O
updated	O
functions	O
representing	O
the	O
new	O
single-linkage	B-Algorithm
clustering	I-Algorithm
for	O
the	O
augmented	O
set	O
,	O
represented	O
in	O
the	O
same	O
way	O
,	O
can	O
be	O
constructed	O
from	O
the	O
old	O
clustering	O
in	O
time	O
.	O
</s>
<s>
The	O
SLINK	B-Algorithm
algorithm	O
then	O
loops	O
over	O
the	O
items	O
,	O
one	O
by	O
one	O
,	O
adding	O
them	O
to	O
the	O
representation	O
of	O
the	O
clustering	O
.	O
</s>
<s>
An	O
alternative	O
algorithm	O
,	O
running	O
in	O
the	O
same	O
optimal	O
time	O
and	O
space	O
bounds	O
,	O
is	O
based	O
on	O
the	O
equivalence	O
between	O
the	O
naive	O
algorithm	O
and	O
Kruskal	B-Algorithm
's	I-Algorithm
algorithm	I-Algorithm
for	O
minimum	O
spanning	O
trees	O
.	O
</s>
<s>
Instead	O
of	O
using	O
Kruskal	B-Algorithm
's	I-Algorithm
algorithm	I-Algorithm
,	O
one	O
can	O
use	O
Prim	B-Algorithm
's	I-Algorithm
algorithm	I-Algorithm
,	O
in	O
a	O
variation	O
without	O
binary	O
heaps	O
that	O
takes	O
time	O
and	O
space	O
to	O
construct	O
the	O
minimum	O
spanning	O
tree	O
(	O
but	O
not	O
the	O
clustering	O
)	O
of	O
the	O
given	O
items	O
and	O
distances	O
.	O
</s>
<s>
Then	O
,	O
applying	O
Kruskal	B-Algorithm
's	I-Algorithm
algorithm	I-Algorithm
to	O
the	O
sparse	O
graph	O
formed	O
by	O
the	O
edges	O
of	O
the	O
minimum	O
spanning	O
tree	O
produces	O
the	O
clustering	O
itself	O
in	O
an	O
additional	O
time	O
and	O
space	O
.	O
</s>
