
Explore how graphs model real-world relationships, from social networks and maps to biological networks and the web, enabling graph processing and search.
Explore fundamental graph concepts, including vertices and edges, undirected and directed graphs, weighted and unweighted edges, and essential terms like degree, path, cycle, and DAG.
Identify graph problems by spotting path or relation requirements; map entities to vertices and relationships to edges, using graphs for shortest paths, costs, flows, reachability, and complex connections.
Approach graph problems by choosing memory representations: use adjacency matrices for dense graphs with weights, and adjacency lists for sparse graphs; understand undirected vs directed and weighted edges.
Explore graph traversal with depth-first and breadth-first search, learn about minimum cost spanning trees, shortest path algorithms, flow networks, and preview strongly connected components.
Explore graph traversal techniques by comparing depth-first and breadth-first search, handle cycles, and see how traversals support problems like shortest paths, strongly connected components, max flow via Ford-Fulkerson.
Explore depth first search traversal by visiting a vertex, selecting adjacent branches, and marking visited nodes to avoid cycles, using recursive and iterative stack-based implementations.
Demonstrates recursive dfs traversal on a directed graph implemented with an adjacency list in Java, including a graph constructor, an addEdge method, and a visited array to track progress.
Implement iterative depth-first search in Java using a stack and a visited array to traverse a graph, printing and marking vertices while exploring adjacent nodes.
Learn to implement depth-first search with a recursive JavaScript approach for a directed graph using an adjacency list, a visited array, and a traversal that builds a result.
Implement dfs iteratively using a stack to traverse from a start vertex, pushing adjacent unvisited vertices from the adjacency list, and build the result list while marking visited.
implement a recursive dfs traversal in python using an adjacency list, with initialization of vertices and a visited array, add_edge for edges, and a test graph to demonstrate traversal.
Analyze dfs complexity by traversing all vertices and edges; running time is the order of vertices plus edges present in the graph, recursion depth equals vertices, space equals v.
Explore breadth first search traversal, a level-order method for graphs that visits nodes level by level from a source vertex using a queue to enqueue unvisited adjacent vertices.
Implement BFS traversal on a graph using an adjacency list, a queue, and a visited array, visiting and printing vertices in breadth-first order.
Implement a breadth-first search in JavaScript using an adjacency list graph, with a queue and a visited array to traverse from a start vertex and output the visit order.
Implement a Python breadth-first search traversal for a graph using an adjacency list, a visited list, and a queue, printing vertices as they are processed and enqueuing unvisited neighbors.
Analyze bfs complexity by visiting each vertex once and traversing its edges, yielding time complexity equal to vertices plus edges; the queue size defines space complexity, i.e., order of vertices.
Explore spanning trees and minimum spanning trees in weighted undirected graphs; a spanning tree is connected, acyclic, and includes all vertices, while a minimum spanning tree minimizes total edge weight.
Explore prim's algorithm for building a minimum spanning tree on an undirected weighted graph, starting from a vertex and greedily adding the lightest edge to expand the tree.
Implement prim's algorithm to compute a minimum spanning tree from a graph using a selected array, selecting the minimum weight unselected neighbor until v-1 edges.
Implement Prim's algorithm in JavaScript to compute a minimum spanning tree by selecting the minimum weight edge from already selected vertices using a get mst function.
Implement Prim's algorithm in Python to compute a minimum spanning tree from a graph by selecting the lightest edge from already selected vertices until MST contains vertices minus one edges.
Sort edges by increasing weight and add them if they do not form a cycle, yielding a minimum spanning tree for connected graphs or a forest for disconnected graphs.
Explore the union-find algorithm for disjoint sets to detect cycles in undirected graphs, using find and union with path compression and union by rank, and apply it to Kruskal's algorithm.
Explore Kruskal's algorithm for finding a minimum spanning tree in a graph, using java implementation with union-find, edge sorting by weight, and cycle checks.
Kruskal's algorithm in JavaScript by sorting edges by weight, using union-find with path compression and union by rank to build a minimum spanning tree and compute its cost.
Kruskal's algorithm implemented in Python builds a minimum spanning tree by sorting edges by weight, using union-find with path compression and union by rank, iterating until v-1 edges.
Explore shortest path algorithms and their applications in mapping, road networks, and logistics, including single-source shortest paths with Dijkstra's algorithm and all-pairs path problems.
Learn how dijkstra's algorithm finds the shortest distance from a source to all vertices in a weighted graph by updating a distance matrix and a shortest-distance array while visiting nodes.
Implement Dijkstra's algorithm in Java using an adjacency matrix to compute shortest paths from a source, with visited and distance arrays, and dynamic updates of minimum distances.
Demonstrate Dijkstra's algorithm on an adjacency matrix using JavaScript by tracking visited vertices and distances, selecting the minimum-distance vertex, and updating paths to reveal shortest distances from the source.
Implement Dijkstra's algorithm in Python using an adjacency matrix with visited and distance arrays to compute shortest paths from the source, selecting the minimum vertex and printing results.
Explore the Bellman-Ford algorithm for single-source shortest paths on weighted graphs, using dynamic programming and relaxation over n-1 iterations to handle negative weights, unlike Dijkstra, with attention to negative cycles.
Explore Bellman-Ford algorithm with live Java code, building a graph class, edge class, and edge relaxation to compute shortest distances from a source and detect negative cycles.
Explore a live JavaScript implementation of Bellman-Ford to compute shortest distances from a source in a weighted graph. Build graph and edge classes, relax edges, and detect negative cycles.
Build a graph class, add edges, and implement Bellman Ford in Python to compute the shortest distances from a source. Relax edges v-1 times and detect negative cycles.
Learn how the Floyd Warshall algorithm solves all-pairs shortest paths on weighted directed graphs using dynamic programming and intermediate vertices to iteratively update a distance matrix.
Implement the Floyd-Warshall algorithm in Java using an adjacency matrix to compute the shortest paths for all pairs, updating a dist matrix with intermediate vertices and printing the result matrix.
Implement the Floyd-Warshall algorithm on a graph represented by an adjacency matrix, using a dist matrix and intermediate vertices to compute all-pairs shortest paths.
Implement the Floyd-Warshall algorithm in Python to compute all-pairs shortest paths on an adjacency matrix, using inf for unconnected vertices and a triple loop over k, i, and j.
Discover how Johnson's algorithm finds all-pairs shortest paths in weighted directed graphs with possible negative weights by reweighting edges with Bellman-Ford and then running Dijkstra from every vertex.
Johnson's algorithm computes all-pairs shortest paths by collecting edges, applying Bellman-Ford to reweight, and running Dijkstra from every vertex to update and output the shortest distances.
Explore Johnson's algorithm in JavaScript to compute all-pairs shortest paths by reweighting with Bellman-Ford, then running Dijkstra from every vertex.
Johnson's algorithm finds all-pairs shortest paths by using Bellman-Ford to update distances, convert edges to new positive weights, and then run Dijkstra from every vertex, demonstrated in a Python implementation.
Explore flow networks as directed graphs where each edge has a capacity and a flow from a source to a sink. Identify problem types such as maximum flow, minimum cost flow, multi-commodity flow, and nowhere-zero flow, and note the max flow min cut theorem.
Master the Ford-Fulkerson algorithm for max flow by using residual graphs and augmenting paths to maximize flow from source to sink.
implement the edmonds-karp variant of the ford-fulkerson method using bfs to find augmenting paths, update the residual graph, and compute the max flow.
Implement Ford-Fulkerson using BFS, known as Edmonds-Karp, to compute maximum flow in a given graph by building a residual graph, finding augmenting paths, and updating forward and backward edges.
Learn to implement Ford-Fulkerson with breadth-first search (Edmonds-Karp) using a residual graph and augmenting paths to compute the maximum flow.
Explore the max flow min cut theorem, linking maximum s-t flow to the minimum cut, and see how the residual network reveals the cut through forward and backward edges.
Identify strongly connected components in directed graphs where every vertex is reachable from every other. Explore Tarjan's and Kosaraju's algorithms to find SCCs, with examples like abcd and bc.
Explore Tarjan's algorithm for finding strongly connected components in a graph using dfs traversal, dfs_num and dfs_low, with a stack to identify and pop each component.
Explore Tarjan's strongly connected components algorithm implemented in Java, using dfs num, dfs low, a stack, and an adjacency list to detect and print SCCs.
Learn to implement Tarjan's algorithm in JavaScript to identify strongly connected components in a graph, using dfs num, dfs low, and a stack to extract and print them.
Implement Tarjan's algorithm in Python to find strongly connected components in a directed graph using an adjacency list, dfs num, dfs low, a stack, and scc printing.
Discover Kosaraju's algorithm, a dfs-based approach to identify strongly connected components by finishing vertices, reversing the graph, and performing a second dfs to reveal each component.
Implement Kosaraju's algorithm in Java to identify strongly connected components in a directed graph by dfs filling a stack, transposing the graph, and dfs in stack order to print components.
Implement Kosaraju's algorithm in JavaScript to identify strongly connected components by performing dfs, reversing the graph, and running a second dfs to extract sccs.
Kosaraju's algorithm is implemented in Python to find strongly connected components in a directed graph by dfs finishing times, graph transposition, and a second dfs in stack order.
Explore topological sort using Kahn's algorithm to produce a linear order of a directed acyclic graph by repeatedly removing zero in-degree vertices, solving dependency and scheduling problems.
Implement topological sort using kahn's algorithm on a directed graph with adjacency lists and indegree tracking, enqueue zero-indegree vertices, detect negative cycles, and print the final linear order.
Explore topological sort with a live JavaScript implementation using a directed graph, adjacency lists, and a queue-based approach, including in-degree tracking, a zero-indegree queue, and cycle detection.
Build a directed graph in Python using a defaultdict adjacency, compute topological sort with Kahn's algorithm by calculating in-degrees, processing zero-in-degree vertices via a queue, and detecting negative cycles.
Graphs are Amazing!
We will have a lot to cover in this course also the course is coded in Java, JavaScript & Python.
While solving graph algorithms, We may need to visit and process each node present in the graph. And for that, we must know how to traverse the graphs efficiently,
So, first, we will cover graph traversal, where we gonna see the 2 types of graph traversals, Depth First Search, and Breadth-first Search.
Then we will understand Spanning Trees and will see famous algorithms to find minimum cost spanning tree, basically, a minimum cost spanning tree is a tree from the graph connecting all the vertices with single edges each and that all
Of the lowest cost, so to minimize the cost to connect all the vertices.
For example :
Suppose, you own a telecommunication company
and you have towers that spread across the state.
You want to connect them so that data can be passed from one tower to others.
Connecting different towers involve different costs, so the problem is how will you minimize the cost. Here, comes the need of using Minimum spanning tree algorithms to find
That tree connecting all the towers with edges that have a minimum cost, so that the spanning Tree cost is minimum.
After that, we will look to Shortest Path algorithms, these are useful to find the shortest distance from of a source from all the other vertices (called single-source shortest path)
or shortest distance of each vertex with all the
Other vertices, that's called finding all pair shortest path.
For example, finding the distance of a city, let's say Istambul to all the other famous cities of turkey.
Or let's say A person who is planning a trip may need to answer questions such as, “What is the least expensive way to get from Princeton to San Jose?” A person more interested in time than in money may need to know the answer to the question “What is the fastest way to get from Princeton to San Jose?” To answer such questions, we process information about connections (travel routes) between items (towns and cities).
Then we will move to Flow network problems. These are concerned with the networks or graph, having a flow going through it.
There will be problems that ask to maximize the flow across the network or problems that ask to disconnect the source from the destination or sink in minimum cost.
After that we will discuss, algorithms to find strongly connected components in a graph.
Hope you will enjoy the course.
Happy Learning