Your first problem basically boils down to a transitive closure in a graph. Here, matrix multiplication can be used. The [best-known algorithm to date](https://en.wikipedia.org/wiki/Computational_complexity_of_matrix_multiplication) has a complexity of $n^{2.371552}$. In my opinion, finding a quadratic algorithm for this problem is as hard as finding the same for the matrix multiplication problem. 

Once you have the 2-edge-distance all-pair-shortest-path matrix, you can combine (add and take min) that with the weighted adjacency matrix to solve the triangle problem. The time complexity of just this step will be $O(n^2)$. The first step remains the dominant one.