The information of a given graph is stored in a txt file in the following format
def length(file_path):#file_path为txt文件路径
node = set()
edge = 0
f = open(file_path)
lines = [l.split() for l in f.readlines() if l.strip()]
#print(lines)
edge = len(lines)
for i in lines:
node.add(eval(i[0]))
node.add(eval(i[1]))
return len(node), edge
Returns the number of vertices and edges