GraphObject IDs

An important responsibility of the GraphAPI involves the assignment of unique identifiers to Graph and VisualGraph objects. These identifiers should allow for the unique discovery and retrieval of graph objects within a particular graph context. Furthermore, the identifiers of GraphObject instances and associated VisualGraphObject instances should be equal to each other and thus provide an implicit mapping of VisualNode objects to their counterparts in the model.

The Graph and VisualGraph objects support two different kinds of identifiers. Both of them are assigned internally by the GraphAPI. Therefore it is not possible to set them manually. This was done on purpose so as to eliminate a potential source of errors.

The methods provided by a GraphObject and a VisualGraphObject to access these identifiers have the same names and signature so that they are easy to remember for both kinds of objects.

The one identifier supported by Graph and VisualGraph objects is returned by the method shown below. Its responsibility is to let client code identity a GraphObject within a single GraphObjectContainer or VisualGraphObjectContainer and also to indicate if the GraphObject or VisualGraphObject has been added to a corresponding container or not. These characteristics are explained in detail later on.
The text refers to the identifier named 'container id'.

The second identifier supported by Graph and VisualGraph objects is returned by the method:

The responsibility of this method is to provide an identifier that is unique within an entire hierarchy of GraphObjectContainer and VisualGraphObjectContainer objects and also to let you identify a GraphObject or VisualGraphObject immediately after its creation.
The succeeding text refers to this identifier by the name 'global id'.

The two different identifier types have unique and shared characteristics. The list below gives an overview of these characteristics.