I have a LineString table in PostGIS, which represents wiring in streets. Where the geometry column represents the wiring lines; firstpoint is the first geometry point (cable segment); lastpoint the last geometry point; id_startpoint and id_enpoint are identifiers of the firstpoint and lastpoint columns.
In OpenLayers v5 it is shown as follows:
The point is that I want to detect the rings (cycles) in the structure of the network. As shown below: