0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ValueError: X must be an iterable in weisfeiler_lehman.py

Posted at
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だった

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?