Interview Question
Do we really need transitive closures for this one?. I mean i=the question is asking about nth neighbor..so cant we extract that information from adjacency matrix itself?
A B C D . . Z
A
B
C
D
.
.
.Z
So, for each row, we need to find out the nth entry that has a '1' marked on it and if it is available then return the corresponding column vertex.
Also, I dont see any modification needed for directed graph.
In case im mistaken,...please do correct me!.
Thanks,
Pavan.
warshall transitive closure
- Anonymous November 30, 2009