# A Hierarchical Orthographic Similarity Measure for Interconnected Texts Represented by Graphs
## 4 Representing a Textual Corpus as a Graph
### Graph Representation of a Textual Corpus  
We propose a graph model to represent a set of texts, where the content of each text is partitioned into smaller textual components. The units of these textual components are based on a given hierarchical decomposition of the texts, as described in Section 4.1. Each text element is assigned to a node with a corresponding label and connected by numbered edges either to higher-level elements, in which this element occurs, or to lower-level elements, of which this element is made up, or both. For example, in a text with decomposition \(L=[\texttt{token},\texttt{verse},\texttt{document}]\), a verse node is connected to the document nodes in which this verse occurs and to the token nodes that make up this verse. Only the nodes that represent the smallest unit within the hierarchy store the actual textual content. The textual content in higher-level text elements can then be reconstructed from their subgraph by traversing down to the lowest-level components. Moreover, textual components with the exact same content are represented by the same nodes in the graph. Hence, a basic notion of similarity between (parts of) texts can be deducted simply from the structure of the proposed textual graph. A formal definition of this graph model is provided in Definition 3. **Definition 3** (graph-based text model). : _Let \(L\) be an ordered list of labels denoting the hierarchical structure of the texts in a corpus, as described in Section 4.1. The graph model for representing texts is a fuzzy labelled property graph \(\tilde{G}\big{(}N,\tilde{E},\rho,\lambda_{N},\lambda_{E},\sigma\big{)}\) and is defined by the following:_  
* _The set_ \(N\) _consists of all nodes representing a textual element of a text in_ \(T\) _and is a composition of the subsets representing textual components with a specific label, i.e.,_ \(N=\bigcup_{l\in L}N_{l}\)_. The subsets_ \(N_{l\in L}\) _are pairwise disjointed._
* _The set of edges_ \(\tilde{E}=\tilde{E}_{\texttt{contilis}}\) _represents the relationships of containment between textual elements, with_ \(\mu_{E}(e)=1,e\in\texttt{supp}\big{(}\tilde{E}\big{)}\)_._
* _The relationships in_ \(\tilde{E}_{\texttt{contilis}}\) _are mapped on the corresponding nodes by the_ \(\rho\) _function_ \(\rho(e)\in N_{l_{i+1}}\times N_{l_{i}}\)_, with_ \(e\in\texttt{supp}\big{(}\tilde{E}_{\texttt{contilis}}\big{)}\) _and_ \(l_{i+1},l_{i}\in L\)_. This mapping indicates which nodes with a lower-hierarchy label_ \(l_{i}\) _are contained in a node with label_ \(l_{i+1}\)_._
* _The_ rank _property, indicating the rank of a textual node within its higher-level text element, is assigned as_ \(\sigma(e,\texttt{rank})\in\mathbb{N},e\in\texttt{supp}\big{(}\tilde{E}_{ \texttt{contilis}}\big{)}\)_. This property is required to reconstruct a certain text based on its graph-representation._
* _Top-level nodes_ \(n\in N_{l_{|L|-1}}\)_, which represent an entire textual document, are assigned a unique_ id _by_ \(\sigma(n,\texttt{id})\in\mathbb{N}\)_._
* _The lowest nodes in the hierarchy, which are nodes_ \(n\in N_{l_{0}}\)_, store the actual textual information in a_ text _property by_ \(\sigma(n,\texttt{text})\in T_{l_{0}}\)_. Here,_ \(T_{l_{0}}\) _represents all the unique text elements from texts in_ \(T\) _at hierarchical level_ \(l_{0}\)_. The full texts or text elements with intermediate labels can be reconstructed from their subgraph by traversing down to the lowest-level elements._  
_Additionally, two or more textual elements, except for the top-level elements, that contain the exact same content and have the same hierarchical level are represented by the same node. Consequently, these nodes can have multiple relationships of containment to nodes with a higher-level label.