All problems
Graphlet Kernel Count Lite
Problem
Build the graphlet kernel feature vector of an undirected graph for induced 4-node subgraphs.
For every 4-node subset count its induced edge number, and return a length-7 list where entry e counts subsets that induce exactly e edges. n is the number of nodes and edges is a list of [u, v] pairs.
Hint
Graphlet kernels count small induced patterns as structural features.
Test cases
case 1
in: [4,[[0,1],[1,2],[2,3]]]
expected: [0,0,0,1,0,0,0]
case 2
in: [4,[[0,1],[1,2],[2,3],[3,0]]]
expected: [0,0,0,0,1,0,0]
case 3
in: [5,[[0,1],[1,2],[2,3],[3,4]]]
expected: [0,0,3,2,0,0,0]
case 4
in: [3,[[0,1],[1,2],[2,0]]]
expected: [0,0,0,0,0,0,0]
Starter codePython
from itertools import combinations
def graphlet_kernel_count_lite(n, edges):
# Your code here
pass4 test cases · run your code against them in the editor