How to check if graph exists before clear graph

So when I am reloading all the data I use CLEAR GRAPH ... command. But if the graph does not exist it will give me an error.

Two questions:

  • Is it possible to use an IF condition as part of the same CLEAR GRAPH ... statement?
  • If not what should be the syntax for a separate statement to check that graph exists?

Thank you,

Hi Radu,

You can run CLEAR SILENT GRAPH ..., which will always succeed, even on an error (like the graph not existing)

Thanks Stephen - that worked just fine!