import numpy
from numpy import *
def dfs( v ):
vis[v] = -1
flag = 0
for i in range(n):
# print (a[v][i],'---', vis[i] )
if a[v][i] != 0 and vis[i] != -1:
dfs(i)
vis[i] = 1
else:
pass
if a[v][i] != 0 and vis[i] == -1:
print ('Yes, there is A loop in this network\n')
global swi
swi = True
exit()
return
# break
else:
pass
print ('s = 0')
return False
global swi
swi = False
'''===装载数据'''
# edges = [ int(i) for i in edges]
bian = int(shape(edges)[0]) - 1
print (bian,'edges in the network \n')
print (shape(edges),'\n')
n = int( edges[0][1] )
c = int( edges[0][0] )
# n, c = input().split()
# n = int(n)
# c = int(c)
a = [([0] * n) for i in range(n)]
vis = [0] * c
for i in range(1, c+1):
s, t = edges[i][0:2]
# print (s,' - ', t )
'''GO_OBO文件则 s, t 不需要 -1 '''
s = int(s) - 1
t = int(t) - 1
# s = int(s)
# t = int(t)
a[s][t] = 1
# print (a)
# print (vis)
dfs(0)
# print (swi)
if not swi:
print('No loop, DAG - DAG - DAG')

1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责；
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性，不作出任何保证或承若；
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。