I’m in the process of developing a node based system myself right now, but I’m not done yet so I can’t give you any definate answers on how to do it! (^_^)
I started by creating a node class, followed by an attribute class. Attributes can be connected to one another, with each node having one input and multiple outputs. So in the attribute class I have a pointer to the attribute that is the input (if any), and a list of pointers to attributes that the attribute is being output to. The functions to create and destroy these connections is pretty straightforward.
To get started, I wouldn’t worry too much about drawing pretty lines. Maya just draws a line from the center of the input node to the center of the output nodes, and then draws the node boxes on top of all the lines. Houdini draws these lines by moving vertically out of the nodes for a few pixels, draws a quarter circle, moves horizontal to the other node’s input, draws another quarter circle, and then draws horizontally into the node. If they overlap enough, you don’t draw the entire quarter circle (or you scale it down so it fits - the radius is half the horizontal distance between the two nodes’ connection points).
I actually haven’t even tried attacking the graphical interface for my system yet. I do everything through a command line. I wanted my system to be command driven, so I developed that first. Much faster to code up than a graphical interface. This way I can test my system out first and get some basic functionality in place before even having to worry about windows, drawing code, the display loop, mouse events, etc. I can send the commands for “createNode nodeOne; createNode nodeTwo; createAttr -ln “AttrOne” nodeOne; createAttr -ln “AttrTwo” nodeTwo; connectAttr “nodeOne.attrOne” “nodeTwo.attrTwo”; listAttrConnections nodeOne;” and get a printout of all the connections.
This way I can test creating attrs and nodes, deleting attrs and nodes, making and breaking connections, iterating through the DAG graph, etc, etc all before tackling the graphics side of things. And if you think about it, all the above needs to be written anyways before doing the graphical node manipulation interface, so might as well make sure it is well tested before adding more code on top. You don’t even need to go as far as I did and write a command line parser to your app; you can just call the commands from within your main () function and either use the debugger to make sure everything is working, or display status messages with printf or ostreams to the command shell to check your program’s progress.
And of course once you get these basics down, you still have to have a system that checks which attrs are dirty, build a list of what attrs need to be calculated in what order, and then traverse the graph in the correct order, solving as you go. That’s likely a bit of a pain. Haven’t done it yet myself.
Good Luck,
Michael Duffy

And no I’m not copying their MEL syntax… completely… hehehe…