How to validate a diagram before saving?

is there any way to display error message,when two nodes are not connected in flowchart before saving the diagram

In your saving code, look for invalid graphs and display an error.

I could be more helpful if you would be more specific about the configurations that you want to detect. Screenshots and sketches are worth a thousand words.