 One of the great 19th-century mathematicians, Niels Henrik Abel, was once asked about how to succeed in mathematics. Study the masters and not the pupils. The story may be apocryphal, but the advice is sound. If you want to become good at mathematics, study the masters. But they were unavailable, so you got me. Hey, now it's not that bad. As we pointed out before, once an algorithm exists, a machine can implement it faster, cheaper, and more accurately than any human. So learning algorithms is not that important. Instead, you should learn how to create algorithms. It's worth remembering creativity is a skill it gets better with practice. So let's try to create an algorithm for matching. We can use our proof of Hall's theorem as a starting point. The proof of Hall's theorem relied on finding some subset, t, where the neighborhood was the same size. We then proved that a matching existed between t and its neighborhood, and a matching existed between the remaining part of x and the remaining part of y. Putting these two matchings together gave us a matching between x and y. And since x minus t and y minus the neighborhood of t are smaller sets than the original x and y, it should be easier to find a matching between them. This suggests a simplification of the problem of finding a matching. If we can find a subset of x where the neighborhood is the same size as the subset, we can look for a matching between the remaining parts of x and y. Now intuitively, if we wanted to find a matching between the jobs x and persons capable of doing the job y, the most problematic situations are those where a job can only be done by one person. But these correspond to vertices of degree 1. So let x1 be the vertices in x with degree 1. Since the vertices have degree 1, the neighborhood is no larger than x itself. And if it is actually smaller, then Hall's theorem guarantees no matching exists. And if it's exactly equal, then we can try to find a matching between the remaining parts of the sets. Let's see how that might work and try to find a matching between the sets shown. So we notice we have a couple of degree 1 vertices, and this set A, D, G has neighbors R, P, and T. So here's a set whose neighbors are the same size. Now there's an obvious matching between them. And by the proof of Hall's theorem, we know that there will also be a matching between the remaining parts of the set. So let's eliminate these vertices. And now we have a new graph. And we have a new set, B, C, and E, all of degree 1, with neighbors M, Q, and N. And again, we know that there is a matching between these two sets. If we eliminate them, there should be a matching between the remaining parts of the sets. And so we can find a matching in our remaining set. We can restore the set we removed. And since these are all degree 1 vertices, they are automatically matched to their neighbors. We'll restore the first set we removed. And again, these are automatically matched to their neighbors. And here's our matching. Now in any creative enterprise, it's important to remember 90% of everything is junk. This is known as Sturgeon's Law after the 20th century science fiction author Theodore Sturgeon. What this means is that most things you create aren't going to be worth anything. In this case, our algorithm simplifies the problem of finding a matching, provided our graph has degree 1 vertices. But most graphs don't have many degree 1 vertices, so our algorithm isn't really practical. But remember, the contra-positive of Sturgeon's Law is that quality work forms only a small portion of any creative corpus. In other words, don't worry about the value of what you've created. Practice creativity, create a lot, and quality will follow. Or not. To log those lines, it's useful to keep in mind Asimov's corollary, also named after another 20th century science fiction author, nothing is ever completely worthless. In other words, we might still be able to make use of our algorithm with some modifications. So let's take a look at our algorithm again. The key feature we utilize was that if the neighborhood of a set is the same size as the set, we can find a matching between the set and its neighborhood, and a matching between the remaining parts of the sets. If x1 was a set of degree 1 vertices, then we were guaranteed that the neighborhood of x1 was no larger than x1 itself, so we could either show that no matching could exist, or partition x and y into smaller sets. But having degree 1 wasn't essential. The key requirement was the neighborhood of a set was the same size as the set. So let xi be the set of vertices in x with degree i. If the neighborhood is the same size, then we can partition x into xi, which has a matching with its neighborhood, and x minus xi, which has a matching with the remaining part of y. So let's try it out. So we see that there's no degree 1 vertices in our set. The degree 2 vertices are a, b, c, and h, and their neighbors are n, o, t, and v, which has the same size, so we remove these vertices and their incident edges. Now there's a degree 1 vertex, so we've removed it and its incident edge. And now there's some degree 2 vertices with neighbors, and again the set is the same size as its neighborhood. We remove it, and now we find a matching. Now remember we still have those other vertices, so let's bring them back. We'll restore the vertices and edges of degree 2, and find a matching. We'll bring back the vertex we got rid of, and find a matching. We'll bring back the vertices we got rid of, then find a matching. And so here's a matching for our graph. While this algorithm gave us a matching, it still relied on good fortune we had to find a set that had the same size as its neighborhood. However, it does give us another starting point for an improved algorithm. In general, if xk are vertices in G of degree k, where the size of xk is the same as the size of its neighborhood, we can remove both xk and its neighborhood. We look for a matching between the remaining parts of x and y. And what this means is that a graph matching algorithm can assume that the size of xk is always smaller than the size of its neighborhood. And so the question you got to ask yourself is, can this be the start of an algorithm? And the answer is, maybe, but that's a full research project.