Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6021435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:42:44+00:00 2026-05-23T03:42:44+00:00

I am currently working on a project to pictorially explain the Hopcroft-Karp algorithm. I

  • 0

I am currently working on a project to pictorially explain the Hopcroft-Karp algorithm.

I am using the pseudo-code from the Wikipedia article.

I have also seen this algorithm implemented on Stack Overflow in Python

This would do fantastically if only I didn’t have to understand the algorithm completely to use it.

My questions are as follows: What is the meaning of the Dist[] array in the pseudo-code, and how is the layering of the graph done in the Breadth-First-Search. I have a grasp on the workings of the DFS.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:42:44+00:00Added an answer on May 23, 2026 at 3:42 am

    The standard BFS creates layers such that nodes in successive layers are at a distance of exactly 1 apart (i.e. there is a path of length 1 between the nodes of successive layers).

    for v in G1
        if Pair[v] == NIL
           Dist[v] = 0
           Enqueue(Q,v)
       else
           Dist[v] = INF
    

    So that code initializes the first layer of the BFS tree, setting all “free nodes” v (i.e. Pair[v] == NIL) to be at distance 0.

    while Empty(Q) == false
       v = Dequeue(Q)
       for each u in Adj[v]
            if Dist[ Pair[u] ] == INF
                 Dist[ Pair[u] ] = Dist[v] + 1
                 Enqueue(Q,Pair[u])
    

    and this code continues on building the BFS tree layer by layer, for nodes u that are neighbors of v (at distance exactly one).

    Dist[] is just a way to manage the distances from nodes to the initial layer of the BFS

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working on project with Haskell, and have found myself some trouble. I'm
I am currently working on a project that I built using the alpha C4
I am currently working on a project that is moving from .NET 2.0 to
I am currently working on a project where I have several string that may
I'm currently working on a project Euler problem (www.projecteuler.net) for fun but have hit
I am currently working on project where I have to match up a large
I'm currently working on a project about social networking, where I have some problems
I'm currently working on project euler problem 14 . I solved it using a
Iam currently working on a project where i have to read serial port continuously.
Currently working on a project in MVC-3. Trying to put the following code in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.