《Making of a Genius [A Progression LitRPG]》Chapter 6 - Strongly Connected Components
Advertisement
As the days passed by, Lexus slowly worked through the chapters of "Introduction to Algorithms", learning interesting concepts like randomised algorithms, quick sort, hash tables, minimum spanning trees and much more. Each chapter felt like a whole new world to explore, full of mysteries and perplexities.
Lexus was having fun treasure hunting in the forest of knowledge: finding rare items, equipping new tools, fighting strong monsters and eventually leaving the forest stronger than before. He went in wearing nothing more than beginner armour, his hand holding a shoddy dagger, and walked out with a bulletproof Kevlar vest over his chest and an assault rifle strapped on his back.
Oh, except the fact that trying to understand something was bloody hard. Lexus had to grit his teeth and grapple with each and every mathematical monster, going through the book line by line, searching up the things he didn't understand. When that didn't work, he would try to program the concept using C++.
C++ wasn't the programming language he was the most familiar with. Like everyone else, he started off his programming journey with Python, known for its resemblance to natural language. But he had wanted to learn C++ for a long time, and now was as good a time as any.
Ding!
---
Computer Science EXP +1
---
And he discovered that he would earn more experience points, even though it increased his pain ever so slightly.
By slightly, he meant a lot.
He was too ashamed to ever admit it to anyone, but he spent over an hour just trying to get the merge sort code to work. Was it the vector initialisation in line 20 that was the problem? Or did he pass in the wrong parameters to the MergeSort() method? By the end, he had over ten print statements littered all over his code in an attempt to catch the error. And he did catch it eventually - it was an off-by-one error.
As the famous saying goes, "There are two hard things in computer science: cache invalidation, naming things, and off-by-one errors."
Frustrated, Lexus leaned back on his chair. When he looked up, he could see the multitude of books that filled his shelf. A few were textbooks that he had borrowed from the library, but there were also books that he had brought with him to university. Popular science books about physics, maths and computer science, as well as biographies about famous scientists like Alan Turing and Albert Einstein.
With all their intelligence, did they ever experience the feeling of being stuck and stupid?
“Feeling stuck?” said the voice in his head.
“Hey system, am I an idiot?” Lexus asked into the empty room.
The system snorted. “You’re only realising that now?”
“Tch.” Lexus suddenly felt more determined, if only to prove the system wrong. He was going to make it big!
In order to get through the thousand-page book without going insane, he needed a change of strategy.
It was time to use his “phone-a-friend” lifeline. Except he didn’t have to literally phone them, since that friend was right down the corridor.
So Lexus got up from his chair and walked over to Arthur's room. Knock. Knock knock.
"Come in," a voice called.
Lexus pushed open the door. The first thing he noticed was the sound of chants, beats and hype music that originated from somewhere to his left. He looked over to see Arthur reclined on his study chair with his attention fully focused on his switch, fighting a Pokémon gym battle.
Advertisement
Without even looking up to acknowledge Lexus' presence, Arthur spoke.
"Hold on, Duraludon's the last Pokémon I have to beat," Arthur said.
Lexus walked over and leaned against the corner of Arthur’s table. "How did you know it was me?"
Arthur replied, "Who else would come knocking at my door at this time of the day? Do you even know what time it is?"
Lexus took a moment to ponder before coming to the conclusion that no, he didn't know what time it was.
"What time is it?" Lexus asked hesitantly.
Arthur stopped. He placed his switch down on the desk, picked up his phone and shoved the screen in Lexus' face. "Look. Look at this."
A glaring "00:39" appeared before Lexus' eyes.
The first thought that came to his mind wasn't oh no it's so late I should apologise, but instead it was, "Oh, it's not as bad as I expected!"
The moment those words came out of his mouth, Lexus knew that he had made a mistake.
"I'm sorry," he quickly added.
Too little too late.
"Well, my night is officially taken up by Pokémon, so you can come and find me tomorrow morning," Arthur said. "Unless it's urgent?"
"No, it's fine," Lexus replied. He had wanted to ask Arthur some questions about a few of the algorithms he had come across in the book, but it could wait. Disturbing Arthur while he was gaming was typically not a good idea, and this rule was doubly true past midnight.
Lexus shut the door as carefully as he could and scampered back to his room, only now noticing how eerily quiet the corridor was.
=====
Lexus woke up at 8am in the morning, but opted to wait another two hours before heading over to Arthur's room. Arthur was most definitely not an early bird, and 10am was just about the earliest acceptable time if there wasn't a 9am lecture that morning.
Just as he expected, Arthur had just woken up.
"You're always so freaking early," Arthur grumbled.
Lexus watched as Arthur climbed out of bed and started getting ready.
"I've already had breakfast, a morning run and spent an hour doing the breadth-first-search tick," he said.
Finding the later chapters of "Introduction to Algorithms" too strenuous to do right after waking up, Lexus chose instead to do something he did know how to do: the optional programming exercise set for his Algorithms 2 course.
"Why am I even wasting my time trying to reason with this machine?" Arthur mumbled.
=====
Arthur sat down on his study chair and swivelled it to face Lexus, who sat down on a stool he grabbed from the other side of the room.
"So, what's the question that you wanted to ask me last night?" Arthur asked.
"How did you kn- never mind," Lexus said. "I don't really understand the concept of strongly connected components and the algorithm to find them."
Lexus could tell that Arthur was interested the moment the words "strongly connected components" was said.
"Oh! Kosaraju's algorithm. It's a good one, this one," Arthur said as he leaned over to the other side of the table in order to grab a sheet of paper and a pen. "I've used it in multiple competitions."
Lexus watched as he started writing on the piece of paper.
"So let's say we have a di-graph," Arthur said as he drew a couple of circles on the page and randomly added arrows from one circle to another.
Advertisement

"Then a strongly connected component is one where every node is reachable from another node - like for example if we have this triangle over here in the middle, you can go from any one of these three nodes to any other node while following the arrows," Arthur explained.

Lexus nodded and said, "So if you want to get from node number 1 to node number 3 in the directed graph, you can just go through node 2. But 4 isn’t in the same strongly connected component as 1, because you can get from 4 to 1 but you can’t get from 1 to 4."
"Exactly," Arthur replied. "Then Kosaraju's algorithm makes use of the fact that the transpose graph of any di-graph, basically a graph with all the arrows pointing the other way, have the same strongly connected components as the original graph. If I draw the transpose graph of the one we already have-"

"- the triangle of nodes in the middle are still strongly connected, and so we can find the strongly connected components by exploiting this property."
Lexus made a note to himself to attempt to prove that statement when he got back. It was pretty intuitive, but could he prove it from first principles? Before he could get any further along that line of thinking, Arthur's voice brought his focus back to reality.
"The procedure for Kosaraju's algorithm is: first, you perform a depth-first-search of the entire graph, storing the nodes in the order for which they run out of output edges in a stack, then you transpose the graph, then you do another depth-first-search for every node by popping the stack."
"Wh-what." Lexus said. He had no idea what was going on.
Arthur paused, as if to think, and Lexus looked at Arthur incredulously. Did this guy just think he would listen to that and go "Oh that makes total sense, I get it now"?
To be fair, he'd done that before in Professor Emerson's supervision.
Arthur contemplated for a while more before he said, "I've always just used the algorithm without thinking too much about it... maybe it's better if I just show it to you."
And so Arthur led Lexus through the procedure for Kosaraju's algorithm step by step, showing him which elements would be added to the stack in which order. By observing the algorithm as it solved the problem, Lexus was able to have a better grasp of what exactly was going on in each step of the way.
1st DFS: 0 → 1 → 2 → 3 then 4 → 5
stack: 3 2 1 0 5 4
2nd round of DFS:
DFS(4) → 4
DFS(5) → 5
DFS(0) → 0
DFS(1) → 1 2 3
Therefore there are 4 strongly connected components: {4}, {5}, {0} and {1, 2, 3}.
---
Computer Science EXP +1
---
As he listened to Arthur's explanation, Lexus was also able to finally figure out why the algorithm worked.
"Oh, I think I get it! The first depth-first-search gives the order of the starting nodes for the second round of depth-first-searches! This makes sure that in the second round, searching from a node would only return the nodes in the same strongly connected component," Lexus said.
---
Computer Science EXP +2
---
"Yeah okay, I guess that kind of makes sense," Arthur replied. Lexus could tell that Arthur didn't really care about the reason why the algorithm worked, it was enough for him to know that it did what it was meant to do.
But to Lexus, there was a huge difference between knowing and understanding. It was akin to knowing how to drive a car versus knowing how to build a car, the latter was vastly more interesting than the former.
Hmmm. Was that why the system picked him?
Lexus didn't know, and he probably wouldn't until much later. For now, all he had to do was focus on learning, gaining experience points, and levelling up. With the help of the system, Lexus was sure that he would be able to go very far in his academics. All it took was some effort, and a little bit of time.
Maybe, just maybe, one day he would be mentioned in textbooks and classrooms, just like many of the great scientists he admired?
Nah. The likes of Isaac Newton and Alan Turing couldn’t be reached just by having a system. But he was curious to see just how far he could go.
=====
For the next month or so, Lexus focused primarily on reading through "Introduction to Algorithms". He had also started "Algorithm Design" in parallel, reading the chapters relating to the same concept. It gave him a new perspective on the same topic, allowing him to form a better understanding of the algorithms involved.
It was also simply much more efficient.
Lexus would ask Arthur about problems he had with implementing the algorithms, but when it came to the mathematics behind them, Arthur wasn't able to help, so Lexus eventually turned to Professor Emerson for guidance.
Having specialised in theoretical computer science, Professor Emerson had extensive knowledge about many of the algorithms covered in the book, including the mathematics behind it. Initially, Lexus’ questions were limited to the few minutes at the end of every supervision, but eventually the questions piled up so much that the professor set up another weekly meeting with Lexus just so Lexus could ask all his questions at once. The meetings were so enlightening that Lexus gained at least 5 experience points each and every time.
Granted, his head felt like it was about to explode from all the new things that he learnt, but that was a small price to pay.
By the time he had completed the two books, Lexus had accumulated so much experience that he was already close to a level up.
"System, can you show me my status?" Lexus asked.
---
Name: Lexus Kagan
Current Quest: Background Knowledge [8/10]
Computer Science: Level 0 [EXP 94/100 (94%)]
Mathematics: Level 1 [EXP 115/1000 (11%)]
Physics: Level 0 [EXP 0/100 (0%)]
Engineering: Level 0 [EXP 0/100 (0%)]
Chemistry: Level 0 [EXP 0/100 (0%)]
Biology: Level 0 [EXP 0/100 (0%)]
---
Yes, 6 points to go!
"Introduction to Algorithms" and "Algorithm Design" brought him 64 experience points - more than 3 mathematics textbooks combined. It might have been due to the sheer length of the books, but it also probably had to do with how invested he was in the learning process, and how much he actually took out of the words he read.
If he was honest, most of the experience probably came from the weekly meetings with Professor Emerson. It just went to show how much of a difference a good teacher could make. Damn, he should have started asking questions earlier!
Advertisement
- In Serial17 Chapters
Cycles of Power
Riva is a sapient dungeon trying to survive and discover where she came from. But no one exists in isolation. Will Riva be able to survive the adventurers and intrigue to come? Who is this human in her visions? Will Riva ever reclaim her past and secure a future?... Thousands of years ago wild dungeons appeared out of nowhere and conquered the world. Armies could not hold back the infinite hordes of spawned monsters. The sapient races barely eked out survival in the corners of the world. Only the infighting between the savage dungeons allowed the sentient races to outlive these dark ages. Out of this struggle, adventurers were forged. By conquering weaker dungeons, adventurers discovered how to capture life energy to perform great feats of strength and create magic. Now, as adventurers pushed back dungeons, population boomed again. But with rising numbers comes new factions, greed, and war. Caught among these powerhouses lies Riva. ___________________________________________________________________________________________________ On hiatus for the foreseeable future. I finished the first arc, improved my writing a lot, and learned I want to write from a humanoid perspective. Currently building up chapters for new series.
8 234 - In Serial68 Chapters
Mana Soul
Like many others across the multiverse, Markus was chosen as this world's hero to fight against the steadily approaching cataclysm. Only, something went horribly wrong. Left with only a handful of memories, Markus has spent years clawing his way up from poverty and officially registered as an adventurer to try and make his fortune. Unfortunately, Artificers are the least combat-capable class of the four classes, and Markus has no connections to join an established party. With the fate of countless worlds hanging in the balance, a chance meeting will determine the course of a war nearly as old as reality itself. Warning: Markus has trauma induced amnesia and will occasionally 'act out of character' or make 'poorly thought out' decisions. These events are rather obvously telegraphed abd represent conflicts between his current personality and the one repressed alongside his trauma. Just something to bear in mind.The story will bounce predominantly back and forth between the primary protagonists every couple of chapters. The time stream is linear, so events are not revisted/rehashed/retold through the narrative format. Characters may comment on something that has occurred, but that's different. Just giving a heads up.Chapters will be around 7-9k and updated 1/week on the same schedule as my other story Ogre Tyrant over the weekend.[participant in the Royal Road Writathon challenge]
8 146 - In Serial101 Chapters
Shambala Sect
Driven by the desire to meet a billion beauties from a million dwellings, Lirzod of the obscure Faceless Clan, a trusty youngster with a heart full of up-front feelings, embarks on an expedition together with two friends—or followers as he’d love to chaff around folks—to join a sect of repute and pick up his people’s place in the pecking order of earthly assemblies. On his extensive quest owing-to and for love, he discovers aplenty—the unkind darkness dancing amok under heaven, puppeteering cut-throat characters with undreamed-of abilities to act against the wellbeing of the wanting ones. How will Lirzod find his place let alone love in a realm largely ruled by reprobates and scallywags of sundry sorts? And what ensues from his endeavors? Hold your breath, and bear witness to his boundless undertakings. "When I flap my wings, my foes lose their feathers." — Lirzod Basha. ——————————————— A Kind Note: “The story is lengthy, so go easy on ‘hold your breath’ thing, okay?”
8 110 - In Serial11 Chapters
Rise Of The Greatest Magician
At the end of the world, where only a few Gods, Devils, and humans were left to run away from the inevitable, impending darkness, one man managed to make a difference. Using some of the greatest items in the history of the universe, he managed to create a magic array that would send his soul back in time. He intended to take over the body of his younger self but failed, leaving only his instincts behind. Watch on as the troubled Aurus begins his rise to power in what seems to be just a game. ---------------------------- Consumables? I never got why nobody ever uses them, give them all to me! Player killing? Hell yeah I will! I'd love to get their stuff! Creating new types of magic? I mean... it's what I do!
8 79 - In Serial43 Chapters
MIND OF A MENACE
"Lemme find out, imma kill you" "ImMa KiLL yOu"
8 78 - In Serial10 Chapters
The Tragedy of the Hanged King
Ameni is the child of a wealthy merchant, with a bright future ahead of him, however when an eldritch monstrosity named 'The Hanged King', which claims to be the 'God of Misfortune and Madness' forces itself into him, he is banished from his family, is exiled from the city-state that he called home, is deported to a work colony in a far-off land. Having lost both his future and his family, he is on the precipice of suicide, however realizes that doing so would only validate those who have wronged him, he decides that he is going to build the best life possible in this strange new world, even if it is only out of spite. This is my first work of fiction, so expect things like grammar errors and inconsistent chapter lengths Set in a 1700s version of a 'Fallen London'-esque America with magic, expect steampunk, and wild west elements with a focus on world building and dark ambiance
8 146

