Under the Button is part of a student-run nonprofit.

Please support us by disabling your ad blocker on our site.

Romantic Dating With Breadth vs Depth-First Search Algorithms

bfs

Graphic by Darrion Chen / The Daily Pennsylvanian

Note that while you are in college, you have access to the largest dating pool that you’ll probably ever have in your life. As such it is absolutely imperative that you employ the best suited search algorithm for your needs. In this article, we’ll investigate the pros and cons of breadth-first search versus depth-first search in application to your dating life.

First, it is important to note that we are depicting the dating pool as a tree. The root of the tree is you, and the nodes in the next layer are your potential interests. Their leaf nodes are all the characteristics and traits of that respective person, which initially are unknown to you. Note that by the definition of a tree, there are no cycles. Your goal is to investigate each person and their child nodes and thus, obviously, find the correct person. 

Traditional dating strategy employs a depth-first strategy. This is where you commit to one node and you search its entire depth to the last layer. The benefit of this strategy is that it requires less memory since you are only committed to one node. If you don’t find the solution in this person after looking through all their leaf nodes, you then move onto the sibling node. Though this is the traditional way of dating, it could be comparatively slower to breadth-first depending on your needs. 

Meanwhile, breadth-first dating casts the net wide, but has much worse space complexity. You used to be talking to just one person at a time? Now try 5, 10, even 20. Due to the definition of BFS dating, you’d be arriving at the same bases with all 20 of your people roughly around the same time, so that may be confusing. Then again, if you do say the wrong name in the bedroom, you’d still have 19 other people, so whether you think this is an effective strategy is up to you. This strategy is otherwise known as “whoring around”, but who’s going to judge you if this strategy gets you the right one.

But which algorithm you use really depends on how thorough you want to be with your search. Do you really only care about one or two superficial traits, like looks or money? In this case use breadth-first, because from a large pool, you are likely to find a suitable solution rather quickly, since you are not interested in more in-depth traits. You may even find multiple solutions, which isn’t a bad problem to have either.

However, if you are interested in more in-depth details, like their deepest darkest secrets or their preference in toothbrush color, depth-first search is the better choice. The explanation for this one is quite simple: will you be able to memorize 20 people’s childhood secrets at the same time?

In summary, either search algorithm is completely valid depending on your needs and requirements. Therefore, it is important that you first decide what your needs and requirements are before you pick a strategy for yourself. 

PennConnects