Find online courses made by experts from around the world.
Take your courses with you and learn anywhere, anytime.
Learn and practice realworld skills and achieve your goals.
Note: This course is a subset of our much longer course 'From 0 to 1: Data Structures & Algorithms' so please don't sign up for both:)
This is an animated, visual and spatial way to learn data structures and algorithms
Taught by a Stanfordeducated exGoogler.
The graph is a data structure that is used to model a very large number of real world problems. It's also an programming interview favorite. The study of graphs and algorithms associated with graphs forms an entire field of study called graph theory.
Mail us about anything and we will always reply :)
Not for you? No problem.
30 day money back guarantee.
Forever yours.
Lifetime access.
Learn on the go.
Desktop, iOS and Android.
Get rewarded.
Certificate of completion.
Section 1: Its A Connected World!  

Lecture 0 
You, This Course, and Us!
Preview

01:14  
Lecture 2  15:40  
The graph is a data structure that is used to model a very large number of real world problems. It's also an programming interview favorite. The study of graphs and algorithms associated with graphs forms an entire field of study called graph theory.  
Lecture 3  07:21  
Edges in a graph can be directed or undirected. A graph with directed edges forms a Directed Graph and those with undirected edges forms an Undirected Graph. These edges can be likened to oneway and twoway streets.  
Lecture 4  14:29  
Different relationships can be modeled using either Directed or Undirected graphs. When a graph has no cycles it's called an acyclic graph. A graph with no cycles is basically a tree.  
Lecture 5  08:09  
There are a number of different ways in which graphs can be implemented. However they all follow they same basic graph interface. The graph interface allows building up a graph by adding edges and traversing a graph by giving access to all adjacent vertices of any vertex. 

Lecture 6  15:25  
An adjacency matrix is one way in which a graph can be represented. The graph vertices are rows and columns of the matrix and the cell value shows the relationship between the vertices of a graph.  
Lecture 7  17:53  
The adjacency list and the adjacency set are alternate ways to represent a graph. Here the connection between the vertices is represented using either a linked list or a set.  
Lecture 8  10:08  
Compare the adjacency matrix, adjacency list and the adjacency set in terms of space and time complexity of common operations 

Lecture 9  14:56  
Common traversal methods of trees apply to graphs as well. There is an additional wrinkle with graphs, dealing with cycles and with unconnected graphs. Otherwise the algorithms are exactly the same as those we use to traverse trees. 

Section 2: Graph Algorithms  
Lecture 10  17:30  
Topological sort is an ordering of vertices in a graph where a vertex comes before every other vertex to which it has outgoing edges? A mouthful? This lecture will make things easy to follow. Topological sort is widely used in real world problems.  
Lecture 11  06:56  
Here is the code in Java to implement topological sort.  
Section 3: Shortest Path Algorithms  
Lecture 12  12:38  
Graphs with simple edges (directed or undirected) are unweighted graphs. The distance table is an important data structure used to find the shortest path between any two vertices on a graph. This is used in almost every shortest path algorithm.  
Lecture 13  14:15  
Visualize the shortest path algorithm using the distance table, step by step.  
Lecture 14  06:19  
Shortest path implementation in Java.  
Lecture 15  03:29  
So far we only deal with unweighted graphs. Graphs whose edges have a weight associated are widely used to model real world problems (traffic, length of path etc). 

Lecture 16  18:47  
A greedy algorithm is one which tries to find the local optimum by looking at what is the next best step at every iteration. It does not look at the overall picture. It's best used for optimization problems where the solution is very hard and we want an approximate answer. Finding the shortest path in a weighted graph is a greedy algorithm. 

Lecture 17  14:14  
Dijkstra's algorithm is a greedy algorithm to find the shortest path in a weighted graph.  
Lecture 18  08:15  
The implementation of Dijkstra's algorithm in Java. 

Lecture 19  08:40  
A weighted graph can have edge weights which are negative. Dealing with negative weights have some quirks which are dealt with using the Bellman Ford algorithm. 

Lecture 20  11:22  
Visualize how the Bellman Ford works to find the shortest path in a graph with negative weighted edges.  
Lecture 21  07:36  
If a graph has a negative cycle then it's impossible to find a shortest path as every round of the cycle makes the path shorter! 

Lecture 22 
Implementation Of The Bellman Ford Algorithm

06:54  
Section 4: Spanning Tree Algorithms  
Lecture 23  17:27  
A minimal spanning tree is a tree which covers all the vertices of of the graph and has the lowest cost. Prim's algorithm is very similar to Dijkstra's shortest path algorithm with a few differences.  
Lecture 24  09:52  
The minimal spanning tree is used when we want to connect all vertices at the lowest cost, it's not the shortest path from source to destination. Let's see how we implement Prim's algorithm in Java. 

Lecture 25  08:43  
Kruskal's algorithm is another greedy algorithm to find a minimal spanning tree.  
Lecture 26 
Implementation Of Kruskal's Algorithm

07:34  
Section 5: Graph Problems  
Lecture 27  13:01  
Given a course list and prereqs for every course design a course schedule so prereqs are done before the courses.  
Lecture 28  14:31  
Find the shortest path in a weighted graph where the number of edges also determine which path is shorter. 
Loonycorn is us, Janani Ravi, Vitthal Srinivasan, Swetha Kolalapudi and Navdeep Singh. Between the four of us, we have studied at Stanford, IIM Ahmedabad, the IITs and have spent years (decades, actually) working in tech, in the Bay Area, New York, Singapore and Bangalore.
Janani: 7 years at Google (New York, Singapore); Studied at Stanford; also worked at Flipkart and Microsoft
Vitthal: Also Google (Singapore) and studied at Stanford; Flipkart, Credit Suisse and INSEAD too
Swetha: Early Flipkart employee, IIM Ahmedabad and IIT Madras alum
Navdeep: longtime Flipkart employee too, and IIT Guwahati alum
We think we might have hit upon a neat way of teaching complicated tech courses in a funny, practical, engaging way, which is why we are so excited to be here on Udemy!
We hope you will try our offerings, and think you'll like them :)