-
Notifications
You must be signed in to change notification settings - Fork 103
Open
Description
Describe the bug
Not sure this is a bug. Does the WL kernel assume the input graph is undirected? From the code, my understanding is that the kernel labels a node only considering its outgoing neighbors. I think this algorithm can work with directed graphs, but now if there is a node without outgoing edge, it will produce error.
To Reproduce
from grakel import Graph
from grakel.kernels import WeisfeilerLehman
graph = {
0: [1, 2],
1: [2],
2: []
}
node_labels1 = {0: "A", 1: "B", 2: "C"}
g = Graph(graph, node_labels=node_labels1)
graphs = [g]
wl_kernel = WeisfeilerLehman(n_iter=2, normalize=True)
K = wl_kernel.fit_transform(graphs)The code above will report a "KeyError: 2" from line 222, in generate_graphs, "grakel/kernels/weisfeiler_lehman.py"
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels