Dynamically adding nodes

How to dynamically add a node before or after the selected node without redrawing graph again ?

Suppose i have Graph with following nodes

Node1
Node2
Node3 ->(Currently Selected)
Node4
Node5

and a button outside the flowchart , now on clicking this button a node get added before/after the selected node.

I assume you are calling Model.addNodeData, yes?

What do you mean by “before or after the selected node”?

Yes i am using Model.addNodeData
I am able to create node but don’t know how add it after selected node.Please see image

But your app is already doing that when the user drops the node onto a link. I suspect you started from the Flowgrammer sample, Flowgrammer. It has that functionality implemented in the Link.mouseDrop event handler, which is the dropOntoLink function.

All i want on button click a node automatically get added in flow chart just below the selected node.
Here i have to manually drop node over the link

Anything ?

Did you look at the implementation of the dropOntoLink function as I suggested?