How google-deepmind/graph_nets works
Project type and purpose
• This is an open-source Python library (“Graph Nets”) for building and training graph neural networks in TensorFlow + Sonnet.
• It provides core abstractions (graphs, graph-network modules), utilities (NumPy/TF batching & conversion), demos (Jupyter notebooks), docs, and tests.
File structure
• Top level
– setup.py, README.md, LICENSE, CONTRIBUTING.md, images/ (assets), docs/ (static documentation)
• Core package: graph_nets/
– _base.py: common helpers & abstract base classes
– graphs.py: graph data structures (GraphTuple) & I/O
– blocks.py: message-passing building blocks
– modules.py: high-level GraphNetwork and GraphIndependent modules
– utils_np.py / utils_tf.py: batching / unbatching / conversion utilities for NumPy and TF
– demos/ & demos_tf2/: example notebooks + minimal model definitions
– tests/ & tests_tf2/: unit tests for all submodules
README for additional insights
• Core concepts:
– Input: GraphTuple with node, edge, global features
– GraphNetwork: runs edge→node→global update functions via user-supplied MLPs
– Designed for TensorFlow 1.x + Sonnet 1 and TF2 + Sonnet 2
• External dependencies: TensorFlow, dm-sonnet, tensorflow_probability
• Demo use-cases: shortest path, sorting, physical simulation