G=[#networkx graphs]
G_grakel=grakel.graph_from_networkx(G, node_labels_tag='label')
gk=grakel.WeisfeilerLehman(n_iter=3,normalize=True)
K,base_kernel=gk.fit_transform(G_grakel)
ValueError Traceback (most recent call last)
<ipython-input-2-2589f83f6ffe> in <module>
57 G_grakel=grakel.graph_from_networkx(G, node_labels_tag='label')
58 gk=grakel.WeisfeilerLehman(n_iter=3,normalize=True)
---> 59 K,base_kernel=gk.fit_transform(G_grakel)
60 print(K)
61
~/anaconda3/lib/python3.7/site-packages/grakel/kernels/weisfeiler_lehman.py in fit_transform(self, X, y)
295 raise ValueError('transform input cannot be None')
296 else:
--> 297 km, self.X = self.parse_input(X)
298
299 self._X_diag = np.diagonal(km)
~/anaconda3/lib/python3.7/site-packages/grakel/kernels/weisfeiler_lehman.py in parse_input(self, X)
142 nx = 0
143 Gs_ed, L, distinct_values, extras = dict(), dict(), set(), dict()
--> 144 for (idx, x) in enumerate(iter(X)):
145 is_iter = isinstance(x, collections.Iterable)
146 if is_iter:
~/anaconda3/lib/python3.7/site-packages/grakel/utils.py in graph_from_networkx(X, node_labels_tag, edge_labels_tag, edge_weight_tag, as_Graph)
313
314 if not isinstance(X, Iterable):
--> 315 raise ValueError('X must be an iterable')
316
317 if v2:
ValueError: X must be an iterable
原因:
代入したグラフ配列GがNoneTypeだった