google-deepmind / graph_nets

Build Graph Nets in Tensorflow
https://arxiv.org/abs/1806.01261
Apache License 2.0
5.34k stars 783 forks source link

Problem with plot_compare_graphs function #155

Open SamitaAdhiakri opened 6 months ago

SamitaAdhiakri commented 6 months ago

I'm new in the field of Graph and Networks. Recently I came across your code and tired to run the code. looking at the function like plot_graphs_tuple(graphs_tuple_tf) and plot_compare_graphs(output_graphs, labels=[ "Input graph", "blocks.broadcast_globals_to_nodes", "blocks.broadcast_globals_to_edges", "blocks.broadcast_sender_nodes_to_edges", "blocks.broadcast_receiver_nodes_to_edges"])

There is a function inside these called OrderedMultiDiGraph() inside graph_nx and I tried to search about that particular function unfortunately that function doesnot exists in Networkx but there is function called MultiDiGraph.order() and class called MultiDiGraph(...) Hence it gives error of "AttributeError: module 'networkx' has no attribute 'OrderedMultiDiGraph'"

am I missing something or is it actually error ?

alvarosg commented 6 months ago

Thanks for your message. We are not currently maintaining this library very actively, so if you are interested on using Graph Neural Networks with TensorFlow I would advice to instead use the TF-GNN library instead. There is a GraphNetwork demo in that library.

That said if you want to make this particular problem work you may be able to do it by installing a previous version of the networkx library (e.g. version 2.2), from before OrderedMultiDiGraph was removed, or directly using MultiDiGraph, which in python 3 and above is equivalent to the old OrderedMultiDiGraph.

Hope this helps!