PortListscan be viewed as equivalent to the adjacency-list data structure. A
PortHole, in most domains, is either an input or an output. It contains a
farSidePortpointer to the
PortHoleit is connected to (
NULLif it is not connected). To traverse the adjacency-list, a scheduler writer must make use of two iterators in Ptolemy (See "Iterators" on page 3-10):
SuccessorIter. By using a
GalStarItera scheduler writer can iterate over the nodes in the user-specified graph. Then on each of these nodes we can find the adjacent nodes using the
SuccessorIter. Although it is not necessary for adjacency-list equivalence, the
PredecessorIteris provided to iterate over the nodes that are predecessors to a given node.
There is slight overhead in accessing the graph using both
SuccessorIter over a straight forward implementation of an adjacency-list class. This overhead has a constant cost which is not dependent on the size of the graph. Thus we feel that the robustness achieved by not having two parallel representations of the same graph far outweigh this small overhead.