@ jalaj
consider a graph

2->1
3->1
2->3

apply dfs(1) n dfs(2)...
will give u 2 components although GRAPH is connected....

On Fri, Jul 9, 2010 at 10:23 PM, jalaj jaiswal <jalaj.jaiswa...@gmail.com>wrote:

>
> int count=0;
> for every vertex v{
>      if visited[v]==0
>           dfs(v)
>           count++;
>      }
> count is the number of components in graph........ or m i missing something
> ?
>
>
> On Fri, Jul 9, 2010 at 9:23 PM, amit <amitjaspal...@gmail.com> wrote:
>
>> How to check if a directed graph is connected.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> With Regards,
> Jalaj Jaiswal
> +919026283397
> B.TECH IT
> IIIT ALLAHABAD
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to