# Union Models for Model Families: Efficient Reasoning over Space and Time
## 3 Formalization of Model Families
### Attributed Type(\(d\)) Graphs as \(E\)-Graphs  
Given a typed graph (i.e., a model), it is useful in practice to attach additional information to nodes and edges by _attributing_ them, such that each node and /or edge can contain zero or more attributes. In this case, we refer to _typed attributed graphs_, where attributes are typically a _name:value_ pair that allows to attach a specific value to each attribute name. In addition, given a typed attributed graph that is typed over some \(TG\) (i.e., a metamodel), that \(TG\) needs to constrain the names and types of attributes that are allowed for certain types of nodes and edges. In this context, we refer to an _Attributed Type Graph (ATG)_, as shown in Figure 8, which extends the type graph illustrated in Figure 6a with node attributes.  
As an example of a typed attributed graph, reconsider the typed graph in Figure 6b extended with attributes as in Figure 9, where nodes have attributes with names name, name.  
In this paper, we adopt the definition of [PERSON] et al. (2018) for E-graphs to represent ATGs (note that from now on in this paper, the concept of ATG implicitly means an  
Figure 8: An attributed type graph (ATG). The star (*) indicates that zero or more instances of the class “Transition” are associated with one instance of the class “State”.  
Figure 6: Type graph (**a**) and Typed graph (**b**). The star (*) indicates that zero or more instances of the class “Transition” are associated with one instance of the class “State”.  
Figure 7: Typed graph morphism.  
Figure 9: A typed attributed graph, typed over the ATG in Figure 8.  
attributed type graph that is represented as an E-graph), which allows attribution for both nodes and edges, where attributes of nodes (resp. edges) are represented as _special edges_ between graph nodes (resp. graph edges) and data nodes that represent the data types of these attributes. Figure 10 visualizes the concept of E-graphs.  
**Definition 6**.: _E-graph: An E-graph is a tuple \(EG=\left(N_{G},\,N_{D},\,E_{G},\,E_{NA},\,E_{EA},\,(src_{j},\,tgt_{j})\,j\in\, \left\{G,\,NA,\,EA\right\}\right)\) where:_  
* \(N_{G}\) _and_ \(N_{D}\) _are graph nodes and data nodes, respectively;_
* \(E_{G}\)_,_ \(E_{NA}\)_, and_ \(E_{EA}\) _are graph edges, node attribute edges, and edge attribute edges, respectively;_
* \(src_{j}\) _and_ \(tgt_{j}\)_, where_ \(j\in\left\{G,\,NA,\,EA\right\}\) _are source and target functions that assign to each of the three categories of edges (i.e.,_ \(E_{G}\)_,_ \(E_{NA}\)_, and_ \(E_{EA}\)_) a source and a target, as follows:_
* \(src_{G}\)_:_ \(E_{G}\to N_{G}\)_,_ \(tgt_{G}\)_:_ \(E_{G}\to N_{G}\) _for graph edges;_
* \(src_{NA}\)_:_ \(E_{NA}\to N_{G}\)_,_ \(tgt_{NA}\)_:_ \(E_{NA}\to N_{D}\) _for node attribute edges;_
* \(src_{EA}\)_:_ \(E_{EA}\to E_{G}\)_,_ \(tgt_{EA}\)_:_ \(E_{EA}\to N_{D}\) _for edge attribute edges._  
**Example:** The ATG in Figure 8 is represented as the E-graph illustrated in Figure 11. The figure shows the different categories of nodes and edges defined in Definition 6, namely:  
* Graph nodes (N\({}_{G}\)): State, Transition
* Data nodes (N\({}_{D}\)): String
* Graph edges (E\({}_{G}\)): source, target
* Node attribute edges (E\({}_{NA}\)): same, name  
In addition, attributes of nodes are represented as special edges between graph nodes and data nodes that represent the type that attributes. For example, the attribute _tname_ is represented as an edge between graph node _Transition_ and the data node _String_.  
An instance typed graph ITG (i.e., model) of the attributed E-graph EG in Figure 11 is illustrated in Figure 12, where this figure is a representation of the typed attributed graph  
Figure 11: An E-Graph, EG, with node attributes represented as edges. The star (*) indicates that zero or more instances of the class “Transition” are associated with one instance of the class “State”.  
Figure 10: A visualization of an E-graph.  
found in Figure 9. We use the notation Inst[EG] to denote the set of all graphs conforming to EG; hence, ITG \(\in\) Inst[EG].