Object graph
Encyclopedia
An Object graph is a view of an object system at a particular point in time. Whereas a normal data model
Data model
A data model in software engineering is an abstract model, that documents and organizes the business data for communication between team members and is used as a plan for developing applications, specifically how data is stored and accessed....

 such as a UML
Unified Modeling Language
Unified Modeling Language is a standardized general-purpose modeling language in the field of object-oriented software engineering. The standard is managed, and was created, by the Object Management Group...

 Class diagram
Class diagram
In software engineering, a class diagram in the Unified Modeling Language is a type of static structure diagram that describes the structure of a system by showing the system's classes, their attributes, operations , and the relationships among the classes.- Overview :The class diagram is the main...

 details the relationships between classes, the object graph relates their instances. Object diagram
Object diagram
An object diagram in the Unified Modeling Language , is a diagram that shows a complete or partial view of the structure of a modeled system at a specific time....

s are subsets of the overall object graph.
Object-oriented applications contain complex webs of interrelated objects. Objects are linked to each other by one object either owning or containing another object or holding a reference to another object. This web of objects is called an object graph and it is the more abstract structure that can be used in discussing an application's state.

Physical representation

An object graph is a directed graph
Directed graph
A directed graph or digraph is a pair G= of:* a set V, whose elements are called vertices or nodes,...

, which might be cyclic
Cycle graph
In graph theory, a cycle graph or circular graph is a graph that consists of a single cycle, or in other words, some number of vertices connected in a closed chain. The cycle graph with n vertices is called Cn...

. When stored in RAM, objects occupy different segments of the memory with their attributes and function table, while relationships are represented by pointers or a different type of global handler in higher-level languages.

Examples

For instance, a Car class can compose a Wheel one. In the object graph a Car instance will have up to four links to its wheels, which can be named frontLeft, frontRight, backLeft and backRight.
Example of an adjacency list
Adjacency list
In graph theory, an adjacency list is the representation of all edges or arcs in a graph as a list.If the graph is undirected, every entry is a set of two nodes containing the two ends of the corresponding edge; if it is directed, every entry is a tuple of two nodes, one denoting the source node...

representation: c:Car → {frontLeft:Wheel, frontRight:Wheel, backLeft:Wheel, backRight:Wheel}.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK