I have a set of activities $A$, where each activity $i \in A$ has a starting date $s_i$ and an end date $e_i$ (or equivalently a starting date and a duration $d_i$). Therefore, each activity can be represented as an interval $[s_i, e_i]$. Notice that $s_i$ and $e_i$ (or $d_i$) are known.
I want to check if there are overlapping activities, that is activities that are scheduled to be performed (at least partially) during the same time period(s). For example, considering three activities $i$, $j$ and $k$:
[-----](i)
[-------](j)
[--------](k)
s_k e_k
activities $i$ and $j$ are overlapping.
I know that one criteria is the following $(*)$ if:
$$ \max_{i \in A}(e_i) - \min_{j \in A}(s_j) < \sum_{a \in A}d_a$$ then there are some overlapping activities.
But this is not enough, as in the case depicted above; in such a case, I can compare each couple $(i,j)$ with the following criteria $(**)$: if $$ e_i > s_j \vee e_j > s_i $$ then the two activities $i$ and $j$ overlap.
My questions are: are the two criteria $(*)$ and $(**)$ sufficient to detect all the possible overlaps? If yes, how can I prove it? Are there other criteria?