How does js detect whether there is a closed-loop circuit in a flow chart similar to a neural network?

< H2 > question: as shown below: < / H2 >
this is a flowchart configuration page. The nodes in the whole flowchart can be connected in a lifetime.

I can traverse all the lines in the whole graph, and each line has two anchor points: sourceId and targetId.

the red connection in the figure is a closed-loop circuit that is not allowed, that is, an endless loop is not allowed in the whole flowchart.

js

Oct.08,2021

this is the current train of thought:

    
        :
        1hasCheckedTarget1122
            223hasCheckedTarget
                
                2(1)hasCheckedTarget2233
                        
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37037-4ecc4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37037-4ecc4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?