|
|
Referring back to the section, ``Example: Manufacturing Process of a Widget'', for a given module we want to determine which modules are immediately needed to compose it. One of the Vertex member functions, in_edges_g, can be used to answer this question. in_edges_g returns the set of Edge pointers (a Set_of_p) whose destination is the given Vertex. To answer the second question, we need to retrieve the source Vertex declared for each of these Edges. We'll use the Set_of_p iterator provided in the Set class, Set_of_piter, to iterate through the Edges:
. . . Set_of_p<Module> mset; // create a pointer set to // hold the answer set Set_of_piter<Transport_Time> si (m7->in_edges_g(widget)); Transport_Time* t; while (t = si.next()) mset.insert(t->src()); . . .
For module K of Figure 1, mset will contain a pointer to module J.
Now that we have seen a complete example of how the Graph package can be used, let's look in detail at the Graph classes.