title

Graph Introduction - Data Structures & Algorithms Tutorials In Python #12

description

In this video we will go over the introduction of graph data structure in python. There are two types of graphs,
(1) Directed: There is a direction in the way two nodes are connected. Example is flight routes between two cities.
(2) Undirected: There is no direction to how two nodes in the graph are connected. Example is Facebook connections.
Other applications are google map, computer connections in internet or private network, amazon product recommendations etc.
Code: https://github.com/codebasics/data-structures-algorithms-python/tree/master/data_structures/10_Graph/graph.py
Do you want to learn technology from me? Check https://codebasics.io/?utm_source=description&utm_medium=yt&utm_campaign=description&utm_id=description for my affordable video courses.
Image credit attribution:
World wide web photo downloaded from freepik.com. Here is the attribution for it.
a href="https://www.freepik.com/vectors/business" Business vector created by macrovector - www.freepik.com
#graph #datastructures #algorithms #python
Next Video: https://www.youtube.com/watch?v=GnZ9ppr_zaI&list=PLeo1K3hjS3uu_n_a__MI_KktGTLYopZ12&index=13
Previous video: https://www.youtube.com/watch?v=JnrbMQyGLiU&list=PLeo1K3hjS3uu_n_a__MI_KktGTLYopZ12&index=11
Complete playlist:https://www.youtube.com/playlist?list=PLeo1K3hjS3uu_n_a__MI_KktGTLYopZ12
🌎 My Website For Video Courses: https://codebasics.io/?utm_source=description&utm_medium=yt&utm_campaign=description&utm_id=description
Need help building software or data analytics and AI solutions? My company https://www.atliq.com/ can help. Click on the Contact button on that website.
#️⃣ Social Media #️⃣
🔗 Discord: https://discord.gg/r42Kbuk
📸 Dhaval's Personal Instagram: https://www.instagram.com/dhavalsays/
📸 Instagram: https://www.instagram.com/codebasicshub/
🔊 Facebook: https://www.facebook.com/codebasicshub
📝 Linkedin (Personal): https://www.linkedin.com/in/dhavalsays/
📝 Linkedin (Codebasics): https://www.linkedin.com/company/codebasics/
📱 Twitter: https://twitter.com/codebasicshub
🔗 Patreon: https://www.patreon.com/codebasics?fan_landing=true

detail

{'title': 'Graph Introduction - Data Structures & Algorithms Tutorials In Python #12', 'heatmap': [{'end': 1850.761, 'start': 1818.529, 'weight': 1}], 'summary': "Tutorial series on graph data structures and algorithms in python covers basic theory, applications like facebook's friend suggestion and google maps, route optimization, data transformation, path finding, debugging, and shortest path algorithms, offering practical knowledge and potential job opportunities in companies like google flights or priceline.", 'chapters': [{'end': 78.764, 'segs': [{'end': 29.956, 'src': 'embed', 'start': 0.169, 'weight': 1, 'content': [{'end': 3.191, 'text': "In this video, we'll be talking about graph data structure.", 'start': 0.169, 'duration': 3.022}, {'end': 10.355, 'text': "This is an introduction video where we'll go over some basic theory behind graph and then we'll write Python code.", 'start': 3.231, 'duration': 7.124}, {'end': 14.997, 'text': 'Here I have a picture of my Facebook network, just a part of it.', 'start': 11.055, 'duration': 3.942}, {'end': 16.158, 'text': 'My network is pretty big.', 'start': 15.057, 'duration': 1.101}, {'end': 23.282, 'text': 'But in this network, what happens is there are nodes which are people and then they are connected via Facebook.', 'start': 16.938, 'duration': 6.344}, {'end': 29.956, 'text': 'Here is my brother Bowen who is connected with me and then Bowen might have his own connections.', 'start': 24.574, 'duration': 5.382}], 'summary': 'Introduction to graph data structure in python, using facebook network as an example.', 'duration': 29.787, 'max_score': 0.169, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/j0IYCyBdzfA/pics/j0IYCyBdzfA169.jpg'}, {'end': 78.764, 'src': 'embed', 'start': 52.233, 'weight': 0, 'content': [{'end': 57.277, 'text': "One of the utility of graph data structure is Facebook's friend suggestion.", 'start': 52.233, 'duration': 5.044}, {'end': 62.122, 'text': 'So Bowen is my friend, but Bowen has some connection.', 'start': 58.018, 'duration': 4.104}, {'end': 63.082, 'text': "Let's say Nikisha.", 'start': 62.262, 'duration': 0.82}, {'end': 66.826, 'text': 'It is likely that Nikisha can be my friend.', 'start': 63.963, 'duration': 2.863}, {'end': 70.629, 'text': 'Hence, Facebook will suggest Nikisha as my friend suggestion.', 'start': 66.946, 'duration': 3.683}, {'end': 74.032, 'text': 'This is one of the utility of graph.', 'start': 72.31, 'duration': 1.722}, {'end': 78.764, 'text': 'Another example of graph is flight routes.', 'start': 75.603, 'duration': 3.161}], 'summary': 'Graph data structure is used in facebook friend suggestions. it helps in connecting users and suggesting new friends. another example is the use of graph in defining flight routes.', 'duration': 26.531, 'max_score': 52.233, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/j0IYCyBdzfA/pics/j0IYCyBdzfA52233.jpg'}], 'start': 0.169, 'title': 'Graph data structure', 'summary': "Introduces the graph data structure, explaining its basic theory and applications such as facebook's friend suggestion feature and flight route representation.", 'chapters': [{'end': 78.764, 'start': 0.169, 'title': 'Graph data structure', 'summary': "Introduces the graph data structure, explaining its basic theory and applications such as facebook's friend suggestion feature and flight route representation.", 'duration': 78.595, 'highlights': ["Graph data structure serves as the foundation for Facebook's friend suggestion feature. Facebook utilizes the graph data structure to suggest friends based on mutual connections, enhancing the recommendation system.", 'The video provides an introduction to graph data structure, emphasizing its relevance in representing complex networks such as Facebook connections. The video offers an introductory understanding of graph data structure and its application in representing complex networks like Facebook connections.', 'Graph data structure is demonstrated through the example of flight routes. The example of flight routes illustrates the practical application of graph data structure in representing interconnected routes and destinations.']}], 'duration': 78.595, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/j0IYCyBdzfA/pics/j0IYCyBdzfA169.jpg', 'highlights': ['Facebook utilizes the graph data structure to suggest friends based on mutual connections, enhancing the recommendation system.', 'The video offers an introductory understanding of graph data structure and its application in representing complex networks like Facebook connections.', 'The example of flight routes illustrates the practical application of graph data structure in representing interconnected routes and destinations.']}, {'end': 420.295, 'segs': [{'end': 165.41, 'src': 'embed', 'start': 79.324, 'weight': 0, 'content': [{'end': 82.545, 'text': 'So here there are routes between different cities across the world.', 'start': 79.324, 'duration': 3.221}, {'end': 86.166, 'text': 'This is a directed graph because there is a direction.', 'start': 83.065, 'duration': 3.101}, {'end': 89.107, 'text': 'There is a flight from Mumbai to Paris.', 'start': 87.367, 'duration': 1.74}, {'end': 90.848, 'text': 'So there is a direction to it.', 'start': 89.568, 'duration': 1.28}, {'end': 92.929, 'text': "Hence, it's called a directed graph.", 'start': 91.388, 'duration': 1.541}, {'end': 104.349, 'text': "Now, thinking about this, you might think, what's the difference between graph and a tree? Entry, there is only one path between the two nodes.", 'start': 93.809, 'duration': 10.54}, {'end': 113.758, 'text': 'Here you can see that graph is a complex data structure where you can pretty much randomly connect any two nodes.', 'start': 105.09, 'duration': 8.668}, {'end': 123.406, 'text': 'Thinking about Mumbai and New York, there are two paths which connect these two nodes, Mumbai, Paris, New York, Mumbai, Dubai, New York.', 'start': 115.399, 'duration': 8.007}, {'end': 126.689, 'text': 'In fact, there is a third path which is Mumbai, Paris, Dubai, New York.', 'start': 123.786, 'duration': 2.903}, {'end': 129.241, 'text': 'you cannot have this entry.', 'start': 127.921, 'duration': 1.32}, {'end': 132.784, 'text': 'Entry, if there are two nodes, there should be only one path.', 'start': 129.801, 'duration': 2.983}, {'end': 138.787, 'text': 'So then, tree can be thought of as a spatial type of graph.', 'start': 133.524, 'duration': 5.263}, {'end': 153.376, 'text': "Now, one of the common utility of graph is finding the route between two cities, let's say here in the case of our flight route example.", 'start': 139.848, 'duration': 13.528}, {'end': 165.41, 'text': 'You might go to websites such as, you know, like Priceline.com where it allows you to search for flights or Kayak.com.', 'start': 154.884, 'duration': 10.526}], 'summary': 'Directed graph connects cities with multiple routes, unlike tree structure.', 'duration': 86.086, 'max_score': 79.324, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/j0IYCyBdzfA/pics/j0IYCyBdzfA79324.jpg'}, {'end': 245.473, 'src': 'embed', 'start': 215.968, 'weight': 2, 'content': [{'end': 225.417, 'text': 'There could be type of a graph where the edges are weighted, and this weight, in the case of the flight route example,', 'start': 215.968, 'duration': 9.449}, {'end': 227.439, 'text': 'will be the distance between the two cities.', 'start': 225.417, 'duration': 2.022}, {'end': 241.672, 'text': 'In this case, this is called a weighted graph and the shortest path based on a distance is not Mumbai, Paris, New York or Mumbai, Dubai, New York.', 'start': 229.041, 'duration': 12.631}, {'end': 245.473, 'text': 'It is actually Mumbai, Boston, Hartford, New York.', 'start': 242.252, 'duration': 3.221}], 'summary': 'Weighted graph shortest path: mumbai, boston, hartford, new york', 'duration': 29.505, 'max_score': 215.968, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/j0IYCyBdzfA/pics/j0IYCyBdzfA215968.jpg'}], 'start': 79.324, 'title': 'Implementing graph data structure in python', 'summary': 'Explains directed graphs for finding routes between cities, shortest paths in transportation networks using examples of flight route distances, and implementing a graph data structure in python for managing routes, with real-life applications such as google maps.', 'chapters': [{'end': 192.512, 'start': 79.324, 'title': 'Graphs and routes', 'summary': 'Explains the concept of directed graphs in finding routes between cities, highlighting the difference between a graph and a tree, and the common utility of graph in finding routes between cities, with a focus on backend engineering tasks related to graph operations.', 'duration': 113.188, 'highlights': ['Graphs are complex data structures allowing random connections between nodes, demonstrated by multiple paths between Mumbai and New York, with three distinct paths identified (Mumbai-Paris-New York, Mumbai-Dubai-New York, and Mumbai-Paris-Dubai-New York).', 'The difference between a graph and a tree is emphasized by pointing out that in a tree, there is only one path between two nodes, showcasing the spatial nature of a tree as compared to a graph.', 'The common utility of graphs in finding routes between cities is highlighted, with an example of backend engineering tasks to find the shortest or all possible routes between two cities, relevant for websites like Priceline.com, Kayak.com, and Google Flight.', 'Directed graphs, exemplified by the flight route from Mumbai to Paris, are explained as having a specific direction, distinguishing them from undirected graphs and showcasing their relevance in representing flight routes between cities.']}, {'end': 296.967, 'start': 193.993, 'title': 'Shortest paths in transportation networks', 'summary': 'Discusses finding the shortest path in transportation networks, highlighting the example of flight route distances and weighted graphs, and mentions real-life applications such as google maps and internet connectivity.', 'duration': 102.974, 'highlights': ['The concept of finding the shortest path in transportation networks is illustrated with examples of flight routes, where the shortest path in terms of minimum number of stops is Mumbai, Paris, New York and Mumbai, Dubai, New York.', 'The discussion introduces the concept of weighted graphs in the context of flight routes, where the shortest path based on distance is Mumbai, Boston, Hartford, New York.', 'The chapter emphasizes real-life applications of graph theory, such as the usage of graphs in Google Maps for navigation and the representation of internet connectivity through graph topology.']}, {'end': 420.295, 'start': 297.287, 'title': 'Implementing graph data structure in python', 'summary': "Covers how to implement a graph data structure in python, using tuples to represent connections between cities and creating a python class called 'graph' to store and manage the routes.", 'duration': 123.008, 'highlights': ['Using tuples to represent connections between cities, with each tuple indicating a route, is a key concept in implementing the graph data structure in Python.', "The Python class 'graph' is utilized to store and manage the routes, with the 'init' function being employed to store the routes as input arguments.", "The use of a list of tuples to represent routes and the storage of these routes in the 'ages' attribute of the 'graph' class are essential in implementing the graph data structure in Python."]}], 'duration': 340.971, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/j0IYCyBdzfA/pics/j0IYCyBdzfA79324.jpg', 'highlights': ['Graphs allow random connections between nodes, demonstrated by multiple paths between Mumbai and New York.', 'Directed graphs are explained as having a specific direction, distinguishing them from undirected graphs.', 'The concept of finding the shortest path in transportation networks is illustrated with examples of flight routes.', 'Real-life applications of graph theory are emphasized, such as the usage of graphs in Google Maps for navigation.']}, {'end': 880.278, 'segs': [{'end': 505.662, 'src': 'embed', 'start': 421.677, 'weight': 0, 'content': [{'end': 431.931, 'text': "Routes Now we'll be looking at two possible scenarios which is finding all the routes between two cities and finding the shortest route.", 'start': 421.677, 'duration': 10.254}, {'end': 440.188, 'text': 'So here we saw that Between Mumbai and New York, there are these three possible routes that you have.', 'start': 432.252, 'duration': 7.936}, {'end': 444.61, 'text': 'And you want to find the shortest path based on minimum number of stops.', 'start': 441.088, 'duration': 3.522}, {'end': 452.733, 'text': 'You might have seen different website which allows you to do flight booking, where you can specify minimum number of stops.', 'start': 445.33, 'duration': 7.403}, {'end': 457.037, 'text': 'or maybe you can specify two cities and it will tell you all the possible paths.', 'start': 453.513, 'duration': 3.524}, {'end': 463.585, 'text': 'so this is the exact application that we will be implementing, so that you know, once you learn this theory,', 'start': 457.037, 'duration': 6.548}, {'end': 466.729, 'text': 'maybe you can get a job at google flights or maybe priceline.', 'start': 463.585, 'duration': 3.144}, {'end': 474.608, 'text': 'So, in terms of manipulating this information in a proper way,', 'start': 468.539, 'duration': 6.069}, {'end': 484.502, 'text': 'what you need to do is you need to transform these edges from list of tuples to some other, better data structure.', 'start': 474.608, 'duration': 9.894}, {'end': 496.914, 'text': 'because going through these ages, one by one, every time, whenever you are trying to find a path, will be too expensive of an work.', 'start': 485.624, 'duration': 11.29}, {'end': 504.661, 'text': 'but what if we can create this kind of a dictionary where you know?', 'start': 496.914, 'duration': 7.747}, {'end': 505.662, 'text': 'from Mumbai?', 'start': 504.661, 'duration': 1.001}], 'summary': 'Analyzing routes between cities for finding shortest path and efficient data manipulation.', 'duration': 83.985, 'max_score': 421.677, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/j0IYCyBdzfA/pics/j0IYCyBdzfA421677.jpg'}, {'end': 570.075, 'src': 'embed', 'start': 541.293, 'weight': 3, 'content': [{'end': 547.218, 'text': 'So first step we are going to do is transform from this data structure to this data structure.', 'start': 541.293, 'duration': 5.925}, {'end': 549.3, 'text': 'And how do you do that.', 'start': 548.519, 'duration': 0.781}, {'end': 552.722, 'text': "Well it's a simple for loop that you can run here.", 'start': 549.96, 'duration': 2.762}, {'end': 560.572, 'text': 'So I will create graph dictionary first, which will be empty.', 'start': 553.383, 'duration': 7.189}, {'end': 562.712, 'text': 'then I go through all the ages.', 'start': 560.572, 'duration': 2.14}, {'end': 568.635, 'text': 'so I go through all the ages.', 'start': 562.712, 'duration': 5.923}, {'end': 570.075, 'text': 'this is how we go through all the ages.', 'start': 568.635, 'duration': 1.44}], 'summary': 'Transform data structure using a simple for loop to create a graph dictionary.', 'duration': 28.782, 'max_score': 541.293, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/j0IYCyBdzfA/pics/j0IYCyBdzfA541293.jpg'}, {'end': 762.329, 'src': 'embed', 'start': 727.267, 'weight': 4, 'content': [{'end': 731.911, 'text': 'Here in this case, between Mumbai and New York, there are three possible paths.', 'start': 727.267, 'duration': 4.644}, {'end': 738.858, 'text': 'So we will be getting these three paths as a return value from this function.', 'start': 732.192, 'duration': 6.666}, {'end': 753.141, 'text': 'OK, Now, graph and tree is a recursive data structure, so it makes sense that you use recursion here, because, if you think about it,', 'start': 740.24, 'duration': 12.901}, {'end': 762.329, 'text': 'the paths between Mumbai and New York can be found by first finding the paths between Paris and New York.', 'start': 753.141, 'duration': 9.188}], 'summary': 'Three possible paths between mumbai and new york. graph and tree are recursive, so recursion is used.', 'duration': 35.062, 'max_score': 727.267, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/j0IYCyBdzfA/pics/j0IYCyBdzfA727267.jpg'}], 'start': 421.677, 'title': 'Route optimization and data transformation', 'summary': 'Discusses finding all routes and the shortest path between two cities, optimizing data representation for efficient path finding, and its practical applications, potentially leading to job opportunities at companies like google flights or priceline. it also covers transforming data structures using for loops and the creation of a graph dictionary, as well as the implementation of a recursive function to find all possible paths between two points within the graph.', 'chapters': [{'end': 539.512, 'start': 421.677, 'title': 'Route optimization and data transformation', 'summary': 'Discusses finding all routes and the shortest path between two cities, with a focus on optimizing data representation for efficient path finding and its practical applications in flight booking websites, potentially leading to job opportunities at companies like google flights or priceline.', 'duration': 117.835, 'highlights': ['The importance of finding all routes and the shortest path between two cities for efficient flight booking is discussed, with practical applications at companies like Google Flights or Priceline.', 'The need to transform edges from a list of tuples to a more efficient data structure, like a dictionary, for optimizing the process of finding paths, is emphasized.']}, {'end': 880.278, 'start': 541.293, 'title': 'Transforming data structures and recursive functions', 'summary': 'Covers the transformation of data structures using for loops and the creation of a graph dictionary, as well as the implementation of a recursive function to find all possible paths between two points within the graph.', 'duration': 338.985, 'highlights': ['The chapter explains the process of transforming data structures using for loops and creating a graph dictionary. It covers the steps involved in transforming data structures and creating a graph dictionary using a simple for loop, emphasizing the importance of key-value pairs in the dictionary.', 'The chapter details the implementation of a recursive function to find all possible paths between two points within the graph. It discusses the recursive approach to finding paths between two points within the graph, highlighting the importance of using recursion and handling the simplest case first.']}], 'duration': 458.601, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/j0IYCyBdzfA/pics/j0IYCyBdzfA421677.jpg', 'highlights': ['Practical applications at companies like Google Flights or Priceline are discussed.', 'The importance of finding all routes and the shortest path between two cities is emphasized.', 'The need to transform edges from a list of tuples to a more efficient data structure, like a dictionary, is emphasized.', 'The chapter explains the process of transforming data structures using for loops and creating a graph dictionary.', 'The implementation of a recursive function to find all possible paths between two points within the graph is detailed.']}, {'end': 1224.659, 'segs': [{'end': 973.959, 'src': 'embed', 'start': 880.278, 'weight': 2, 'content': [{'end': 889.497, 'text': 'so for that reason I need to take path as an input argument, And path is nothing but path plus start.', 'start': 880.278, 'duration': 9.219}, {'end': 894.321, 'text': 'So path is path plus start.', 'start': 890.017, 'duration': 4.304}, {'end': 901.028, 'text': 'OK Alright, so if I call it just for Mumbai Mumbai.', 'start': 896.503, 'duration': 4.525}, {'end': 904.311, 'text': "Let's just call it and see what happens.", 'start': 902.129, 'duration': 2.182}, {'end': 908.134, 'text': 'So here I will say print.', 'start': 905.011, 'duration': 3.123}, {'end': 916.822, 'text': 'OK Start is Mumbai.', 'start': 910.977, 'duration': 5.845}, {'end': 918.904, 'text': 'End is Mumbai.', 'start': 918.203, 'duration': 0.701}, {'end': 931.81, 'text': 'And paths between start and end.', 'start': 923.646, 'duration': 8.164}, {'end': 937.813, 'text': "This is a Python 3 format string that I'm using here.", 'start': 934.331, 'duration': 3.482}, {'end': 944.157, 'text': 'And those paths will be in route graph.', 'start': 939.114, 'duration': 5.043}, {'end': 955.387, 'text': 'you want to call the method called get paths, which takes start and end as an argument.', 'start': 944.157, 'duration': 11.23}, {'end': 962.514, 'text': 'it takes third argument, which is path, but it has a default value which is blank.', 'start': 955.387, 'duration': 7.127}, {'end': 965.938, 'text': 'so when i call it see, i got mumbai as a path.', 'start': 962.514, 'duration': 3.424}, {'end': 970.082, 'text': 'so for very simple case, it works beautifully.', 'start': 965.938, 'duration': 4.144}, {'end': 973.959, 'text': "Okay, now let's think about some corner case.", 'start': 971.758, 'duration': 2.201}], 'summary': 'Python code takes start and end as arguments, with default path value. works for simple cases.', 'duration': 93.681, 'max_score': 880.278, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/j0IYCyBdzfA/pics/j0IYCyBdzfA880278.jpg'}, {'end': 1107.18, 'src': 'embed', 'start': 1036.426, 'weight': 0, 'content': [{'end': 1038.888, 'text': 'If there is no value return blank array.', 'start': 1036.426, 'duration': 2.462}, {'end': 1052.078, 'text': 'So I can say if start which is an origination point not in graph dictionary then return this.', 'start': 1041.25, 'duration': 10.828}, {'end': 1058.69, 'text': 'so now run this for toronto to mumbai.', 'start': 1053.829, 'duration': 4.861}, {'end': 1061.271, 'text': 'see, i get blank.', 'start': 1058.69, 'duration': 2.581}, {'end': 1063.272, 'text': 'okay, so for this corner case it is working.', 'start': 1061.271, 'duration': 2.001}, {'end': 1071.114, 'text': 'okay. now comes a regular case, which is your recursion and in your recursion.', 'start': 1063.272, 'duration': 7.842}, {'end': 1075.415, 'text': 'so what you want to do is to find routes between mumbai to new york.', 'start': 1071.114, 'duration': 4.301}, {'end': 1080.791, 'text': 'first you need to go through this dictionary.', 'start': 1075.415, 'duration': 5.376}, {'end': 1087.954, 'text': 'you need to go through all the routes that are destination for Mumbai.', 'start': 1080.791, 'duration': 7.163}, {'end': 1093.756, 'text': 'then from all these routes, which means first I will go through Paris and explore all the routes,', 'start': 1087.954, 'duration': 5.802}, {'end': 1098.217, 'text': 'then I will go to Dubai and explore all the routes from Dubai.', 'start': 1093.756, 'duration': 4.461}, {'end': 1107.18, 'text': 'okay, so first thing is running a for loop for node in self dot, graph, dick start.', 'start': 1098.217, 'duration': 8.963}], 'summary': 'Program successfully handles corner case and regular case for route finding.', 'duration': 70.754, 'max_score': 1036.426, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/j0IYCyBdzfA/pics/j0IYCyBdzfA1036425.jpg'}], 'start': 880.278, 'title': 'Path finding and route search in python', 'summary': 'Discusses implementing a python function for finding paths between two points using a graph, using mumbai as an example, and explains the process for finding all possible routes between two cities in a graph using recursion and a dictionary data structure.', 'chapters': [{'end': 973.959, 'start': 880.278, 'title': 'Python path finding', 'summary': 'Discusses implementing a python function for finding paths between two points using a graph, using mumbai as an example, and highlights the use of default arguments and corner cases in the implementation.', 'duration': 93.681, 'highlights': ["The function takes a 'path' as an input argument and adds the 'start' to it, resulting in 'path plus start'.", "The method 'get_paths' is called with 'start' and 'end' as arguments, with a third argument 'path' with a default value, returning Mumbai as a path for a simple case.", "The discussion transitions to considering corner cases after demonstrating the function's functionality with a simple example."]}, {'end': 1224.659, 'start': 974.299, 'title': 'Flight route search algorithm', 'summary': 'Explains how to handle corner cases, such as returning a blank array for a start point with no paths, and outlines the process for finding all possible routes between two cities in a graph using recursion and a dictionary data structure.', 'duration': 250.36, 'highlights': ['Handling corner cases by returning a blank array for a start point with no paths In case of a start point with no paths, the algorithm returns a blank array, ensuring proper handling of corner cases.', 'Using recursion and dictionary data structure to find all possible routes between two cities The algorithm uses recursion and a dictionary data structure to find all possible routes between two cities in a graph, iterating through the routes and calling the function recursively to explore all paths.']}], 'duration': 344.381, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/j0IYCyBdzfA/pics/j0IYCyBdzfA880278.jpg', 'highlights': ['The algorithm uses recursion and a dictionary data structure to find all possible routes between two cities in a graph, iterating through the routes and calling the function recursively to explore all paths.', 'Handling corner cases by returning a blank array for a start point with no paths, ensuring proper handling of corner cases.', "The function takes a 'path' as an input argument and adds the 'start' to it, resulting in 'path plus start'.", "The method 'get_paths' is called with 'start' and 'end' as arguments, with a third argument 'path' with a default value, returning Mumbai as a path for a simple case."]}, {'end': 1581.984, 'segs': [{'end': 1417.616, 'src': 'embed', 'start': 1387.349, 'weight': 0, 'content': [{'end': 1392.234, 'text': 'So if you do debugging, this kind of debugging helps you to understand the recursion better.', 'start': 1387.349, 'duration': 4.885}, {'end': 1398.581, 'text': 'So New York to New York is what path? Well, New York to New York will return just New York as an array.', 'start': 1392.995, 'duration': 5.586}, {'end': 1407.271, 'text': 'So now what happened is we came out of recursion and my new paths Mumbai, Paris Dubai New York.', 'start': 1399.542, 'duration': 7.729}, {'end': 1411.433, 'text': 'so that is Mumbai Paris Dubai New York.', 'start': 1407.271, 'duration': 4.162}, {'end': 1417.616, 'text': 'actually, I could have gone more deeper, but you can do deeper debugging.', 'start': 1411.433, 'duration': 6.183}], 'summary': 'Debugging aids in understanding recursion. new york to new york returns new york as an array. deeper debugging is possible.', 'duration': 30.267, 'max_score': 1387.349, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/j0IYCyBdzfA/pics/j0IYCyBdzfA1387349.jpg'}, {'end': 1525.018, 'src': 'embed', 'start': 1488.419, 'weight': 2, 'content': [{'end': 1505.03, 'text': 'you can just go through the recursion one by one and recursively it will keep on appending all the paths and when you run, okay,', 'start': 1488.419, 'duration': 16.611}, {'end': 1511.412, 'text': 'In the console you see all the paths are being printed now.', 'start': 1508.271, 'duration': 3.141}, {'end': 1513.613, 'text': 'All the three paths are being printed.', 'start': 1511.552, 'duration': 2.061}, {'end': 1518.755, 'text': "OK Now let's write a function to get the shortest path.", 'start': 1514.754, 'duration': 4.001}, {'end': 1525.018, 'text': 'And by shortest path, I mean by number of stops, not by the total distance.', 'start': 1519.396, 'duration': 5.622}], 'summary': 'Recursively append all paths, print three paths, find shortest path by stops.', 'duration': 36.599, 'max_score': 1488.419, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/j0IYCyBdzfA/pics/j0IYCyBdzfA1488419.jpg'}, {'end': 1581.984, 'src': 'embed', 'start': 1545.444, 'weight': 1, 'content': [{'end': 1549.966, 'text': "Okay, doesn't matter, you want to get a path which has sort minimum number of stops.", 'start': 1545.444, 'duration': 4.522}, {'end': 1550.886, 'text': 'So how do you do that?', 'start': 1549.966, 'duration': 0.92}, {'end': 1562.129, 'text': 'Well, one more function get Shortest path.', 'start': 1552.666, 'duration': 9.463}, {'end': 1567.089, 'text': 'Okay, start and path.', 'start': 1562.129, 'duration': 4.96}, {'end': 1569.271, 'text': 'is this okay?', 'start': 1567.089, 'duration': 2.182}, {'end': 1572.194, 'text': 'so now i want to implement this function.', 'start': 1569.271, 'duration': 2.923}, {'end': 1578.2, 'text': 'this function, if you think about it, is quite similar to the previous function.', 'start': 1572.194, 'duration': 6.006}, {'end': 1580.763, 'text': "so let's go step by step again.", 'start': 1578.2, 'duration': 2.563}, {'end': 1581.984, 'text': 'this is a recursive function.', 'start': 1580.763, 'duration': 1.221}], 'summary': 'Implement a function to find the path with the minimum number of stops, similar to the previous function.', 'duration': 36.54, 'max_score': 1545.444, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/j0IYCyBdzfA/pics/j0IYCyBdzfA1545444.jpg'}], 'start': 1224.659, 'title': 'Debugging mumbai to new york path', 'summary': 'Explains the process of debugging a function to find all the possible paths from mumbai to new york, including the recursive steps and the goal of finding the shortest path based on the minimum number of stops.', 'chapters': [{'end': 1581.984, 'start': 1224.659, 'title': 'Debugging mumbai to new york path', 'summary': 'Explains the process of debugging a function to find all the possible paths from mumbai to new york, including the recursive steps and the goal of finding the shortest path based on the minimum number of stops.', 'duration': 357.325, 'highlights': ['The function explains the process of debugging a function to find all the possible paths from Mumbai to New York. The speaker describes the detailed process of setting breakpoints, stepping into the code, and using recursion to find all possible paths from Mumbai to New York.', 'The goal of finding the shortest path based on the minimum number of stops is emphasized. The goal of finding the shortest path based on the minimum number of stops is highlighted, with the speaker explaining that the function will give one of the desired paths with the fewest stops.', 'The explanation of the recursive function for finding the shortest path is described. The speaker discusses the implementation of a recursive function to find the shortest path, emphasizing its similarity to the previous function and the goal of minimizing the number of stops.']}], 'duration': 357.325, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/j0IYCyBdzfA/pics/j0IYCyBdzfA1224659.jpg', 'highlights': ['The function explains the process of debugging a function to find all the possible paths from Mumbai to New York.', 'The goal of finding the shortest path based on the minimum number of stops is emphasized.', 'The explanation of the recursive function for finding the shortest path is described.']}, {'end': 1946.173, 'segs': [{'end': 1741.065, 'src': 'embed', 'start': 1622.748, 'weight': 0, 'content': [{'end': 1624.608, 'text': 'It will not have a key.', 'start': 1622.748, 'duration': 1.86}, {'end': 1626.709, 'text': 'Torrentor is not a key in this dictionary.', 'start': 1624.869, 'duration': 1.84}, {'end': 1628.49, 'text': 'Hence it will return none.', 'start': 1627.229, 'duration': 1.261}, {'end': 1629.79, 'text': "So let's verify.", 'start': 1628.95, 'duration': 0.84}, {'end': 1632.311, 'text': "You can see it's none.", 'start': 1629.81, 'duration': 2.501}, {'end': 1635.812, 'text': 'And this is shortest.', 'start': 1634.231, 'duration': 1.581}, {'end': 1641.786, 'text': 'shortest path, okay.', 'start': 1636.943, 'duration': 4.843}, {'end': 1653.614, 'text': 'and now what if I supply New York and New York?', 'start': 1641.786, 'duration': 11.828}, {'end': 1662.88, 'text': "okay, in that case you want to get maybe like this, because that's the shortest path, basically just one city.", 'start': 1653.614, 'duration': 9.266}, {'end': 1674.319, 'text': 'so then, um, okay, if start is equal to n, then what return?', 'start': 1664.992, 'duration': 9.327}, {'end': 1688.911, 'text': 'what? okay, here again i will do the same thing, which i did here for obvious reasons, and then i return that path.', 'start': 1674.319, 'duration': 14.592}, {'end': 1692.934, 'text': "so now it's new york and new york, run it, and i get this.", 'start': 1688.911, 'duration': 4.023}, {'end': 1701.052, 'text': 'okay, now we need to run the same for loop.', 'start': 1695.211, 'duration': 5.841}, {'end': 1706.534, 'text': "so it's the same for loop, okay, so let's run the same for loop.", 'start': 1701.052, 'duration': 5.482}, {'end': 1715.676, 'text': 'okay. and here, when I am here, I want to make a call to a recursive function which will be get shortest path,', 'start': 1706.534, 'duration': 9.142}, {'end': 1725.839, 'text': 'because the shortest path between Mumbai to New York is equal to shortest path between Paris to New York,', 'start': 1716.795, 'duration': 9.044}, {'end': 1733.222, 'text': 'and then shortest paths add into that the shortest path between Paris to Mumbai.', 'start': 1725.839, 'duration': 7.383}, {'end': 1741.065, 'text': "hence, when I go recursively, I'm always looking for a shortest path between node and end.", 'start': 1733.222, 'duration': 7.843}], 'summary': 'The transcript discusses finding the shortest path between cities using a recursive function and a for loop.', 'duration': 118.317, 'max_score': 1622.748, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/j0IYCyBdzfA/pics/j0IYCyBdzfA1622748.jpg'}, {'end': 1850.761, 'src': 'heatmap', 'start': 1818.529, 'weight': 1, 'content': [{'end': 1831.413, 'text': 'So if the length of that is less than the length of shortest path that we have seen so far, Then I want to keep shortest path to be SP.', 'start': 1818.529, 'duration': 12.884}, {'end': 1835.955, 'text': 'And then you return that path.', 'start': 1833.214, 'duration': 2.741}, {'end': 1842.738, 'text': "So now let's see the path between Mumbai and New York.", 'start': 1837.856, 'duration': 4.882}, {'end': 1848.58, 'text': 'So here is this Mumbai, Paris, New York.', 'start': 1846.299, 'duration': 2.281}, {'end': 1850.761, 'text': 'See Mumbai, Paris, New York.', 'start': 1849.5, 'duration': 1.261}], 'summary': 'Finding shortest path between mumbai and new york, via paris.', 'duration': 32.232, 'max_score': 1818.529, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/j0IYCyBdzfA/pics/j0IYCyBdzfA1818529.jpg'}, {'end': 1946.173, 'src': 'embed', 'start': 1899.407, 'weight': 3, 'content': [{'end': 1903.57, 'text': "But in the future, I'm going to cover graph traversal.", 'start': 1899.407, 'duration': 4.163}, {'end': 1906.432, 'text': 'And I can create maybe 10 videos on graph alone.', 'start': 1903.67, 'duration': 2.762}, {'end': 1915.062, 'text': "so i will be adding more videos on more data structures in the future and i'll try to cover algorithms as well,", 'start': 1907.353, 'duration': 7.709}, {'end': 1917.985, 'text': 'and i will have more exercises for you in the future.', 'start': 1915.062, 'duration': 2.923}, {'end': 1922.09, 'text': "i hope you're enjoying this data structure series so far.", 'start': 1917.985, 'duration': 4.105}, {'end': 1928.196, 'text': 'if you have not seen my previous videos on different data structures, such as linkedin, hash map and so on, please watch them.', 'start': 1922.09, 'duration': 6.106}, {'end': 1932.781, 'text': 'give this video a thumbs up or leave it.', 'start': 1930.398, 'duration': 2.383}, {'end': 1934.222, 'text': 'leave a comment.', 'start': 1932.781, 'duration': 1.441}, {'end': 1941.028, 'text': "I'm putting a lot of effort in making this video, so please make sure you share with your friends.", 'start': 1934.222, 'duration': 6.806}, {'end': 1946.173, 'text': 'if you find this useful, give it a thumbs up and subscribe to my channel, thank you.', 'start': 1941.028, 'duration': 5.145}], 'summary': 'Planning to cover 10 videos on graph traversal and more data structures, with added exercises and algorithms in the future.', 'duration': 46.766, 'max_score': 1899.407, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/j0IYCyBdzfA/pics/j0IYCyBdzfA1899407.jpg'}], 'start': 1581.984, 'title': 'Shortest path algorithms', 'summary': 'Discusses the implementation of a shortest path algorithm using a specific example and a recursive algorithm for finding the shortest path between cities, with a demonstration of path comparisons and future topics mentioned, providing a comprehensive understanding of pathfinding algorithms.', 'chapters': [{'end': 1662.88, 'start': 1581.984, 'title': 'Shortest path algorithm', 'summary': 'Discusses the implementation of a shortest path algorithm using a specific example, where it verifies the calculation for the shortest path from a starting point and tests it with specific inputs, returning the expected results.', 'duration': 80.896, 'highlights': ["The chapter demonstrates the implementation of the shortest path algorithm using a specific example, testing it with 'Torrentor' as the starting point and verifying that it returns 'none', indicating no path from 'Torrentor' (quantifiable data: 'none').", "It further discusses testing the algorithm with 'New York' as both the starting and ending point, and expects the result of a path consisting of just one city, showcasing the algorithm's ability to calculate the shortest path even for the same starting and ending point (quantifiable data: one city)."]}, {'end': 1946.173, 'start': 1664.992, 'title': 'Recursive shortest path algorithm', 'summary': 'Discusses a recursive algorithm for finding the shortest path between cities, emphasizing the process of comparing and updating the shortest path based on the length of the path, with a demonstration of path comparisons and a brief mention of future topics and exercises.', 'duration': 281.181, 'highlights': ['The algorithm recursively computes the shortest path between cities by comparing and updating the shortest path based on the length of the path, with a demonstration of path comparisons and a brief mention of future topics and exercises.', 'The tutorial concludes with a mention of future videos on graph traversal and additional data structures, as well as a request for engagement through likes, comments, and sharing of the content.', 'The speaker emphasizes the importance of watching previous videos on different data structures, such as linked lists and hash maps, and encourages viewers to engage by liking, commenting, and sharing the content.']}], 'duration': 364.189, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/j0IYCyBdzfA/pics/j0IYCyBdzfA1581984.jpg', 'highlights': ["The chapter demonstrates the implementation of the shortest path algorithm using a specific example, testing it with 'Torrentor' as the starting point and verifying that it returns 'none', indicating no path from 'Torrentor' (quantifiable data: 'none').", "It further discusses testing the algorithm with 'New York' as both the starting and ending point, and expects the result of a path consisting of just one city, showcasing the algorithm's ability to calculate the shortest path even for the same starting and ending point (quantifiable data: one city).", 'The algorithm recursively computes the shortest path between cities by comparing and updating the shortest path based on the length of the path, with a demonstration of path comparisons and a brief mention of future topics and exercises.', 'The tutorial concludes with a mention of future videos on graph traversal and additional data structures, as well as a request for engagement through likes, comments, and sharing of the content.', 'The speaker emphasizes the importance of watching previous videos on different data structures, such as linked lists and hash maps, and encourages viewers to engage by liking, commenting, and sharing the content.']}], 'highlights': ['The tutorial series covers basic theory and practical applications of graph data structures and algorithms in Python.', 'Facebook utilizes the graph data structure to suggest friends based on mutual connections, enhancing the recommendation system.', 'Graphs allow random connections between nodes, demonstrated by multiple paths between Mumbai and New York.', 'Real-life applications of graph theory are emphasized, such as the usage of graphs in Google Maps for navigation.', 'The importance of finding all routes and the shortest path between two cities is emphasized.', 'The algorithm uses recursion and a dictionary data structure to find all possible routes between two cities in a graph.', 'The function explains the process of debugging a function to find all the possible paths from Mumbai to New York.', "The chapter demonstrates the implementation of the shortest path algorithm using a specific example, testing it with 'Torrentor' as the starting point and verifying that it returns 'none', indicating no path from 'Torrentor'.", "It further discusses testing the algorithm with 'New York' as both the starting and ending point, and expects the result of a path consisting of just one city, showcasing the algorithm's ability to calculate the shortest path even for the same starting and ending point."]}