
Explore graphs by examining vertices and edges, learn how connectivity and paths model city networks and roads, and understand reachability and degree concepts.
Explore graph concepts and implement graphs using adjacency matrices. Encode edges with boolean values, where 1 marks an edge and 0 indicates no edge, then analyze directed connections between nodes.
Explore dfs and bfs on a graph, printing vertices and their connected children through depth-first and level-order traversal to reveal depth versus level exploration.
Learn to implement depth-first search on graphs using an adjacency matrix. Start from a chosen vertex, track visited nodes, and print the DFS order as you traverse edges.
Demonstrate depth-first search on a graph using a visited array to identify connected components and print the visitation order, starting indices at zero.
Implement breadth-first search on graphs using a queue to visit vertices level by level, marking visited nodes to avoid repeats and printing as you go.
Find a path from a start vertex to a target in a graph by exploring adjacent vertices, tracking visited nodes, and returning the path via DFS.
Explore directed graphs and weighted graphs; assign edge weights representing distances between cities to model travel costs, and analyze reachability and weighted connections using a simple example.
This lecture introduces spanning trees and the minimum spanning tree, showing how a connected acyclic graph connects all vertices with minimal edge weight and outlining MST basics.
Explore Kruskal's introduction to building a minimum spanning tree by selecting the smallest edges in a weighted graph while avoiding cycles.
This lecture explains cycle detection in Kruskal's algorithm using a union-find disjoint-set data structure. It demonstrates tracking vertex parents, performing unions, and checking for cycles before adding edges.
Implement Kruskal's algorithm code by building an edge structure with source, destination, and weight, sorting edges by weight, and detecting cycles to generate the output edges.
Learn how Prim's algorithm builds a minimum spanning tree by starting at a vertex and repeatedly adding the smallest edge that connects the explored set to an unvisited vertex.
Implement Prim's code to build a minimum spanning tree from a graph using an adjacency matrix, starting at a zero-weight vertex and updating edges as you visit.
Examine Prim's output by following weight updates and edge decisions in a graph implementation. Verify results with sample values and see how the program prints the MFC Harbour Bridge.
Explain how Dijastra's algorithm computes the shortest distances from a starting vertex by updating minimum distances and marking visited nodes.
Explore implementing Dijkstra's algorithm to compute shortest paths from a source using an adjacency matrix, tracking distances and visited vertices, selecting the minimum distance vertex, and updating paths.
A demonstration of the Dijkstra algorithm run on a five-vertex graph, updating distances from the source as vertices are explored and confirming consistent results from 0 to all others.
Graphs are used to solve many real-life problems. Graphs are used to represent networks. The networks may include paths in a city or telephone network or circuit network. Graphs are also used in social networks like linkedIn, Facebook. For example, in Facebook, each person is represented with a vertex(or node). Each node is a structure and contains information like person id, name, gender, locale etc.
We are going to start our discussion by looking at the basic terms of graph theory and them jump on to discuss graph theory related algorithms and then implement those with c++. Following are the types of algorithms we are going to discuss in this course.
In this Course we shall Implement many Importants Algorithms like DFS ,BFS, Kruskals, PRims and Dijastra's Algorithms.
We shall understand how to find path in a given graph ,Directed Graphs ,Spanning Trees ,Minimum spanning trees etc.
Minimal Spanning Tree
A spanning tree whose sum of weight (or length) of all its edges is less than all other possible spanning tree of graph G is known as a minimal spanning tree or minimum cost spanning tree.
To implement the minimum cost-spanning tree, the following two methods are used −
Prim’s Algorithm
Kruskal’s Algorithm
Dijkstra’s algorithm is very similar to Prim’s algorithm for minimum spanning tree. Like Prim’s MST, we generate a SPT (shortest path tree) with given source as root. We maintain two sets, one set contains vertices included in shortest path tree, other set includes vertices not yet included in shortest path tree. At every step of the algorithm, we find a vertex which is in the other set (set of not yet included) and has a minimum distance from the source.