MHB Analyzing Depth-first Search Edge Types

  • Thread starter Thread starter evinda
  • Start date Start date
  • Tags Tags
    Edge Search
AI Thread Summary
The discussion focuses on applying the Depth-first Search (DFS) algorithm to a graph, specifically calculating the discovery and finish times for each node, as well as classifying the edges. The user seeks confirmation on their calculations of these times and asks how to accurately identify edge types when certain conditions overlap, particularly distinguishing between tree edges and back edges. They also inquire about the significance of red edges in their graph representation, questioning if these indicate tree edges. Additionally, there is confusion regarding the classification of specific edges as forward or back edges. Clarifying these concepts is essential for understanding the DFS algorithm's edge classification.
evinda
Gold Member
MHB
Messages
3,741
Reaction score
0
Hello! (Wave)

I want to apply the Depth-first search algorithm at the following graph.
We consider that at the iteration of the algorithm, we look at the nodes alphabetically. Also the nodes are registered alphabetically in each list. I want to calculate the "discovery" time and the "finish" time for each node and also the kind of each edge.

View attachment 3654
Code:
Depthfirstsearch(G)
   for each v ∈ V
        color[v]=white
        p[v]=NIL
   time=0
   for each v ∈ V
       if color[v]=white then
          Visit(v)

Code:
Visit(u)
  color[u]=gray
  time=time+1
  d[u]=time
  for each v ∈ Adj[u]
       if color[v]=white then
          p[v]=u
          Visit(v)
  color[u]=black
  time=time+1
  f[u]=time

I found these "discovery" and "finish" times:

View attachment 3655

Have I calculated them right? (Thinking)

Also, in order to find the kind of the edges I wanted to use this:

$$\begin{bmatrix}
\text{ tree edges: } x \to y & [d[y],f[y]] \subset [d[x],f[x]] \\ \\
\text{forward edges: } x \to y & [d[x],f[x]] \subset [d[y],f[y]] \\ \\
\text{back edges: } x \to y & [d[y],f[y]] \subset [d[x],f[x]] \\ \\
\text{Cross edges: } x \to y & [d[x],f[x]] \cap [d[y],f[y]]=\varnothing
\end{bmatrix}$$

But, when we have for example the case $[d[y],f[y]] \subset [d[x],f[x]]$ how can we know if it is a tree edge or a back edge? (Thinking)
 
Physics news on Phys.org
I think that I have done some mistakes.. (Lipssealed)
I think that it should be like that:

View attachment 3669But how can we find the type of the edges? :confused:
 

Attachments

  • discfin.png
    discfin.png
    7.2 KB · Views: 102
This graph:

View attachment 3678shows the parent of each node.
When there is a red edge does this mean that we have a tree edge? If so, could you explain me why? (Thinking)

Aren't $jh,ia$ forward edges and $ag$ a back edge? (Thinking)
 

Attachments

  • DNdZr.png
    DNdZr.png
    6.3 KB · Views: 97
I was reading documentation about the soundness and completeness of logic formal systems. Consider the following $$\vdash_S \phi$$ where ##S## is the proof-system making part the formal system and ##\phi## is a wff (well formed formula) of the formal language. Note the blank on left of the turnstile symbol ##\vdash_S##, as far as I can tell it actually represents the empty set. So what does it mean ? I guess it actually means ##\phi## is a theorem of the formal system, i.e. there is a...
Back
Top