Random commentary about Machine Learning, BigData, Spark, Deep Learning, C++, STL, Boost, Perl, Python, Algorithms, Problem Solving and Web Search
List firendsOfA = getNeigh(A);List firendsOfB = getNeigh(B);return firendsOfA.intersect(firendsOfB);Assuming that getNeigh() returns the sorted list of neighbors the function intersect() can be implemented in an efficient way. getNeigh() of course returns the list of friends (nodes) directly connected to the input node (the row for the node in the adjacent matrix).Am I missing something?
List firendsOfA = getNeigh(A);
ReplyDeleteList firendsOfB = getNeigh(B);
return firendsOfA.intersect(firendsOfB);
Assuming that getNeigh() returns the sorted list of neighbors the function intersect() can be implemented in an efficient way.
getNeigh() of course returns the list of friends (nodes) directly connected to the input node (the row for the node in the adjacent matrix).
Am I missing something?