## 2 Materials and Methods
### Basic Traceability Model
Figure 1), from sequential traces that can be represented by a DAG composed of a simple, unbranched sequences of nodes, illustrating a direct progression from a batch of raw materials to a batch of final products (e.g., coffee production from coffee beans to retail), to complex branched traces illustrating the convergence and divergence of various batches of materials through different processes and transformations before becoming final products (e.g., a furniture-manufacturing supply chain, from wooden, plastic and metal raw components to complex furniture items). In this proposal, individual batches (e.g., an order of coffee bags or wood planks) are modelled as records \(\{id,\ p,\ C\}\) with the following fields:  
* A unique batch identifier (\(id\)). * A reference to the batch's payload, that is, the properties of a relevant item (\(p\)). An example of these references could be uniform resource locators (URIs) referencing a batch record in cloud storage, a content identifier (CID) in decentralised storage, a foreign key referencing a specific row in a table of batches, etc. * A list \(C\) of inputs to produce this batch, that is, a list of pairs \(c_{c}=(id_{c},\ d_{c})\) collecting which batches upstream contribute to this batch, and in what way (\(C=[c_{1},\ldots,c_{n}]\)). \(id_{c}\) represents the ID of the contributing node and \(d_{c}\) a reference to the details of that contribution. In other words, \(C\) represents the list of arcs in the DAG linking the contributing batches to the present batch. A table of arcs (ToA) is a simple but powerful structure to programmatically represent the set of traces (i.e., DAGs) in a traceability scenario. Each row in the ToA will represent an arc in a batch and is modelled as a tuple \((id_{n}\), \(id_{c}\), \(d_{c})\) with the fields below:  
* The ID of the new batch (\(id_{n}\)). * The ID of an input, that is, a contributing batch to the new batch (\(id_{c}\)). * A reference to the details of the contribution (\(d_{c}\)). DAGs and ToAs can efficiently represent complex supply chains with numerous nodes and edges while maintaining performance. A single ToA can collect any number of unconnected DAGs as far as node identifiers are unique across the DAG collection. The acyclic property helps in managing complexity, ensuring that the graph remains manageable and queries (e.g., tracing paths) are computationally efficient. Even in cases with supply chains involving a large number of nodes, a DAG and its ToA representation allow for efficient algorithms (e.g., depth-first search or breadth-first search [28]) to perform traceability queries. In addition, backends supporting graph structures natively [29] or implementing adjacency lists or matrices [30] can be utilised to further boost performance. Figure 2's DAG represents a typical trace in a traceability scenario. Batches \(R_{1}\ldots R_{4}\) model the raw materials required for the fabrication of some consumer products. Batches \(I_{i}\) and \(J_{i}\) model intermediate steps in the value chain, and finally \(P_{1}\) and \(P_{2}\) represent consumer products. Arc labels represent details of each individual input to the next step in the supply chain (e.g., \(r_{ij}\) represents details of the contribution of node \(R_{i}\) to node \(I_{j}\)). Table 1 depicts the ToA of this DAG and Table 2 represents a simplified ToA (i.e., no node details are collected) of traces in Figure 1's DAG. Figure 1: Example DAGs modelling supply chain traces. Numbers at the top and left sides are used as coordinates to conveniently identify nodes in each trace. (**a**) Simple trace illustrating a coffee-production supply chain, from coffee plants (1, 1) to coffee capsules to be sold at a grocery shop (1, 4). (**b**) Complex trace for monitoring the production of tables and garden benches at different facilities from different timber sources.