| 1: procedure INITIALCLUSTER G = (V, E), , C a number of initial clusters) |
| 2: Compute a shortest path between any u, v ∈ V. |
| 3: Choose C nodes uniformly at random, assign one label to each. |
| ⊳ Each node is a starting point for a cluster. |
| 4: while some nodes are still unlabeled do
|
| 5: for every cluster do
|
| 6: Find neighbors of nodes in the given cluster. |
| 7: if there are unlabeled neighbors or labeled neighbors with a worse distance to another |
| cluster then
|
| ⊳ Keep only the first condition for a fast run. |
| 8: Add the neighbor whose addition minimizes the within-cluster evaluation function . |