To achieve this matching, we consider all \(D_{f_j}\)  and \(D_{\hat{f}_k}\)  to be the left- and right-hand vertices, respectively, of an undirected bipartite graph.
Edges are added between effects with common features; we consider effects to be atomic and respect the non-additive structure where it exists in the model being explained. Thus, contributions may not be given for individual features.
We then find the connected components of this graph to identify groups of effects with inter-effect dependencies.
If every component contains an exact match, for example, if \(match_F = \lbrace \lbrace 2\rbrace , \lbrace 2, 3\rbrace \rbrace \)  and \(match_{\hat{F}} = \lbrace \lbrace 2\rbrace , \lbrace 2, 3\rbrace \rbrace \) , then each contribution by \(\lbrace 2\rbrace \)  and \(\lbrace 2, 3\rbrace \)  will be compared separately.
MatchEffects is formalized in Algorithm REF  and illustrated for a few examples in Figure REF .
This process guarantees
the most fair and direct comparison
of feature contributions, and does not rely on
gradients,
sensitivity,
or other proxy means [1]}, [2]}, [3]}.
The worst-case time complexity of MatchEffects is
\(\mathcal {O}\left(m_F m_{\hat{F}}d\right)\) 
and the
space complexity is
\(\mathcal {O}\left(m_F m_{\hat{F}}\right)\) 
(see
Appendix B
for proofs).
