Mostly through implementing the interfaces that are used to interact between graph functionality.
- IGraph is the graph.
- INode is the node.
- IPlugIn and IPlugOut are, well, the in and out plugs.
To display them in a widget, you can use a GraphView.
These interfaces have built in functionality to interact with each other and do a lot of the heavy lifting for you simply by implementing the interfaces.
There's a lot of other interfaces built into Node Graph such as INodeType and probably a few others I'm forgetting - you can look in Graph.cs to see all the major ones.
It's a pretty complex task. If I have time in the new year I might try and compile some information on them and do a write up, but for now documentation is limited. ShaderGraph and ActionGraph should contain enough source code to pull apart and get things working. There's just a lot of reverse engineering required to piece together what is going on.