<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Mohammed Ashfaq Ashar</title>
    <description>The latest articles on Forem by Mohammed Ashfaq Ashar (@ashfaq1998data).</description>
    <link>https://forem.com/ashfaq1998data</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F516760%2F4ff2c7ff-5c85-44cf-a89b-471567ddbecb.jpeg</url>
      <title>Forem: Mohammed Ashfaq Ashar</title>
      <link>https://forem.com/ashfaq1998data</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ashfaq1998data"/>
    <language>en</language>
    <item>
      <title>Migration of Cypress 12.7 from Cypress 9.7</title>
      <dc:creator>Mohammed Ashfaq Ashar</dc:creator>
      <pubDate>Sun, 12 Mar 2023 05:35:22 +0000</pubDate>
      <link>https://forem.com/ashfaq1998data/migration-of-cypress-127-from-cypress-97-2db5</link>
      <guid>https://forem.com/ashfaq1998data/migration-of-cypress-127-from-cypress-97-2db5</guid>
      <description>&lt;p&gt;Hi all,&lt;br&gt;
I have came up with new interesting topic under cypress automation which is migration of cypress from older version to latest version. Currently i am using cypress 9.7 for my testing purpose, but after going through their new version released, i just migrated to their new latest version which is cypress 12.7. After successful migration, i was able to encounter certain failures of my test files, since it is not compatible with latest version.&lt;/p&gt;

&lt;p&gt;So today my article will give a brief idea about latest cypress version, cool features available, limitations etc. And especially, I wanted to discuss about certain failures I encountered in my current spec files after migration and solution I have applied to resolve them. &lt;/p&gt;

&lt;p&gt;Without any further delay, Let's dive into this cool concept&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Cypress 12
&lt;/h2&gt;

&lt;p&gt;The main feature that was introduced in cypress 12, experimental use of origin and session that was introduced in previous version was removed. You all may wonder what is the origin?. And what is the purpose of using origin in cypress automation script. cy.origin() allows you to visit another domain, driver the browser and return back to the application.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1zm4SEMv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/of2soydeevr13xe7ybwk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1zm4SEMv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/of2soydeevr13xe7ybwk.png" alt="Image description" width="800" height="294"&gt;&lt;/a&gt;&lt;br&gt;
Crossing origins is super common with sites that use third-party authentication. It prevents the tester from writing the automation script, in the way how the real application is operated. With the cypress 12, cy.session() made generally available which is out of experimental status. Therefore experimentalSessionAndOrigin can be safely removed from configuration&lt;/p&gt;

&lt;h2&gt;
  
  
  Cool features compared to Cypress 9.7
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Test isolation are true by default&lt;/li&gt;
&lt;li&gt;The Fix for Dreaded Detached DOM Errors&lt;/li&gt;
&lt;li&gt;Added official support for Vite 4 in component testing&lt;/li&gt;
&lt;li&gt;Experimental memory management to improve memory management of chromium family&lt;/li&gt;
&lt;li&gt;cy.getallcookies() and cy.setallcookies() were added to get and clear cookies for all browser cookies across any domains&lt;/li&gt;
&lt;li&gt;cy.getalllocalstorage() was added to get localStorage data for all origins with which the test has interacted&lt;/li&gt;
&lt;li&gt;Further improved bundling in the binary to reduce startup and unzip time&lt;/li&gt;
&lt;li&gt;Can have single session and origin if we try to have them same in multiple testcases&lt;/li&gt;
&lt;li&gt;Next.js v13 was supported&lt;/li&gt;
&lt;li&gt;Component testing is now beta
and much more ....&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Limitaion on Cypress 12 with 9.7
&lt;/h2&gt;

&lt;p&gt;there are several limitiations available in cypress 12, but I have pointed out some main limitations&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Run all specs was removed from cypress 9.7 onwards. Then on later version, they introduced Run all specs under experimental mode&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Plugin folder no longer available. Therefore setupNodeEvents(on, config) under e2e section which is under cypress.config.ts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;.within() now throws an error when given more than one element as the subject from cypress 12 onwards&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So now the time has come to migrate cypress 9.7 to cypress 12&lt;br&gt;
To make it much more interesting, i will guide you step by step&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;&lt;br&gt;
 In Visual Studio Code, go to package.json file. Then search for the place “cypress” under “devdependencies”. Change it’s version by simply adding the version number infront of cypress as shown in figure below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_Z-5nPdE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tl7s3o82tsxxo2u060ev.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_Z-5nPdE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tl7s3o82tsxxo2u060ev.png" alt="Image description" width="588" height="110"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open the terminal and type the command below&lt;br&gt;
&lt;code&gt;npm update&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;&lt;br&gt;
As next step, run the command &lt;br&gt;
&lt;code&gt;npx cypress open&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Once you run this command, you will be directed to the new UI on migration guide. Depending on the version migration, steps will be shown. So it’s just renaming and conversion. It will automatically done by just clicking “Next button”.&lt;br&gt;
Mostly it will be shown with 3 steps migration&lt;/p&gt;

&lt;p&gt;Step A : Renaming the spec file extension to cy.js or cy.ts depends upon typescript or javascript&lt;br&gt;
Step B : Renaming of cypress/support/index.js to cypress/support/e2e.js&lt;/p&gt;

&lt;p&gt;The above 2 steps are not give a great impact to our code. But the next step is really important which may cause failure to all your spec files to run. After completing this step, you need to identify the root cause of the failure and fix it.&lt;/p&gt;

&lt;p&gt;Step C : Migration of cypress.json file to cypress.config.js / cypress.config.ts&lt;/p&gt;

&lt;p&gt;This step will convert the json file to class file. If you able to encounter any failure on conversion, try to fix it manually.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oxu_VTs0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gsmy1qos5a4h23povirf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oxu_VTs0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gsmy1qos5a4h23povirf.png" alt="Image description" width="800" height="249"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--f6CkAz1M--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yjc57oqypf1jyswcoeyn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--f6CkAz1M--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yjc57oqypf1jyswcoeyn.png" alt="Image description" width="800" height="135"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Congratulations guys!!!!🎉 🥳 👏 . We have now sucessfully migrated to latest version. If you are new to cypress testing, it's totally fine you to write your automation script. But if you already have certain important specs and if they not compatible with cypress 12, then it's going to be a big problem. So you need to fix them as well. Some main problems I have encountered as below. I would like to provide solutions for them as well&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Problem 1&lt;/strong&gt;&lt;br&gt;
.within() now throws an error when given more than one element as the subject, eventhough we have mentioned under conditions&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--b6VgmPbw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yqm812fxicwgkwxkn4r4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--b6VgmPbw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yqm812fxicwgkwxkn4r4.png" alt="Image description" width="774" height="202"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As a solutions, we can introduced first() or last() only if 2 elements are found. But if you have multiple elements, the best option, just obtain that web element id, class name or any unique identifier and use them&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Problem 2&lt;/strong&gt;&lt;br&gt;
There are some occasions when we try to have the same sessions and origin in multiple “it” blocks of the same spec file. Latest Cypress removed the experimental session and origin. Therefore we can have them in a single “it” block, so it will automatically applied to other “it” blocks. If we need to have different sessions or origin in same it blocks, so we can introduce them as required&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WMZw-xGJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9yv3t52oi4wd7vfshs3u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WMZw-xGJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9yv3t52oi4wd7vfshs3u.png" alt="Image description" width="800" height="358"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And that's it.&lt;/p&gt;

&lt;p&gt;I hope this article will be really helpful if you are planning to migrate your automation script to latest version. If you have any further doubts on migration, drop your comments below, I am glad to support you all&lt;/p&gt;

&lt;p&gt;Thank you&lt;/p&gt;

</description>
      <category>cypress</category>
      <category>testing</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Social Login using Cypress 12.7.0</title>
      <dc:creator>Mohammed Ashfaq Ashar</dc:creator>
      <pubDate>Sat, 11 Mar 2023 08:48:08 +0000</pubDate>
      <link>https://forem.com/ashfaq1998data/social-login-using-cypress-1270-5hk7</link>
      <guid>https://forem.com/ashfaq1998data/social-login-using-cypress-1270-5hk7</guid>
      <description>&lt;p&gt;Hi guys !!!!&lt;br&gt;
I am writing this after a long time. Today i am going to share an interesting topic under cypress automation tool, which is social login. Normally we do sign in just by entering the username and password without signin using any sort of social authentication such as google, github, microsoft etc.&lt;/p&gt;

&lt;p&gt;So, today I am here to share, how to perform social login using automation tool which is cypress. Let move step by step&lt;/p&gt;

&lt;p&gt;Step 1&lt;br&gt;
Create the cypress project, by entering following commands&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm init
npm install cypress --save-dev
npx cypress open
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 2&lt;br&gt;
Enter the below line of code under cypress.config.js/ts. This code will check whether Cypress will search for and replace obstructive code in third party .js or .html files. (This piece of code prevent you from displaying 403 error page of Google after entering credentials and to dive into microsoft login page to enter credentials)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;experimentalModifyObstructiveThirdPartyCode: true,
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 3&lt;br&gt;
Now you have successfully created the cypress project. Now it's time to create social login automation script using cypress. In here, i will guide on create social login of google, github and microsft. we can perform same code for facebook sign in as well&lt;br&gt;
Without further delay, Let's dive in automation script&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;describe("1.1- Sign in with Google",
    function () {
    it('1.1.1- Sign in with Google Sample Test', () =&amp;gt; {

    logIntoGoogle("test98@gmail.com","test@1234")
    });
    });


function logIntoGoogle(username, password) {

    Cypress.on(
        'uncaught:exception',
        (err) =&amp;gt;
          !err.message.includes('ResizeObserver loop') &amp;amp;&amp;amp;
          !err.message.includes('Error in protected function')
      )

  cy.visit('https://www.sample.lk/')
  cy.contains("Login").click()

  cy.get('[class="btn--1gFez tertiary--5kHib small--1MQ15 button--juoup gtm-google-login"]').click();



  cy.origin(
    'https://accounts.google.com',
    {
      args: {
        username,
        password,
      },
    },
    ({ username, password }) =&amp;gt; {
      Cypress.on(
        'uncaught:exception',
        (err) =&amp;gt;
          !err.message.includes('ResizeObserver loop') &amp;amp;&amp;amp;
          !err.message.includes('Error in protected function')
      )

      cy.get('input[type="email"]').type(username, {
        log: false,
      })
      // NOTE: The element exists on the original form but is hidden and gets rerendered, which leads to intermittent detached DOM issues
      cy.get('[class="VfPpkd-LgbsSe VfPpkd-LgbsSe-OWXEXe-k8QpJ VfPpkd-LgbsSe-OWXEXe-dgl2Hf nCP5yc AjY5Oe DuMIQc LQeN7 qIypjc TrZEUc lw1w4b"]').click().wait(4000)
      cy.get('[type="password"]').type(password, {
        log: false,
      })
      cy.get('[class="VfPpkd-LgbsSe VfPpkd-LgbsSe-OWXEXe-k8QpJ VfPpkd-LgbsSe-OWXEXe-dgl2Hf nCP5yc AjY5Oe DuMIQc LQeN7 qIypjc TrZEUc lw1w4b"]').click().wait(4000)

    }
  )

  cy.get('.login-icon-container--3oQMU &amp;gt; .justify-content-flex-start--1Xozy &amp;gt; .header-link--woAbP').click();
  cy.contains("Test Sample")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let me give the brief idea on this code structure. In here we are performing google sign in for a sample application. Initially it visits the application and clicks the login button. As next step, it will dive into login page. We can observe multiple social login options are available for user to choose. In this case, we are choosing google sign in. Once "sign in with google" is clicked, it will direct you to another page which is "&lt;a href="https://accounts.google.com"&gt;https://accounts.google.com&lt;/a&gt;", to enter our credentials. But we can observe, intially we are in one url, and now we are in different url, this situation we called Multi-domain testing. To handle this multi-domain testing, we wrap the new different url under command cy.origin(), which you can observe on the above code structure. Then once we entered to new url, we enter the username and password. Also since we move from one domain to another domain, we may able to get uncaught error exception failure. To handle them, we use&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Cypress.on(
        'uncaught:exception',
        (err) =&amp;gt;
          !err.message.includes('ResizeObserver loop') &amp;amp;&amp;amp;
          !err.message.includes('Error in protected function')
      )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the above code within origin. After successful login, it will automatically redirect you to your desired website, which you mentioned under cy.visit(). Also, I have added a small piece of code after redirecting to verify whether the desired page has appeared&lt;/p&gt;

&lt;p&gt;Step 4&lt;br&gt;
Now we have done with all the steps. Time has come to check whether the above steps works fine without failure. To verify it, you just need to run the below code in your terminal&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx cypress open
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let me give the code structure for github signin and microsft signin as well&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;describe("1.1- Sign in with Google",
    function () {
    it('1.1.1- Sign in with Google Sample Test', () =&amp;gt; {
        logIntoMicrosoft("test98@gmail.com","test@1234")




    });
    });


    function logIntoMicrosoft(username, password) {
        cy.visit('https://www.sample.lk/')
        cy.contains("Login").click()
        cy.get('[data-testid="login-page-sign-in-with-microsoft"]').click()



        cy.origin(
          'https://login.microsoftonline.com',
          {
            args: {
              username,
              password,
            },
          },
          ({ username, password }) =&amp;gt; {
            cy.get('input[type="email"]').type(username)
            cy.get('input[type="submit"]').click()
            // cy.get('input[type="password"]').type(password, {
            //   log: false,
            // })
            // cy.get('input[type="submit"]').click()
            // cy.get('#idBtn_Back').click()
          }
        )



        cy.origin(
            'https://login.live.com',
            {
              args: {
                username,
                password,
              },
            },
            ({ username, password }) =&amp;gt; {
              //cy.get('input[type="email"]').type(username)
              //cy.get('input[type="submit"]').click()
              cy.get('input[type="password"]').type(password, {
                log: false,
              })
              cy.get('input[type="submit"]').click()
              cy.get('#idBtn_Back').click()
            }
          )

      }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above code structure for microsoft signin. Here, we need to go to 2 origin, one to enter username and another origin to enter password.&lt;/p&gt;

&lt;p&gt;Finally, let's go to github signin&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;describe("1.1- Sign in with Github",
    function () {
    it('1.1.1- Sign in with Github Sample Test', () =&amp;gt; {

        cy.visit('https://www.sample.lk/')
        cy.contains("Login").click()
        cy.get('[data-testid="login-page-sign-in-with-github"]').click()


        cy.origin('https://github.com', () =&amp;gt; {

        Cypress.on('uncaught:exception', (err, runnable) =&amp;gt; {
            // returning false here prevents Cypress from
            // failing the test
            return false
        })

            cy.get('[id="login_field"]').type("test98@gmail.com")
            cy.get('[id="password"]').type("test@1234");
            cy.get('[class="btn btn-primary btn-block js-sign-in-button"]').click();

            Cypress.on('uncaught:exception', (err, runnable) =&amp;gt; {
                // returning false here prevents Cypress from
                // failing the test
                return false
            })


        })

        cy.wait(10000)




    });
    });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I hope this article will be really helpful for you all if you planning to social authentication using cypress automation for your testing.&lt;br&gt;
If you have any questions, feel free to drop your comment, so then i can able to help you&lt;/p&gt;

&lt;p&gt;Thank you&lt;/p&gt;

</description>
      <category>cypress</category>
      <category>social</category>
      <category>login</category>
      <category>automation</category>
    </item>
    <item>
      <title>Reduction of environmental pollution caused through vehicles using Graph theory</title>
      <dc:creator>Mohammed Ashfaq Ashar</dc:creator>
      <pubDate>Thu, 29 Apr 2021 08:36:08 +0000</pubDate>
      <link>https://forem.com/ucscmozilla/reduction-of-environmental-pollution-caused-through-vehicles-using-graph-theory-2a39</link>
      <guid>https://forem.com/ucscmozilla/reduction-of-environmental-pollution-caused-through-vehicles-using-graph-theory-2a39</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;In this modern era, vehicles are heavily used in all developed and non-developed countries. Day by day, usage of vehicles increased. So it causes several adverse effects to nature. One of the worst effects is Air pollution. Exhaust from vehicles is a significant wellspring of open-air contamination around the world &lt;br&gt;
We simply called the pollution caused by the vehicle “vehicle pollutions”. Vehicular contamination is the presentation of unsafe material into the climate by engine vehicles. These materials, known as contaminations, have a few awful impacts on human wellbeing and the biological system. Transportation is a significant wellspring of air contamination in numerous nations throughout the planet because of the great number of vehicles that are accessible on the streets today. An expansion in buying power implies that more individuals would now be able to manage the cost of vehicles, which is awful for the climate. The air contamination from vehicles in metropolitan territories, especially in large urban areas, has become a major issue. The contamination from vehicles has started to tell through indications like severe cough like asthma, migraine, queasiness, disturbance of eyes, different bronchial and perceivability issues.&lt;br&gt;
Ozone, Particulate matter, Nitrogen oxides, Carbon monoxide, Sulphur dioxide, and hazardous air pollutants are some of the main ingredients of vehicular pollutions. &lt;br&gt;
Due to above such mentioned issues, there is a very simple and clear solution for it. Dijkstra's Algorithm is coming under graph theory that is normally used to find the shortest path between two points.&lt;br&gt;
By applying this practical solution, to this problem, we are successfully able to get rid of these issues. Overall, we can observe that problem is mainly due to the traveling of vehicles worldwide without having a proper and shorter path to reach the destination. So due to it, there will wastage of fuels at the same time, pollutants are released to the environment. By having a shortest between the starting point and ending point, we could able to minimize these issues. Therefore Dijkstra's Algorithm helps us to solve this issue. This algorithm continuously go through all the possible path and get the best shortest path between two points which helps to preserve fuels and minimize the release of pollutants&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fevtqy0oe6h19og6v8pzu.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fevtqy0oe6h19og6v8pzu.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Methodology
&lt;/h3&gt;

&lt;p&gt;In this article, Dijkstra's Algorithm has been used to solve the problem that has already been mentioned. If the vehicles traveled so long without any proper and shortest route rather than regular route, there are high chances of getting pollution. The shortest routing helps for the least pollution.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr40dd1gtslc1uo8do3l2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr40dd1gtslc1uo8do3l2.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
 The following model represents a simple road network model &lt;br&gt;
 with starting point and ending point &lt;/p&gt;

&lt;p&gt;G = (V, E) as per the definition of a graph. “V” represents a set of vertices and “E” represents a set of edges. So the road network has to mapped to graph inorder to have the least pollution to environment and also preserve the fuels.  Therefore vertices, we simply say nodes are compared to cities, and edges were compared to road. And also the values that written on top of the edges are simply said as “weights” according to graph theory. Therefore such graphs are considered to be weighted graphs. These weights are considered the distance between two cities.&lt;/p&gt;

&lt;p&gt;For example, we simply set “C” (red dot) as a starting node. Therefore we make as distance 0 while others to infinity as step 1&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwepkk017t546ma7ju6pw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwepkk017t546ma7ju6pw.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then we can see the neighbor nodes of “C” which are “A”, “B” and “D”. Since “C” is starting node, the weights of “A”, “B” and “D” as follows&lt;br&gt;
A = 0 + 1 = 1 &lt;br&gt;
B = 0 + 7 = 7 &lt;br&gt;
C = 0 + 2 = 2&lt;/p&gt;

&lt;p&gt;So now we can observe the shortest path among all the “A”, “B” and “D” is “A” where C – A is 1.&lt;br&gt;
So now the red dot moves to “A”. from “A”, it is observable that only “B” is neighbor since “C” already visited. Therefore the new weight of “B” is 1 + 3 = 4 which is less than the previous 7.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbo971vaa398yvckslyag.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbo971vaa398yvckslyag.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As a result, we could recursively perform the same procedure inorder to get the least path or weight for all the vertices. The final result would be as follows&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F726ucy6htkw21iyr3z7w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F726ucy6htkw21iyr3z7w.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;so the above weights which are compared with distances are given at top of nodes by taking “C” as a starting point. Inorder to clarify further, we could see on top of “B”, there is a number 4, which represents the shortest path from “C”, where “B” is the final destination. This means the path is, C   A  to B is1+3=4&lt;br&gt;
But if we consider a path as&lt;br&gt;
C to  D  to E  to B which is 2+7+1=10 which is much more long compared to previous, where there will high wastage of fuels and a high amount of pollutants emission to the environment. Therefore Dijkstra's Algorithm solves this problem by finding the shortest path from starting point to all other points in order to reach the final destination with the least pollutants released to the environment. &lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;In this article using the concept of graph theory which is Dijkstra's Algorithm, we tried to solve the problem caused due to unnecessary routes used to reach the final destination which results in environmental pollutions and high fuel consumption.&lt;br&gt;
Therefore as a responsible individual, it is a must to protect nature and preserve fossil fuels for the future generation&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>algorithms</category>
      <category>graph</category>
    </item>
    <item>
      <title>Kruskal's and Prim's algorithm</title>
      <dc:creator>Mohammed Ashfaq Ashar</dc:creator>
      <pubDate>Wed, 13 Jan 2021 14:03:33 +0000</pubDate>
      <link>https://forem.com/ucscmozilla/kruskal-s-and-prism-algorithm-4f05</link>
      <guid>https://forem.com/ucscmozilla/kruskal-s-and-prism-algorithm-4f05</guid>
      <description>&lt;p&gt;Today I have come with an interesting tutorial which is Krushkal’s and prim's algorithm. First of all, I would like to explain to you all about the definition of Data structure and Algorithm. The data structure is considered as the way to organize and store data and information in an efficient way such that you can access them quickly, whereas algorithms are considered as the steps that have to be taken to get the expected output from a given set of inputs.&lt;br&gt;
According to research, many computer science students have facing difficulties to understand Data structure and Algorithm, due to the complexity of the subject. Even though it is hard to understand, it plays a major role in the IT industry.&lt;br&gt;
So, in today’s blog, I would like to give you a brief and clear explanation of Kruskal’s and Prim's algorithm which is widely used in finding a minimum spanning tree. I hope you all have a better foundation in trees and minimum spanning trees. However, I would like to explain this algorithm with all the basic explanations of trees and minimum spanning trees from scratch.&lt;br&gt;
Now let us begin&lt;/p&gt;

&lt;h2&gt;
  
  
  What are trees?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1p2c9sk48tnz4yrhc02g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1p2c9sk48tnz4yrhc02g.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the above figure, I hope you have got some ideas regarding the definition of a tree. Simply, we can say the tree is a collection of edges and vertices. There are several types of trees where each tree has its unique functionalities. Some of the trees are &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Binary tree&lt;/li&gt;
&lt;li&gt;  Red black tree&lt;/li&gt;
&lt;li&gt;  Binary search tree&lt;/li&gt;
&lt;li&gt;  AVL tree&lt;/li&gt;
&lt;li&gt;  B tree &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;and so on.&lt;br&gt;
As I mentioned before, trees are classified into a variety of types due to their functionalities. Some of the functionalities are&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;      Used to hierarchical data&lt;/li&gt;
&lt;li&gt;      Used to implement expression parsers and expression solvers.&lt;/li&gt;
&lt;li&gt;      Used the Memory management subsystem of the Linux kernel to search memory regions of processes during preemption.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;and so on.&lt;/p&gt;

&lt;p&gt;I hope now you have got a better foundation about the definition and uses of Trees. Now let us see what spanning and minimum spanning tree&lt;br&gt;
Initially let us look at spanning tree&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a Spanning tree?
&lt;/h2&gt;

&lt;p&gt;As simply we can say that a spanning tree is a subgraph of an undirected graph, where it consists of all the vertices with a minimum number of edges.&lt;br&gt;
Let's take an example,&lt;br&gt;
Here there is an undirected graph, we have to find the spanning tree of it. &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbfseriquganq9pqe8zr5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbfseriquganq9pqe8zr5.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So initially, we have mentioned all the vertices. Then we have connected them by edges, such that the number of edges is minimum. And here, since it is a tree, there should be any cyclic formation. So as a final output, the spanning tree will look like&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1y4djmbmtuqf812nfdwf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1y4djmbmtuqf812nfdwf.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
There may be several spanning trees we can get from a given undirected graph. As to make this simple, I have given only one spanning tree.&lt;/p&gt;

&lt;p&gt;This is the complete idea of a  spanning tree. I hope you have got some idea about the spanning tree. As a next step, lets us look at the minimum spanning tree, where we are going to learn about Kruskal’sand prim's algorithm&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the Minimum spanning tree?
&lt;/h2&gt;

&lt;p&gt;The minimum spanning tree is a spanning tree, where the addition or the sum of the weight of the edges should be minimum.&lt;br&gt;
I hope you all are wondering, why we have to find the minimum spanning tree, and what is the use &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fobyvp2uks0kfjfzouub0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fobyvp2uks0kfjfzouub0.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
Ok, to clear this issue I would like to give you some practical usage of minimum spanning tree.&lt;br&gt;
It is heavily used in &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Network design such as telephone and cable networks.&lt;/li&gt;
&lt;li&gt;  Traveling salesman problem&lt;/li&gt;
&lt;li&gt;  Cluster analysis&lt;/li&gt;
&lt;li&gt;  Entropy-based image registration
and so on&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Now comes, a big question&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fymk5e140r9sqt33wgcnw.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fymk5e140r9sqt33wgcnw.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How to find a minimum spanning tree from a given undirected graph?&lt;br&gt;
Is there any technique for it?&lt;br&gt;
How to apply it?&lt;/p&gt;

&lt;p&gt;Here the place where Kruskal’s and prim's algorithm comes into play. From all the above information you have got some solid idea about trees, spanning trees, minimum spanning trees, and their applications. Now let us discuss this algorithm &lt;/p&gt;

&lt;h2&gt;
  
  
  How to find Minimum Spanning Tree?
&lt;/h2&gt;

&lt;p&gt;We have two approaches to find the minimum spanning tree. Simply, these 2 approaches are algorithms. They are&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Kruskal’sAlgorithm&lt;/li&gt;
&lt;li&gt;  Prim's Algorithm&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here I am going to explain the above two algorithms thoroughly with example.&lt;br&gt;
Let's look at our 1st algorithm which is the Kruskal's algorithm&lt;/p&gt;

&lt;h2&gt;
  
  
  Kruskal’s Algorithm
&lt;/h2&gt;

&lt;p&gt;This is one approach that we can use to find the minimum spanning tree. &lt;br&gt;
I don’t like to provide algorithm at once so that you won’t get a better understanding. Rather, I would like to provide you with a pictorial example so that you will have a complete picture of this algorithm very clearly&lt;/p&gt;

&lt;p&gt;Let’s look at our example&lt;/p&gt;

&lt;p&gt;Find the minimum spanning tree of the graph below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0xkt064xgmx85f42gw37.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0xkt064xgmx85f42gw37.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 1&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Arrange all the edges in ascending order according to their weight( the value is written on top of the edge). &lt;strong&gt;Src&lt;/strong&gt; means starting vertex and &lt;strong&gt;Dest&lt;/strong&gt; means ending vertex
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdx7b2dqacgggsmm2sqek.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 2&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Now we shall pick the shortest weight out of all
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0sa1dt5tkj7hvgiwyxts.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 3&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Keep in mind, there should be no cycle. So we pick the next short one which is &lt;strong&gt;8 - 2&lt;/strong&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fr41zolg6b26lxkhayacx.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 4&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Pick next short one &lt;strong&gt;6 – 5&lt;/strong&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fu5vk9b5abli5qaslbkdo.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 5&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Pick the next short one which is &lt;strong&gt;0 – 1&lt;/strong&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fq2voesdvqmy652sejexa.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 6&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Pick the next short one which is &lt;strong&gt;2 – 5&lt;/strong&gt; 
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fgl4a80594a7k7mu1c3z0.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 7&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Now the problem comes. The next short one is &lt;strong&gt;8 – 6&lt;/strong&gt; which contains a cycle if we add. So we simply discard it &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 8&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Pick the next short one which is &lt;strong&gt;2 – 3&lt;/strong&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fr7rp9zvlbizjx453n6hb.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 9&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Pick &lt;strong&gt;7 – 8&lt;/strong&gt;. It will result in a cycle. So simply remove it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 10&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Pick the next short one which is &lt;strong&gt;0 – 7&lt;/strong&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbikoty92rv20rlbxz9tx.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 11&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Pick &lt;strong&gt;1 – 2&lt;/strong&gt;. It results in the cycle. So discard it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 12&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Pick the next short one which is &lt;strong&gt;3 – 4&lt;/strong&gt;
This is the final output. Because all the vertices are present in it and also some of the weight is minimum.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F3gsw8hedfi4wr33lu5g2.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now we shall have a look into the Prism algorithm to find a minimum spanning tree&lt;/p&gt;

&lt;h2&gt;
  
  
  Prim's Algorithm
&lt;/h2&gt;

&lt;p&gt;This is another approach that we could follow to obtain the minimum spanning tree.&lt;br&gt;
Let’s take the previous example here itself&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F6vrk1oqyka21ig9ksl5x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F6vrk1oqyka21ig9ksl5x.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope that you can remember the above diagram. This is the same one we have taken before for Kruskal’s algorithm&lt;br&gt;
Let’s see how to find the minimum spanning tree by using this approach&lt;/p&gt;

&lt;p&gt;In this algorithm, we are free to select any vertex as you wish. So to make this algorithm simpler, I am going to select the starting vertex &lt;strong&gt;“0”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Step 1&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Select the node/ vertex as the starting node &lt;strong&gt;(“0”)&lt;/strong&gt; and color with green. Then find all the adjacent vertex of it. Put their weight on the adjacent nodes at the same time make &lt;strong&gt;“0”&lt;/strong&gt; as the weight of the starting node.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fs55pe4lucgdp7e75ua8g.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 2&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  We can observe that weight of &lt;strong&gt;0 – 1&lt;/strong&gt; is &lt;strong&gt;“4”&lt;/strong&gt; while &lt;strong&gt;0 – 7&lt;/strong&gt; is &lt;strong&gt;“8”&lt;/strong&gt;. We have selected the lowest weight edge, which is &lt;strong&gt;0 – 4&lt;/strong&gt;. Since we already found the adjacent node of &lt;strong&gt;“0”&lt;/strong&gt;, now we have to find all the adjacent nodes of &lt;strong&gt;“1”&lt;/strong&gt; and connect it.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Foirsnf96czl5tvvzv25j.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 3&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  We can observe that vertex &lt;strong&gt;“7”&lt;/strong&gt; and vertex &lt;strong&gt;“2”&lt;/strong&gt; have the same weight. We can select any node as per our wish. I am going to select vertex &lt;strong&gt;“7”&lt;/strong&gt; and color it green after finding all the adjacent vertex of &lt;strong&gt;“7”&lt;/strong&gt; and connecting them
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fguvcm8dluf4yon11xhlg.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 4&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Now we can observe that vertex “6” has the lowest weight among vertex &lt;strong&gt;“8”&lt;/strong&gt; and &lt;strong&gt;“2”&lt;/strong&gt;. To find all the adjacent nodes of it and make the vertex “6” with green. We can see that vertex &lt;strong&gt;“8”&lt;/strong&gt; has weight &lt;strong&gt;7&lt;/strong&gt; from vertex &lt;strong&gt;“7”&lt;/strong&gt; while from vertex &lt;strong&gt;“6”&lt;/strong&gt; to vertex &lt;strong&gt;“8”&lt;/strong&gt; it weighs &lt;strong&gt;“6”&lt;/strong&gt;.
Since we need minimum weight, we break the edge &lt;strong&gt;8 – 7&lt;/strong&gt; and connect &lt;strong&gt;6 – 8&lt;/strong&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnh53ff4u99r0zb3ir9e7.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We repeat all the steps as mentioned above, finally, we would able to receive output as where all the nodes are in green color&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fs950u2etcx3k00i5l52p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fs950u2etcx3k00i5l52p.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now I hope you all got a clear understanding of Kruskal’s and prim's algorithm. You are given the freedom to use any two algorithms to find a minimum spanning tree. Some of us feel Kruskal’s algorithm is easier compared to prim's whereas some others feel the prism algorithm is better than Kruskal’s algorithm. &lt;br&gt;
Therefore I have included both the algorithms here so that you are able to get a good understanding of finding a minimum spanning tree.&lt;/p&gt;

&lt;p&gt;See you in our next blog!&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>tutorial</category>
      <category>tree</category>
    </item>
    <item>
      <title>Breadth First search and Depth First Search</title>
      <dc:creator>Mohammed Ashfaq Ashar</dc:creator>
      <pubDate>Wed, 23 Dec 2020 04:43:16 +0000</pubDate>
      <link>https://forem.com/ucscmozilla/breadth-first-search-and-depth-first-search-6gi</link>
      <guid>https://forem.com/ucscmozilla/breadth-first-search-and-depth-first-search-6gi</guid>
      <description>&lt;p&gt;Today, we are discussing an interesting concept related to Data Structures and Algorithms that most of the computer science students face many difficulties in, which is Breadth First Search and Depth First Search also known as BFS and DFS respectively.&lt;/p&gt;

&lt;p&gt;This tutorial for all the beginners who are facing difficulties related to the graph traversal algorithms. There are several graph traversal algorithms in Data structures and Algorithms, but in our  discussion we will be discussing BFS and DFS. Additionally, I would like to give some important background information, so that you would have better foundation in this tutorial in order to  further proceed with BFS and DFS.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why do we need to have graph traversal algorithms?
&lt;/h3&gt;

&lt;p&gt;Before we going further with what is BFS and DFS, it is must to have a clear understanding on why we need this traversal. Normally traversal is used to solve several problems inorder to increase the efficiency. Some examples are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Finding all the nodes which are reachable&lt;/li&gt;
&lt;li&gt;  Finding the best reachable node&lt;/li&gt;
&lt;li&gt;  Finding the best path through a graph
And so on.
The main goal of this type of graph traversal is to find all the nodes that are reachable from a given set of root nodes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What is BFS and DFS?
&lt;/h3&gt;

&lt;p&gt;Breadth First Search (BFS) traversal is mainly used to find the shortest path from a given graph. In order to perform the BFS, we need to implement the Queue Data Structure, which follows the principle of &lt;strong&gt;FIFO (First In First Out)&lt;/strong&gt;. I hope you all have clear idea of Queue Data structure.&lt;/p&gt;

&lt;p&gt;Depth First Search (DFS) traversal mainly traverse the graph in a depthward motion. This traversal is used for cycle detection, strongly connected components and so on. We can implement DFS by using the Stack Data structure, which follows &lt;strong&gt;LIFO (Last In First Out)&lt;/strong&gt; Principle.&lt;/p&gt;

&lt;p&gt;Don’t worry, if you can’t understand the Stack and Queue Data Structure the examples in this article will give you a clear understanding on these data structures. Additionally, you will get a good knowledge in finding the BFS and DFS for a given graph. &lt;/p&gt;

&lt;h3&gt;
  
  
  Finding the BFS for the given graph
&lt;/h3&gt;

&lt;p&gt;Now we have started a more interesting concept that is how to find the BFS for a given graph. &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9wr9y35xq4z86u3505a7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9wr9y35xq4z86u3505a7.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's consider the simple graph given above. This problem is solved by breaking our problem into several steps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Initialize a queue. We insert the element in the rear end of the queue and remove the element from the front end
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4yggn413ae3u943pyhjv.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Select a starting node and colour it. For our easiness I have selected the element &lt;strong&gt;“S”&lt;/strong&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvsxr70u236zm059xwpt6.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Now, we select the adjacent node of &lt;strong&gt;“S”&lt;/strong&gt;, which is not coloured. According to our example, we can see &lt;strong&gt;A, B and C&lt;/strong&gt; are adjacent of &lt;strong&gt;S&lt;/strong&gt; and not coloured. So, I select &lt;strong&gt;“A”&lt;/strong&gt;. And insert into queue and colour it
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnz0fya2nfoqnj65pvxbb.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 4&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Now the next element which is adjacent to &lt;strong&gt;“S”&lt;/strong&gt; is &lt;strong&gt;“B”&lt;/strong&gt;. So colour and insert it
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fcftdfhpn0xakce435pm0.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 5&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Similarly, we can observe the next adjacent element of &lt;strong&gt;“S”&lt;/strong&gt; is &lt;strong&gt;“C”&lt;/strong&gt;. Colour and insert it
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fl4gdhfrbp50herwijiby.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 6&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Now we can see there is no further visited nodes of &lt;strong&gt;“S”&lt;/strong&gt;. So, we can remove element. You know that Queue follows FIFO. So, the element to remove is &lt;strong&gt;“A”&lt;/strong&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F429qbdae7j3dhlkvzn5g.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 7&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Now we can see only a single adjacent node of &lt;strong&gt;“A”&lt;/strong&gt; which is not visited. So colour it and insert it
So finally, we can see there are no further nodes to colour. So, remove all the elements one by one
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F6p5cbf7aq0pcoxj3qj5x.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, the BFS of the graph is&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;S, A, B, C, D&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I hope you have gotten a better idea in finding the BFS, and also, I hope that now you can solve any type of BFS problem.&lt;/p&gt;

&lt;p&gt;Now let us look at how to find the DFS for the given graph&lt;/p&gt;

&lt;h3&gt;
  
  
  Finding the DFS for the given graph
&lt;/h3&gt;

&lt;p&gt;Similarly, as I explained how to find the BFS, I will help to find the DFS in most simple manner by using the same graph. &lt;/p&gt;

&lt;p&gt;But as I explained before, to implement DFS, we need the  Stack data structure. As you all aware that the Stack follows LIFO which is Last In First Out Principle.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F3prez4d7p4jznw5paezz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F3prez4d7p4jznw5paezz.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  First of all, let's create a stack
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flev1okqcawhnwo8jhfe9.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  You can select whatever node as the starting node. As the previous example in BFS, I have taken &lt;strong&gt;“S”&lt;/strong&gt; as the Starting node. Here too I am taking &lt;strong&gt;“S”&lt;/strong&gt; as my starting node. Colour it and put it into stack
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5lbkxg0s5ef0s35ajh2o.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Now we can see there are 3 adjacent uncoloured nodes, As for our easiness I select &lt;strong&gt;“A”&lt;/strong&gt; next node, colour it and put it into stack
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmi4plzyaihngoc1gbo8r.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 4&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Now we can see top element is &lt;strong&gt;“A”&lt;/strong&gt;. So now we have to select adjacent element of &lt;strong&gt;“A”&lt;/strong&gt;. Since &lt;strong&gt;“D”&lt;/strong&gt; is the only adjacent element, we colour it and put into stack
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Faprq4u0wwremf0x544dw.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 5&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Now adjacent element of &lt;strong&gt;“D”&lt;/strong&gt; is &lt;strong&gt;“B”&lt;/strong&gt;. So, we colour and put into stack
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fsaigsnvtzzy4je1467di.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 6&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  As a next step, we couldn’t see any adjacent element of &lt;strong&gt;“B”&lt;/strong&gt;. so, we simply remove it, so now top value is &lt;strong&gt;“D”&lt;/strong&gt;.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqm01s5o2aizl2shkvevl.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 7&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  So as a final step, we can observe the adjacent element of &lt;strong&gt;“D”&lt;/strong&gt; is &lt;strong&gt;“C”&lt;/strong&gt;, which is not coloured yet. So, we colour it and put into stack.
Now &lt;strong&gt;“C”&lt;/strong&gt; doesn’t have any uncoloured nodes. So, we repeatedly remove the nodes from stack, until we find any uncoloured nodes. 
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fyqgbit95q2ebvrwe2e6j.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So as a result, The DFS of the above graph is&lt;br&gt;
&lt;strong&gt;S, A, D, B, C&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;From above explanation, I hope that you have gained a clear understanding on BFS and DFS. I kindly request you all to go through this tutorial very carefully along with the images. &lt;/p&gt;

&lt;p&gt;Hope to see you soon with my next article! &lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>tutorial</category>
      <category>graph</category>
      <category>traversal</category>
    </item>
    <item>
      <title>AI Vs Deep Learning Vs Machine Learning</title>
      <dc:creator>Mohammed Ashfaq Ashar</dc:creator>
      <pubDate>Wed, 18 Nov 2020 13:43:32 +0000</pubDate>
      <link>https://forem.com/ucscmozilla/ai-vs-deep-learning-vs-machine-learning-11k7</link>
      <guid>https://forem.com/ucscmozilla/ai-vs-deep-learning-vs-machine-learning-11k7</guid>
      <description>&lt;p&gt;Today I came up with an interesting topic which you all are familiar with. That is none other than “Artificial Intelligence, Machine learning and Deep Learning".&lt;/p&gt;

&lt;p&gt;I know that most of us have a great confusion will all these terms. Almost 60% of us assumed that all 3 terms are same in all the aspects. But thats completely wrong.&lt;br&gt;
So, first of all, before we go further, let me resolve this confusion. AI which is known as Artificial Intelligence is considered to be an umbrella of Machine Learning. At same time Machine Learning acts as an umbrella for Deep Learning. The following image represents the complete difference of all these terms.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HxRq2H1k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.edureka.co/blog/wp-content/uploads/2018/03/AI-vs-ML-vs-Deep-Learning.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HxRq2H1k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.edureka.co/blog/wp-content/uploads/2018/03/AI-vs-ML-vs-Deep-Learning.png" alt="enter image description here"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;We all think that Artificial Intelligence was introduced recently. But, its also a wrong assumption. Why?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Yes, AI is not a new word to our world as AI was actually introduced in 1956. Even though it was coined during that era, it was not popular as it is today. The reason for that is the shortage of data. With few data, it is impossible to get accurate results. In this modern era, there is a tremendous usage of data. From Data Statistics, it represents that at year 2018, data usage was nearly 4.4 Zettabytes, but at year 2020, it climbs upto 44 zettabytes. Along with enormous data, now we deal with advanced algorithm and high-end computing power &amp;amp; storage that can handle with these enormous amounts of data as a result it is expected nearly 80% of enterprise will implement AI within next 12 months.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--m6rDYvso--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.itu.int/en/ITU-D/Statistics/PublishingImages/statistics/2019/IndividualsUsingInternet2005_2019.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m6rDYvso--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.itu.int/en/ITU-D/Statistics/PublishingImages/statistics/2019/IndividualsUsingInternet2005_2019.png" alt="enter image description here"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, it is much better for us to have a good knowledge on Artificial Intelligence, Deep learning and Machine learning.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First up, Artificial Intelligence (AI)! What's going on here?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AI is just any code, strategy or calculation that empowers machines to mirror, create and show human perception or conduct. We are in, what many allude to as, the period of "powerless AI". The innovation is still in its earliest stages and is required to make machines fit for busy and all that people do, in the time of "solid AI". To change from powerless AI to solid AI, machines need to become familiar with the methods of people. The procedures and cycles, which help machines in this undertaking are extensively ordered under AI. Machines learn in dominatingly two different ways. Their learning is either directed or unaided.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Yl352fgk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/2400/1%2Ac_fiB-YgbnMl6nntYGBMHQ.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Yl352fgk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/2400/1%2Ac_fiB-YgbnMl6nntYGBMHQ.jpeg" alt="enter image description here"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In managed learning, machines figure out how to anticipate results with  the assistance from information researchers. In unaided learning, machines figure out how to foresee results in a hurry by perceiving designs in input information. At the point when machines can draw important deductions from huge volumes of informational indexes, they show the capacity to adapt profoundly. Profound learning requires counterfeit neural organizations (ANNs), which resemble the natural neural organizations in people. These organizations contain hubs in various layers that are associated and speak with one another to figure out voluminous info information. Profound learning is a subset of AI, which thus, is a subset of man-made brainpower. The three innovations help researchers and examiners decipher huge loads of information and are henceforth pivotal for the field of data science.&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--knBkoO6I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://encrypted-tbn0.gstatic.com/images%3Fq%3Dtbn:ANd9GcRrswrSVyFszmNzJEc0V_xlV6CNi_z9DapXtw%26usqp%3DCAU" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--knBkoO6I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://encrypted-tbn0.gstatic.com/images%3Fq%3Dtbn:ANd9GcRrswrSVyFszmNzJEc0V_xlV6CNi_z9DapXtw%26usqp%3DCAU" alt="enter image description here"&gt;&lt;/a&gt;&lt;br&gt;
I hope from the above information you all got a clear understanding about these 3 different terms!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>deeplearning</category>
    </item>
  </channel>
</rss>
