Rewrite bridge angle detection

I rewrite the function for detecting bridges.
Now I'm searching the longest non attached edge of the bridge and report the angle of this edge.
In the case of 2 or more edges that are not attached, the angle between 2 ends of the chain of non attached edges is got.