All problems
Struct2Vec Lite
Problem
Rank nodes by structural similarity to a target using degree difference as a lightweight proxy.
Return all other nodes ordered by increasing absolute degree difference to the target, breaking ties by smallest index. edges is a list of [u, v] pairs and node is the target.
Hint
Struct2Vec captures structural identity rather than proximity in the graph.
Test cases
case 1
in: [5,[[0,1],[0,2],[1,2],[2,3]],0]
expected: [1,2,3,4]
case 2
in: [4,[[0,1],[1,2],[2,3]],1]
expected: [2,0,3]
case 3
in: [3,[[0,1],[1,2]],0]
expected: [2,1]
Starter codePython
def struct2vec_lite(n, edges, node):
# Your code here
pass3 test cases · run your code against them in the editor