Python Programming Examples

Depth-first search in a graph

Depth-first search is a traversal technique in which we traverse a graph and print the vertices exactly once. In this article, we will study and implement the depth-first search for traversing graphs in python. Recommended read: Implementing a graph in Python What is the Depth-First Search Algorithm? In a depth-first search, we traverse each vertex …

Depth-first search in a graph Read More »

Breadth-First Search in a Graph

Breadth-first search is a traversal technique in which we traverse a graph and print the vertices exactly once. In this article, we will study and implement the breadth-first search for traversing graphs in python. What is the Breadth-First Search Algorithm? In breadth-first search, we traverse each vertex of the graph exactly once by starting from …

Breadth-First Search in a Graph Read More »

Implementing a Graph in Python

A graph is a data structure used to illustrate connections between two objects. A simple example of a graph is a geographical map in which different places are connected by roads. In this article, we will study the theoretical aspects of a graph data structure. Additionally, we will implement a graph using two different methods.  …

Implementing a Graph in Python Read More »

Python: Image Segmentation

Hello there fellow coder! Today in this tutorial we will understand what Image Segmentation is and in the later sections implement the same using OpenCV in the Python programming language. What is Image Segmentation? Image Segmentation implies grouping a similar set of pixels and parts of an image together for easy classification and categorization of …

Python: Image Segmentation Read More »

Python: Detecting Contours

Hello fellow learner! Today we will learn about detecting contours in an image. Contours are defined as refined boundaries of objects and can be really helpful in detecting objects. Recommended read: How to detect edges in Python? Detecting Contours using Python So let’s get started with Detecting Contours for images using the OpenCV library in …

Python: Detecting Contours Read More »