refactored code; interface for node_similarity functions changed