ArticleslgStudy

computer science

OPTICS algorithm

OPTICS algorithm is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand OPTICS algorithm rather than just read about it. In short: Ordering points to identify the clustering structure (OPTICS) is an algorithm for finding density-based clusters in spatial data. It was presented in 1999 by Mihael Ankerst, Markus M.

OPTICS algorithm — main illustration
OPTICS algorithm — illustration

Key takeaways

  • OPTICS algorithm belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect OPTICS algorithm to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of OPTICS algorithm from memory before moving on to harder problems.

Reference excerpt

Ordering points to identify the clustering structure (OPTICS) is an algorithm for finding density-based clusters in spatial data. It was presented in 1999 by Mihael Ankerst, Markus M. Breunig, Hans-Peter Kriegel and Jörg Sander. Its basic idea is similar to DBSCAN, but it addresses one of DBSCAN's major weaknesses: the problem of detecting meaningful clusters in data of varying density. To do so, the points of the database are (linearly) ordered such that spatially closest points become neighbors in the ordering. Additionally, a special distance is stored for each point that represents the density that must be accepted for a cluster so that both points belong to the same cluster. This is represented as a dendrogram.

Basic idea Like DBSCAN, OPTICS requires two parameters: ε, which describes the maximum distance (radius) to consider, and MinPts, describing the number of points required to form a cluster. A point p is a core point if at least MinPts points are found within its ε-neighborhood Nε(p) (including point p itself). In contrast to DBSCAN, OPTICS also considers points that are part of a more densely packed cluster, so each point is assigned a core distance that describes the distance to the MinPtsth closest point:

core-dist𝜀,𝑀𝑖𝑛𝑃𝑡𝑠(p)={UNDEFINEDif |Nε(p)|<𝑀𝑖𝑛𝑃𝑡𝑠𝑀𝑖𝑛𝑃𝑡𝑠-th smallest distance in Nε(p)otherwise The reachability-distance of another point o from a point p is either the distance between o and p, or the core distance of p, whichever is bigger:

reachability-dist𝜀,𝑀𝑖𝑛𝑃𝑡𝑠(o,p)={UNDEFINEDif |Nε(p)|<𝑀𝑖𝑛𝑃𝑡𝑠max⁡(core-dist𝜀,𝑀𝑖𝑛𝑃𝑡𝑠(p),dist(p,o))otherwise If p and o are nearest neighbors, this is the ε′<ε we need to assume to have p and o belong to the same cluster. Both core-distance and reachability-distance are undefined if no sufficiently dense cluster (w.r.t. ε) is available. Given a sufficiently large ε, this never happens, but then every ε-neighborhood query returns the entire database, resulting in O(n2) runtime. Hence, the ε parameter is required to cut off the density of clusters that are no longer interesting, and to speed up the algorithm. The parameter ε is, strictly speaking, not necessary. It can simply be set to the maximum possible value. When a spatial index is available, however, it does play a practical role with regards to complexity. OPTICS abstracts from DBSCAN by removing this parameter, at least to the extent of only having to give the maximum value.

Pseudocode The basic approach of OPTICS is similar to DBSCAN, but instead of maintaining known, but so far unprocessed cluster members in a set, they are maintained in a priority queue (e.g. using an indexed heap).

function OPTICS(DB, ε, MinPts) is for each point p of DB do p.reachability-distance = UNDEFINED for each unprocessed point p of DB do N = getNeighbors(p, ε) mark p as processed output p to the ordered list if core-distance(p, ε, MinPts) != UNDEFINED then Seeds = empty priority queue update(N, p, Seeds, ε, MinPts) for each next q in Seeds do N' = getNeighbors(q, ε) mark q as processed output q to the ordered list if core-distance(q, ε, MinPts) != UNDEFINED do update(N', q, Seeds, ε, MinPts)

In update(), the priority queue Seeds is updated with the ε-neighborhood of p and q, respectively:

function update(N, p, Seeds, ε, MinPts) is coredist = core-distance(p, ε, MinPts) for each o in N if o is not processed then new-reach-dist = max(coredist, dist(p,o)) if o.reachability-distance == UNDEFINED then // o is not in Seeds o.reachability-distance = new-reach-dist Seeds.insert(o, new-reach-dist) else // o in Seeds, check for improvement if new-reach-dist < o.reachability-distance then o.reachability-distance = new-reach-dist Seeds.move-up(o, new-reach-dist)

OPTICS hence outputs the points in a particular ordering, annotated with their smallest reachability distance (in the original algorithm, the core distance is also exported, but this is not required for further processing).

Extracting the clusters

Using a reachability-plot (a special kind of dendrogram), the hierarchical structure of the clusters can be obtained easily. It is a 2D plot, with the ordering of the points as processed by OPTICS on the x-axis and the reachability distance on the y-axis. Since points belonging to a cluster have a low reachability distance to their nearest neighbor, the clusters show up as valleys in the reachability plot. The deeper the valley, the denser the cluster. The image above illustrates this concept. In its upper left area, a synthetic example data set is shown. The upper right part visualizes the spanning tree produced by OPTICS, and the lower part shows the reachability plot as computed by OPTICS. Colors in this plot are labels, and not computed by the algorithm; but it is well visible how the valleys in the plot correspond to the clusters in above data set. The yellow points in this image are considered noise, and no valley is found in their reachability plot. They are usually not assigned to clusters, except the omnipresent "all data" cluster in a hierarchical result. Extracting clusters from this plot can be done manually by selecting ranges on the x-axis after visual inspection, by selecting a threshold on the y-axis (the result is then similar to a DBSCAN clustering result with the same ε and minPts parameters; here a value of 0.1 may yield good results), or by different algorithms that try to detect the valleys by steepness, knee detection, or local maxima. A range of the plot beginning with a steep descent and ending with a steep ascent is considered a valley, and corresponds to a contiguous area of high density. Additional care must be taken to the last points in a valley to assign them to the inner or outer cluster, this can be achieved by considering the predecessor. Clusterings obtained this way usually are hierarchical, and cannot be achieved by a single DBSCAN run.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with OPTICS algorithm

Start with the simplest possible case. Write down what OPTICS algorithm claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to OPTICS algorithm before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about OPTICS algorithm ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of OPTICS algorithm

In research
OPTICS algorithm appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses OPTICS algorithm in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
OPTICS algorithm is common in secondary-school and first-year university syllabi. It links to neighbouring topics Cluster analysis algorithms, so understanding it makes those chapters shorter.
In everyday life
Look for OPTICS algorithm outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “OPTICS algorithm” →

How to study OPTICS algorithm in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what OPTICS algorithm means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain OPTICS algorithm out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is OPTICS algorithm in simple terms?

Ordering points to identify the clustering structure (OPTICS) is an algorithm for finding density-based clusters in spatial data. It was presented in 1999 by Mihael Ankerst, Markus M.

Why does OPTICS algorithm matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study OPTICS algorithm?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on OPTICS algorithm.

Tags

  • Cluster analysis algorithms

Keep exploring