Some objects on the graph are connected to some links, or connected to some other objects using links.
We are looking for a solution to:
- Speed up traversing connected objects.
- Doesn't have much overload for developers, who do not need to traverse graph.
- Having two properties for each object to list its input and output links.
This solution is suggested by Adem. This solution offers the fasted way to traverse connected objects. - Having only one property for each object to list all its dependent objects.
The base object class (TGraphObject) has some mechanism, which derived classes can use to make their instances dependent to the other objects. In this case, when placement of an object changes, all dependent objects will be notified to adjust their position too. The GraphLink class is such a class.
Now, we can use these option to have a public property for each object to tell us which objects are dependent to this object, and use it for traversing the graph. Of course, the developer should check for proper object type, and use source and target properties of the link to determine direction of the link. - Having three properties for each object to list all its dependent objects, and also its input and output links.
This is combination of first and second solution, which is much more flexible than the others, and of course costs more. - Do not provide any new porperty for this purpose.
The developer is responsible to use provided events and Tag property of the object to impelement his/her own mechanism to traverse the graph.