Animation Nodes: Create a custom node
In animation nodes, Groups are a kind of subprogram, like Loops or Scripts. To add one, press Shift + A > Subprograms > Group. Then, you can name your group and connect up your grouped nodes to the inputs and outputs of the Group. Here is a gif of this from the Animation Nodes Docs:



You can invoke your group with an Add Subprogram node.