Data Strcuture to represent dependencies amongst modules Consider several software modules $m_1, m_2, ... m_n$. Each module has some inputs and outputs and the inputs to some of the modules are dependent on the outputs of some other modes. For example, in the figure, module $m_3$ and $m_4$ are dependent on the output of module $m_1$. If we are given a set if inputs $I$ and a set of outputs $O$, the objective is to find a set of modules which produce this output.


For example, if the output set $O$ is $\{o_1, o_2\}$ then all of the modules would have to be used. However if the output set $O$ is $\{o_2\}$ then only $\{m_2, m5, m_7\}$ needs to be used. 

A graph is a natural model for such an objective. Are there any alternative data structures to represent this description?

Consider a modification to the earlier example as shown in the figure below, where all the outputs produced are $o_1$ and the output set required is also $O = \{o_1\}$. In this scenario we have two possible set of modules which satisfy our goal of $O$ :  $\{m_2, m_5, m_7\}$ and $\{m_1, m_3, m_4, m_6\}$. We wish to select the set which minimizes the number of modules used, hence the set $\{m_2, m_5, m_7\}$ would be our desired set $O$. Would a graph still be the most natural representation of such a scenario or some other data structure would be better off?
Your problem is the following:

Given a dag $G$, with labels $\ell:V\to L$ on the vertices, and a set $O \subseteq L$, find the smallest subset $S \subseteq V$ of vertices such that for each $o \in O$, there is a vertex in $S$ labelled $o$.

This problem is NP-hard, by reduction from set cover.

(The reduction: given sets $T_1,\dots,T_n$ and universe $U$, define a dag with one source vertex for each $T_i$, one sink vertex per element of $U$, labelled with that element, and an edge $T_i \to t$ for each $t \in T_i$; and set $O=U$.  Then the smallest subset of vertices that meets the requirements is also the minimum set cover.)

Since it is NP-hard, you'll need to use any of the standard methods for dealing with NP-hardness: heuristics, an approximation algorithm, an exponential-time algorithm, etc.  I suggest reducing this to integer linear programming.  Add a zero-or-one boolean variable $x_v$ for each vertex $v$; for each edge $v \to w$, add the inequality $x_v \ge x_w$; for each label $o \in O$ in the output set, add the inequality $\sum_{\ell(v)=o} x_v \ge 1$, where the sum ranges over all vertices with label $o$; and then minimize the objective function $\sum_{v \in V} x_v$.  Then, apply an off-the-shelf ILP solver.  Of course this may be exponential time in the worst case, but I suspect it's about as you're likely to get in practice, within any reasonable amount of programming effort.

The data structure to use is a graph.  The problem remains NP-hard no matter what data structure you use, so choice of an appropriate data structure isn't going to make the problem any easier.