Use Flyod Warshal.....All pair shortest path algo.
initialise d[0] = 1 (i,j) is and edge
now apply flyod warhsal

On Wed, Nov 25, 2009 at 8:59 AM, Aditya Shankar <
[email protected]> wrote:

>
> On Tue, Nov 24, 2009 at 10:46 PM, Rohit Saraf <[email protected]
> > wrote:
>
>> i had already understood what you claimed
>>
>> But MY CLAIM: every pair of nodes in the connected component is connected
>> to every other node in the same connected component. U CANNOT UPDATE ALL THE
>> PAIRS AS EASILY AS U ARE SAYING. For any two nodes in DFS of Graph
>> corresponding entry is 1. Got it?
>>
> If the problem is to _fill_ up matrix entries, unless you can get around
> using adjacency lists/matrices, your complexity will be O(n^2). However, we
> can use an implicit data structure, since all nodes are connected to each
> other. Just use a vector of sets, each set containing the vertices of a
> connected component.
>
> Regards
> Aditya Shankar
>
>
>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<algogeeks%[email protected]>
>> .
>> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected]<algogeeks%[email protected]>
> .
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.


Reply via email to