O'Reilly logo

Design Patterns Java™ Workbook by Steven John Metsker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Trees in Graph Theory

In a composite structure, we can say that a node that holds references to other nodes is a tree. However, this definition is a bit loose. To be more precise, we can apply a few terms from graph theory to object modeling. We can start by drawing an object model as a graph—a collection of nodes and edges—with objects as nodes and object references as edges.

Consider an object model of an assay, or analysis, of a batch of a chemical. The Assay class has a batch attribute of type Batch, and the Batch class has a chemical attribute of type Chemical. Suppose that a particular Assay object a has a batch attribute that refers to a Batch object b. Suppose too that the chemical attribute of the Batch object b refers to a Chemical ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required