Type guards for BaseGraph. Since this is the base class, data and scratch are always assumed to be compatible, avoiding the runtime cost of exhaustively checking the type of objects such as ScratchData.nodeIdGenerator on every cast.

However, importing a cytoscape object that does not respect these types may lead to runtime errors on certain operations, such as adding a new node. In practice, its almost impossible for that to happen unintentionally, as these fields are under the @specs-feup/flow namespace.