René's URL Explorer Experiment


Title: Solve the Maze Using a Graph-Based Approach (Video) – Real Python

Open Graph Title: Solve the Maze Using a Graph-Based Approach – Real Python

Description: Solve the Maze Using a Graph-Based Approach. At this point, you can represent the maze and its solution in an object-oriented form. You can visualize them, as well as serialize the maze using a custom binary file format. Now it’s time to convert…

Open Graph Description: Solve the Maze Using a Graph-Based Approach. At this point, you can represent the maze and its solution in an object-oriented form. You can visualize them, as well as serialize the maze using a custom binary file format. Now it’s time to convert…

Opengraph URL: https://realpython.com/lessons/solve-python-maze-graph-based/

X: @realpython

direct link

Domain: realpython.com


Hey, it has json ld scripts:
  {
    "@context": "https://schema.org",
    "@type": "VideoObject",
    "name": "Solve the Maze Using a Graph\u002DBased Approach",
    "description": "Solve the Maze Using a Graph\u002DBased Approach. At this point, you can represent the maze and its solution in an object\u002Doriented form. You can visualize them, as well as serialize the maze using a custom binary file format. Now it’s time to convert…",
    "thumbnailUrl": ["https://files.realpython.com/media/Build-a-Pac-Man-Maze-Solver-in-Python_Watermarked.c2e79a85fc99.jpg"],
    "uploadDate": "2023-06-06T14:00:00+00:00",
    "duration": "PT3M1S",
    
    "potentialAction": {
      "@type": "SeekToAction",
      "target": "https://realpython.com/lessons/solve-python-maze-graph-based/#t={seek_to_second_number}",
      "startOffset-input": "required name=seek_to_second_number"
    }
  }
  

authorReal Python
theme-color#18354c
color-schemelight dark
twitter:cardsummary_large_image
twitter:imagehttps://files.realpython.com/media/Build-a-Pac-Man-Maze-Solver-in-Python_Watermarked.c2e79a85fc99.jpg
og:imagehttps://files.realpython.com/media/Build-a-Pac-Man-Maze-Solver-in-Python_Watermarked.c2e79a85fc99.jpg
twitter:creator@realpython
og:typevideo.episode
og:site_nameReal Python
apple-mobile-web-app-titleReal Python

Links:

https://realpython.com/
Start Herehttps://realpython.com/start-here/
Learn Python https://realpython.com/lessons/solve-python-maze-graph-based/
Your Learning Plan →Your personalized Python learning planhttps://realpython.com/account/learning-plan/
Python Tutorials →In-depth articles and video courseshttps://realpython.com/search?kind=article&kind=course&order=newest&_from=nav_library
Learning Paths →Guided study plans for accelerated learninghttps://realpython.com/learning-paths/
Quizzes & Exercises →Check your learning progresshttps://realpython.com/search?kind=exercise&kind=quiz&_from=nav_library
Browse Topics →Focus on a specific area or skill levelhttps://realpython.com/tutorials/all/
Reference →Concise definitions for common Python termshttps://realpython.com/ref/
Mentor AI →NewYour personal Python mentorhttps://realpython.com/mentor/
Office Hours →Live Q&A calls with Python expertshttps://realpython.com/office-hours/
Community Chat →Learn with other Pythonistashttps://realpython.com/community/
Live Courses →Live, instructor-led Python courseshttps://realpython.com/live/
Books →Round out your knowledge and learn offlinehttps://realpython.com/products/books/
Podcast →Hear what’s new in the world of Pythonhttps://realpython.com/podcasts/rpp/
Unlock All Content and Become a Python Expert →Get unlimited access to all Real Python has to offerhttps://realpython.com/account/join/?from=navbar_learn
Unlock All Content →Become a Python Experthttps://realpython.com/account/join/?from=navbar_learn
More https://realpython.com/lessons/solve-python-maze-graph-based/
Learner Storieshttps://realpython.com/learner-stories/
Python Newsletterhttps://realpython.com/newsletter/
Python Job Boardhttps://www.pythonjobshq.com
Meet the Teamhttps://realpython.com/team/
Become a Contributorhttps://realpython.com/jobs/
Searchhttps://realpython.com/search
https://realpython.com/search
Joinhttps://realpython.com/account/join/
Sign‑Inhttps://realpython.com/account/login/?intent=navbar&next=%2Flessons%2Fsolve-python-maze-graph-based%2F
Unlock This Lessonhttps://realpython.com/account/join/?utm_source=rp_lesson&utm_content=python-maze-solver
Unlock This Lessonhttps://realpython.com/account/join/?utm_source=rp_lesson&utm_content=python-maze-solver
https://realpython.com/courses/python-maze-solver/#team
Mazes in Python: Build, Visualize, Store, and Solvehttps://realpython.com/courses/python-maze-solver/
Darren Joneshttps://realpython.com/courses/python-maze-solver/#team
Recommended Tutorialhttps://realpython.com/python-maze-solver/
Course Slides (.pdf)https://realpython.com/courses/python-maze-solver/downloads/mazes-in-python-slides/
Sample Code (.zip)https://realpython.com/courses/python-maze-solver/downloads/mazes-in-python-code/
Ask a Questionhttps://realpython.com/lessons/solve-python-maze-graph-based/#discussion
https://realpython.com/feedback/survey/course/python-maze-solver/liked/?from=lesson-title
https://realpython.com/feedback/survey/course/python-maze-solver/disliked/?from=lesson-title
Contentshttps://realpython.com/lessons/solve-python-maze-graph-based/#description
Transcripthttps://realpython.com/lessons/solve-python-maze-graph-based/#transcript
Discussionhttps://realpython.com/lessons/solve-python-maze-graph-based/#discussion
00:00https://realpython.com/lessons/solve-python-maze-graph-based/#t=0.54
Solve the Maze Using a Graph-Based Approach.https://realpython.com/lessons/solve-python-maze-graph-based/#t=0.54
At this point,https://realpython.com/lessons/solve-python-maze-graph-based/#t=4.103
you can represent the maze and its solution in an object-oriented form.https://realpython.com/lessons/solve-python-maze-graph-based/#t=5.51
You can visualize them, as well as serialize the maze using a custom binary filehttps://realpython.com/lessons/solve-python-maze-graph-based/#t=10.15
format.https://realpython.com/lessons/solve-python-maze-graph-based/#t=14.69
00:15https://realpython.com/lessons/solve-python-maze-graph-based/#t=15.87
Now it’s time to convert your maze to a graph and let Python find the shortesthttps://realpython.com/lessons/solve-python-maze-graph-based/#t=15.87
path from the entrance to the exit.https://realpython.com/lessons/solve-python-maze-graph-based/#t=20.45
By the end of this part of the course,https://realpython.com/lessons/solve-python-maze-graph-based/#t=22.447
you’ll have a command-line program for solving and visualizing mazes loaded fromhttps://realpython.com/lessons/solve-python-maze-graph-based/#t=24.79
a specified file.https://realpython.com/lessons/solve-python-maze-graph-based/#t=29.09
00:32https://realpython.com/lessons/solve-python-maze-graph-based/#t=32.86
Graphs are an important data structure in theoretical computer science,https://realpython.com/lessons/solve-python-maze-graph-based/#t=32.86
which often come up during code interviews.https://realpython.com/lessons/solve-python-maze-graph-based/#t=36.3
While you may use them sparingly in your day-to-day programming practice, graphshttps://realpython.com/lessons/solve-python-maze-graph-based/#t=39.47
can help solve a variety of problems, such as finding your way out of a maze.https://realpython.com/lessons/solve-python-maze-graph-based/#t=43.88
00:50https://realpython.com/lessons/solve-python-maze-graph-based/#t=50.57
A graph is a set of nodes and the edges between them.https://realpython.com/lessons/solve-python-maze-graph-based/#t=50.57
Because nodes have nohttps://realpython.com/lessons/solve-python-maze-graph-based/#t=53.753
inherent location in space, when you convert the maze into a graph form,https://realpython.com/lessons/solve-python-maze-graph-based/#t=55.21
you will lose some information about its geometry.https://realpython.com/lessons/solve-python-maze-graph-based/#t=59.23
01:02https://realpython.com/lessons/solve-python-maze-graph-based/#t=62.589
Later,https://realpython.com/lessons/solve-python-maze-graph-based/#t=62.589
you’ll add weights to the edges to represent the cost of traversing eachhttps://realpython.com/lessons/solve-python-maze-graph-based/#t=63.31
connection between two nodes.https://realpython.com/lessons/solve-python-maze-graph-based/#t=66.85
Rather than reinventing the wheel,https://realpython.com/lessons/solve-python-maze-graph-based/#t=70.98
you’ll use a graph representation provided by the popular NetworkX library,https://realpython.com/lessons/solve-python-maze-graph-based/#t=72.98
which ships with a couple of useful graph algorithms.https://realpython.com/lessons/solve-python-maze-graph-based/#t=77.25
01:23https://realpython.com/lessons/solve-python-maze-graph-based/#t=83.08
The first step is to add this library to your pyproject.toml file byhttps://realpython.com/lessons/solve-python-maze-graph-based/#t=83.08
listing it as the project’s dependency.https://realpython.com/lessons/solve-python-maze-graph-based/#t=87.26
01:34https://realpython.com/lessons/solve-python-maze-graph-based/#t=94.78
As a rule of thumb,https://realpython.com/lessons/solve-python-maze-graph-based/#t=94.78
you should avoid specifying concrete dependency versions directly in thehttps://realpython.com/lessons/solve-python-maze-graph-based/#t=95.78
pyproject.toml file,https://realpython.com/lessons/solve-python-maze-graph-based/#t=99.96
particularly when you intend to use your package as a reusable libraryhttps://realpython.com/lessons/solve-python-maze-graph-based/#t=101.24
in other projects that might depend on different NetworkX versions.https://realpython.com/lessons/solve-python-maze-graph-based/#t=105.1
01:51https://realpython.com/lessons/solve-python-maze-graph-based/#t=111.13
However,https://realpython.com/lessons/solve-python-maze-graph-based/#t=111.13
it’s always a good idea to pin dependency versions in a requirements.txt filehttps://realpython.com/lessons/solve-python-maze-graph-based/#t=111.93
to ensure reproducible builds.https://realpython.com/lessons/solve-python-maze-graph-based/#t=116.8
Next,https://realpython.com/lessons/solve-python-maze-graph-based/#t=120.88
reinstall your package in your virtual environment using the editable mode oncehttps://realpython.com/lessons/solve-python-maze-graph-based/#t=122.19
more so that the networkx package becomes available for importing.https://realpython.com/lessons/solve-python-maze-graph-based/#t=126.27
02:17https://realpython.com/lessons/solve-python-maze-graph-based/#t=137.62
You can also create a requirements file pinning specific dependencies.https://realpython.com/lessons/solve-python-maze-graph-based/#t=137.62
02:30https://realpython.com/lessons/solve-python-maze-graph-based/#t=150.63
Before moving on,https://realpython.com/lessons/solve-python-maze-graph-based/#t=150.63
you create your final Python package in your project with the converter andhttps://realpython.com/lessons/solve-python-maze-graph-based/#t=151.95
solver placeholder modules.https://realpython.com/lessons/solve-python-maze-graph-based/#t=155.95
The converter module will contain a few functions for turning your maze into ahttps://realpython.com/lessons/solve-python-maze-graph-based/#t=158.03
graph,https://realpython.com/lessons/solve-python-maze-graph-based/#t=162.33
while the solver module will use those functions as glue code to wrap NetworkX’shttps://realpython.com/lessons/solve-python-maze-graph-based/#t=162.82
algorithms and solve your maze.https://realpython.com/lessons/solve-python-maze-graph-based/#t=167.39
02:51https://realpython.com/lessons/solve-python-maze-graph-based/#t=171.53
So, with the foundations created, in the next section of the course,https://realpython.com/lessons/solve-python-maze-graph-based/#t=171.53
you’ll start writing the converter module to transform the maze into a graph.https://realpython.com/lessons/solve-python-maze-graph-based/#t=174.93
Become a Memberhttps://realpython.com/account/join/
https://realpython.com/lessons/python-maze-class/
Overviewhttps://realpython.com/courses/python-maze-solver/
https://realpython.com/lessons/transform-python-maze-graph/
Mazes in Python: Build and Visualize 02:47 https://realpython.com/videos/python-maze-solver-part-1-overview/
Check Out What You'll Make 02:39 https://realpython.com/videos/python-maze-solver-project/
Lay the Groundwork 04:02 https://realpython.com/videos/python-maze-solver-groundwork/
Scaffold the Project Structure 04:50 https://realpython.com/lessons/python-maze-solver-structure/
Represent the Maze With Objects 06:37 https://realpython.com/lessons/represent-maze-with-objects/
Create Border Patterns 06:32 https://realpython.com/lessons/python-maze-border-patterns/
Model the Square 02:25 https://realpython.com/lessons/model-python-maze-square/
Build the Maze 09:07 https://realpython.com/lessons/build-python-maze/
Visualize the Maze With SVG 04:45 https://realpython.com/lessons/python-maze-svg/
Implement Geometric Primitives 04:48 https://realpython.com/lessons/python-maze-geometric-primitives/
Add More Primitives 03:47 https://realpython.com/lessons/python-maze-more-primitives/
Decompose the Border Into Primitives 04:41 https://realpython.com/lessons/decompose-python-maze-border/
Add More Border Patterns 03:58 https://realpython.com/lessons/python-maze-more-border-patterns/
Build the SVG Renderer 03:49 https://realpython.com/lessons/python-maze-svg-renderer/
Add Features to the Renderer 06:50 https://realpython.com/lessons/python-maze-renderer-features/
Draw the Solution 03:13 https://realpython.com/lessons/draw-python-maze-solution/
Preview the Rendered Maze and Its Solution 04:56 https://realpython.com/lessons/preview-python-maze/
Mazes in Python: Build and Visualize (Recap) 01:14 https://realpython.com/lessons/python-maze-solver-part-1-summary/
Mazes in Python: Store and Solve 01:48 https://realpython.com/videos/python-maze-solver-part-2-overview/
Load the Maze From a Binary File 04:55 https://realpython.com/videos/python-maze-binary-file/
Choose Your Data Alignment 05:09 https://realpython.com/videos/python-maze-data-alignment/
Define the File Header and Body 08:12 https://realpython.com/lessons/python-maze-file-header-and-body/
Serialize the Maze 05:22 https://realpython.com/lessons/serialize-python-maze/
Deserialize the Maze 04:32 https://realpython.com/lessons/deserialize-python-maze/
Make the Maze Self-Contained 04:30 https://realpython.com/lessons/python-self-contained-maze/
Update the Maze Class 03:16 https://realpython.com/lessons/python-maze-class/
Solve the Maze Using a Graph-Based Approach 03:01 https://realpython.com/lessons/solve-python-maze-graph-based/
Transform the Maze Into a Graph 07:06 https://realpython.com/lessons/transform-python-maze-graph/
Find the Shortest Path 05:23 https://realpython.com/lessons/python-maze-shortest-path/
Add Weights to Graph Edges 02:36 https://realpython.com/lessons/python-map-weights-graph-edges/
Introduce Enemies and Rewards 06:04 https://realpython.com/lessons/python-maze-enemies-rewards/
Make a Runnable Script 03:59 https://realpython.com/lessons/python-maze-runnable-script/
Mazes in Python: Store and Solve (Recap) 01:23 https://realpython.com/lessons/python-maze-solver-part-2-summary/
Privacy Policyhttps://realpython.com/privacy-policy/

Viewport: width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover

Robots: max-image-preview:large


URLs of crawlers that visited me.