  Lagrangian and Hamiltonian neural networks (LNNs and HNNs, respectively)
encode strong inductive biases that allow them to outperform other models of
physical systems significantly. However, these models have, thus far, mostly
been limited to simple systems such as pendulums and springs or a single rigid
body such as a gyroscope or a rigid rotor. Here, we present a Lagrangian graph
neural network (LGNN) that can learn the dynamics of articulated rigid bodies
by exploiting their topology. We demonstrate the performance of LGNN by
learning the dynamics of ropes, chains, and trusses with the bars modeled as
rigid bodies. LGNN also exhibits generalizability -- LGNN trained on chains
with a few segments exhibits generalizability to simulate a chain with large
number of links and arbitrary link length. We also show that the LGNN can
simulate unseen hybrid systems including bars and chains, on which they have
not been trained on. Specifically, we show that the LGNN can be used to model
the dynamics of complex real-world structures such as the stability of
tensegrity structures. Finally, we discuss the non-diagonal nature of the mass
matrix and its ability to generalize in complex systems.
