Draw a Graph

In programming, we use graphs to model relationships between objects. Social media, map and GIS software, and the entire World Wide Web are built on top of these simple but foundational data structures.

So what exactly is a graph? A graph is a collection of nodes connected by edges (or lines). Nodes can be anything: people, places, things. Edges connect two or more nodes together. If you're familiar with social networking sites like Facebook or Twitter, you've already seen graphs in action.

Graphs are an extremely powerful tool for understanding our world because they capture relationships between objects, or how those objects relate to one another. You can use them to represent everything from connections between friends on social networks, to road networks that criss-cross cities and countries around the world.

Section Menu

How do I use this section?

1. LESSON

The Simple Reference to Graphs

Graphs are one of the most common data structures in computer science. Especially with today's machine learning and artificial intelligence trends, understanding them is crucial. A shocking amount of real life things can be modeled with graphs. Humans think in associations, so it's obvious why connecting things in this way is practical. But graph...

2. LESSON

Implementing Graphs: Edge List, Adjacency List, Adjacency Matrix

For many students, the graph data structure can be intimidating and difficult to learn. In fact, some of their properties can be baffling to even experienced developers and computer science graduates who haven't worked with them for a while. But graphs are interesting and integral, as they are a vital way of modeling and displaying information...

3. LESSON

Graph Theory: Basic Graph Algorithms Explained

A graph is made up of a limited number of vertices or nodes and a set of edges that link them. When two vertices are connected by the same edge, they are said to be neighboring. In real-world settings such as social media networks, online pages and connections, and GPS locations and itineraries, _graphs have become a v...

4. LESSON

Stay On Top of Topological Sort

Objective: In this lesson, we'll cover this concept, and focus on these outcomes: You'll learn what topological sort is. We'll show you how to use this concept in programming interviews. You'll see how to utilize this concept in challenges. In this lesson, we are g...

5. LESSON

An Illustrated Guide to Dijkstra's Algorithm

In this lesson, we will learn about Dijkstra's algorithm, with a focus on following key points: What is Dijkstra's Algorithm? What are shortest path problems? See a working implementation of Djikstra's algorithm in Python The field of computer science encompasses a wide variety of p...

6. LESSON

An Illustrated Guide to Bellman-Ford and Floyd-Warshall

In this lesson, we will continue where we left off with Dijkstra's, and learn about other different shortest path algorithms. We'll have a focus on following key points: What are some other shortest path algorithms, other than Dijkstra's algorithm? How can we better understand Bellman-Ford and `Floyd-W...

7. LESSON

Understanding Prim's Algorithm

Objective: In this lesson, we’ll deep-dive into one of the most widely used greedy algorithms – Prim’s algorithm. We’ll focus on: Defining the algorithm Going through a detailed step-by-step example on how the algorithm works The algorithm’s real-life applications **Pr...

8. LESSON

Getting to Know Greedy Algorithms Through Examples

In this tutorial, we'll look at yet another technique for finding an optimal solution to a problem. Dynamic programming considers all the solutions of a problem and selects the best or optimal one. But despite finding the most efficient solution, the problem is still speed and memory. For a large...

9. LESSON

What to Know About the Union Find Algorithm

Objective: Unlocking the Power of Union-Find In Today's Lesson, You Will: Understand what Union-Find is and why it's crucial. Learn how to apply Union-Find in technical interviews. Gain insights into solving challenges that require network connectivity. Setting the Stage: Where Al...

10. LESSON

Kruskal's Algorithm: Navigating Minimum Spanning Trees

Kruskal's Algorithm: Your Coding Interview Compass for Navigating Minimum Spanning Trees Welcome to the fascinating realm of graph algorithms! Today, we're diving into Kruskal's Algorithm—a topic that often surfaces in coding interviews. Why? Because it's like a Swiss Army knife for showcasing your mastery of computer science basics. Intr...

11. LESSON

What Is The Manhattan Distance?

The Manhattan Distance is used to calculate the distance between two coordinates in a grid-like path. Imagine you are on holidays in New York City, you are visiting the Empire State Building and decide to walk to The Morgan Library & Museum by the route below. From the map it is easy to see why Manhattan Di...