## 5 Graph-Based Method for Comparing Collections of Documents  
At this point we have created two graphs, one showing the distances between summary recommendations, and the other representing conceptual distances between documents. The procedure we used so far can be concisely expressed as Algorithm 1, where given a set of documents, after specifying the Model (type of embeddings) and a distance metric, we get an adjacency matrix containing the distances between the nodes representing the documents. An example output of Algorithm 1 is shown in Figure 4 above. What remains to be done is to quantify the difference in shapes of these two graphs, and then to show that the similarity we observe is not accidental. The methods used in these two steps are described in Algorithms 2 and 3. The experiments and the details of the performed computations will be presented in Section 6. ```
0: Guidelines: a set of guideline documents in textual format. Model: a model to compute distances between two documents. 0:\(\mathcal{A}_{G}\)--Adjacency matrix of distances between document guidelines. 1:for each pair of documents in Guidelines do
2: Compute the distance between the documents according to Model
3: Put the distance in \(\mathcal{A}_{G}\)
4:endfor
5:return\(\mathcal{A}_{G}\)
```  
**Algorithm 1** **Computing Graph of Distances Between Documents. **  
We use a very natural, graph clique-based method for comparing similarity of two _collections_ of documents. Given two sets of documents, represented by graphs, and a one-to-one mapping between nodes, in Algorithm 2, we compute the percent distortion between the shapes of the two cliques--this is perhaps the most natural similarity measure (similarity = 1 - distortion) for comparing the shapes of two cliques of identical cardinality. \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline  & **AAFP** & **ACOG** & **ACP** & **ACR** & **ACS** & **IARC** & **USPSTF** \\ \hline
**AAFP** & 0.000 & 1.833953 & 1.903064 & 1.994837 & 1.866007 & 2.153458 & 1.681802 \\ \hline
**ACOG** & 1.833953 & 0.000 & 1.649276 & 1.290215 & 1.333061 & 1.773604 & 1.286168 \\ \hline
**ACP** & 1.903064 & 1.649276 & 0.000 & 1.856171 & 1.667579 & 1.956002 & 1.674375 \\ \hline
**ACR** & 1.994837 & 1.290215 & 1.856171 & 0.000 & 1.41020 & 1.873691 & 1.385404 \\ \hline
**ACS** & 1.866007 & 1.333061 & 1.667579 & 1.41020 & 0.000 & 1.676928 & 1.163601 \\ \hline
**IARC** & 2.153458 & 1.773604 & 1.956002 & 1.873691 & 1.676928 & 0.000 & 1.753758 \\ \hline
**USPSTF** & 1.681802 & 1.286168 & 1.674375 & 1.385404 & 1.163601 & 1.753758 & 0.000 \\ \hline \hline \end{tabular}
\end{table} 
Table 5: This table shows the word mover’s distances between the guidelines using BioASQ embeddings. This model also performed very well on the datasets in the Appendix A. ```
1:Adjacency Matrices \(\mathcal{A}_{1}\), \(\mathcal{A}_{2}\) of equal dimensions
2:Graph distance/distortion \(\mathcal{D}(\mathcal{A}_{1},\mathcal{A}_{2})\), as a value between 0 and 1. 3:Normalize the distances in \(\mathcal{A}_{1}\) (by dividing each distance by the sum of distances in the graph) to produce a new adjacency matrix \(\mathcal{AN}_{1}\)
4:Normalize the distances in \(\mathcal{A}_{2}\) to produce a new adjacency matrix \(\mathcal{AN}_{2}\)
5:Set the value of \(graph\_distance\) to 0. 6:for each edge in \(\mathcal{AN}_{1}\)do
7:Add the absolute value of the difference between the edge length and its counterpart in \(\mathcal{AN}_{2}\) to the \(graph\_distance\)
8:endfor
9:return\(\mathcal{D}(\mathcal{A}_{1},\mathcal{A}_{2})=graph\_distance\)
```  
Note. For example, the distance between the two graphs in Figure 5 is 0.31, equivalent to 31% distortion  
**Algorithm 2****Distance or Percentage Distortion between Two Complete Graphs (cliques of the same size). **  
Next, we need to compute the chance that the mapping arose from a random process.