ysig / GraKeL

A scikit-learn compatible library for graph kernels
https://ysig.github.io/GraKeL/
Other
588 stars 96 forks source link

Unexpected output to STDOUT when iterating over iterable returned by graph_from_networkx #14

Closed bushidocodes closed 5 years ago

bushidocodes commented 5 years ago

Thank you so much for your work on this library. I'm a graduate student just getting into this technique, and your framework and documentation has been quite helpful! 🙇‍♂️👏

I'm doing a project involving callgraphs of Android malware (~40k vertices), which are currently in gml format. I've been converting them into grakel graphs by way of networkx, as below:

gml_paths = [os.path.join(root, file) for root, directories, files in os.walk(path) for file in files if file.endswith(".gml")]
networkx_graphs = [nx.read_gml(path) for path in gml_paths]
grakel_graphs = graph_from_networkx(networkx_graphs, as_Graph=True)

The thing that is surprising to me is that the second I use grakel_graphs, for example, be coercing into a list list(grakel_graphs), a string representation of the graph gets dumped to STDOUT.

When I work in Jupyter Notebook, this results in the following error: image

Is this a logging feature or is there some way to disable this functionality to silently convert to lists?

Apologies in advance if there is a naive Python issue on my end. I'm an experienced developer, but new to the language ecosystem.

Thanks!

ysig commented 5 years ago

The graph_from_networkx function was a feature that was added at the last moment on the version 0.1.5. There was a dangling print which was removed in the upcoming version 0.1.6. Please Install the latest grakel: https://github.com/ysig/GraKeL/tree/0.1a6 or remove it yourself by commenting lines: https://github.com/ysig/GraKeL/blob/develop/grakel/utils.py#L330 and 331 on your current version.

Sorry for the inconvenience :(