ArticleslgStudy

computer science

Yo-yo (algorithm)

Yo-yo (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 Yo-yo (algorithm) rather than just read about it. In short: Yo-Yo is a distributed algorithm aimed at minimum finding and leader election in generic connected undirected graph. Unlike Mega-Merger it has a trivial termination and cost analysis.

Yo-yo (algorithm) — main illustration
Yo-yo (algorithm) — illustration

Key takeaways

  • Yo-yo (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 Yo-yo (algorithm) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Yo-yo (algorithm) from memory before moving on to harder problems.

Reference excerpt

Yo-Yo is a distributed algorithm aimed at minimum finding and leader election in generic connected undirected graph. Unlike Mega-Merger it has a trivial termination and cost analysis.

Introduction Yo-yo was introduced by Nicola Santoro. It proceeds by consecutive elimination and a graph-reduction technique called pruning. The algorithm is divided in a pre-processing phase followed by a cyclic repetition of a forward phase, called "Yo-" and a backward one, called "-Yo".

Pre-requisites Yo-Yo builds elects a minimum leader under the following premises:

Total reliability: No message is lost in transmission. Initial Distinct Values (ID): Each node has a unique identifier. Bi-directional communications channels: Each edge is bi-directional, communications can travel in both directions. No further restrictions are necessary.

Algorithm

Preprocessing The preprocessing phase is started with a broadcast. At awake state, each node sends its id to all of its neighbors and orients the edge towards the higher-degree node. Note as this is just a logical step, the bi-directional channel is not lost in the procedure. By convergecast the initiator is notified of the preprocessing termination. This process creates three categories of nodes:

Sources: nodes with outgoing nodes, but no incoming nodes. These are the least nodes in each neighborhood. Intermediate nodes: nodes with both outgoing and incoming edges. These are neither the least nor the greatest nodes in each neighborhood. Sinks: nodes with incoming edges, but no outgoing edges. These are the greatest nodes in each neighborhood.

Yo-

The "Yo-" phase is initiated by the sources. A source sends its id through its incoming edges, and waits. The intermediate nodes wait to receive the respective ids from each of their incoming edges. Once all of expected values are collected, a minimum computation is performed and the minimum id is forwarded through the outgoing edges. Sinks are passive in this phase. The messages are sent through the oriented edges and reach the sinks, which trigger the "-Yo" phase.

-Yo

Sinks initiate the "-Yo" phase by computing the minimum id received and sending a positive YES or negative NO through their incoming edges. A YES is sent through the edges carrying the minimum computed id, a NO through the remaining edges. The messages walk up the structure to the sources: the sources with at least one incoming NO become dead and lose their candidate status. The "-Yo" phase also comprises a re-structuring phase where the sources-intermediates-sinks is accommodated for the non-candidate sources. The edges carrying a NO are reversed and the losers candidates of the current stage become either sinks or intermediate nodes.

Pruning Pruning is an optimization technique applied in the "-Yo" phase, and its message is usually incorporated with the positive/negative response. It deletes useless edges and nodes. The former are edges that receive the same value from u>1 incoming edges: trivially u are useless and trimmed by the node. Such edges become dead and are ignored in the following iterations. The latter instead reduces the number of nodes by deleting unary sinks, that is sinks with v=1 incoming edge. These edges will be forced to send back the (only) received minimum with a YES reply, hence they do not perform any computation useful to the minimum finding.

Cost The pre-processing phase is composed of an exchange through each edge of the two nodes incident on the edge. Thus we have a cost of ∑v∈Vdeg(v)=2m. The Yo-Yo phases consist of a forward and backward scan of the structure, hence 2mi messages, where mi is the number of current active edges. The number of iterations is given by the number of iterations useful in order to delete each initial source. By hypothesis, each source is linked to at least another one by an intermediate node: if this was not the case then a disconnected component of the graph, but by definition the graph is connected. In the worst-case scenario intermediate ni nodes are connected in pairs and at each iteration at most half of the sources are eliminated. By restructuring each of the surviving ni+1 sources will now be connected in pairs. As in the previous case, at most half will survive. Clearly the termination is met when only one source remains. The halving imposes a log2n number of iterations over the latest computation, i.e. the one between the two farthest away surviving sources, placed at diam(G). The total cost amounts to 2mlog⁡n.

Termination Termination is guaranteed by the switch in directions performed in the YES/NO pull. The sources reduction in the "-Yo" phase is monotonic: by the previous observation each source is compared to at least one other source, and by uniqueness of the sources, one of them prevails while the others become dead. Since the number of initial sources is finite, the monotonic reduction will lead to a single source remaining.

References

Illustrations

Yo-yo (algorithm): The -Yo phase pulls up positive/negative answers.
The -Yo phase pulls up positive/negative answers.
Yo-yo (algorithm): Structure before and after pruning. First the top right-most node becomes a sink from receiving a NO. Being a sink with only one incoming edge, it is trimmed. Same goes for its parent and the central branch.
Structure before and after pruning. First the top right-most node becomes a sink from receiving a NO. Being a sink with only one incoming edge, it is trimmed. Same goes for its parent and the central branch.

Worked examples

Example 1 — a first encounter with Yo-yo (algorithm)

Start with the simplest possible case. Write down what Yo-yo (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 Yo-yo (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 Yo-yo (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 Yo-yo (algorithm)

In research
Yo-yo (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 Yo-yo (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
Yo-yo (algorithm) is common in secondary-school and first-year university syllabi. It links to neighbouring topics Distributed algorithms, Distributed computing, so understanding it makes those chapters shorter.
In everyday life
Look for Yo-yo (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 “Yo-yo (algorithm)” →

How to study Yo-yo (algorithm) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Yo-yo (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 Yo-yo (algorithm) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Yo-yo (algorithm) in simple terms?

Yo-Yo is a distributed algorithm aimed at minimum finding and leader election in generic connected undirected graph. Unlike Mega-Merger it has a trivial termination and cost analysis.

Why does Yo-yo (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 Yo-yo (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 Yo-yo (algorithm).

Tags

  • Distributed algorithms
  • Distributed computing

Keep exploring