Dateien nach "mod/butadien" hochladen
This commit is contained in:
@@ -7,13 +7,13 @@ import re
|
||||
#dir(edge)
|
||||
|
||||
HYPERGRAPH = {
|
||||
1: ([], ['Butadien']),
|
||||
213: ([], ['Butadien']),
|
||||
}
|
||||
|
||||
with open('014_dg_0_11100.dot', 'r') as file:
|
||||
graph = file.read()
|
||||
#print(re.findall( "// id = [0-9]+\\{ ('Butadien' |'p_\\{0,[0-9]\\} ){1,2}\\}, 'r_\\{[0|1]\\}', \\{ ('Butadien' |'p_\\{0,[0-9]\\} ){1,2}\\}", graph)[0])
|
||||
for edge in re.findall( "// id = [0-9]+\\{ [A-Za-z0-9_,{} ']+ \\}, 'r_\\{[0|1]\\}', \\{ [A-Za-z0-9_,{} ']+ \\}", graph):
|
||||
for edge in re.findall("// id = [0-9]+\\{ [A-Za-z0-9_,{} ']+ \\}, 'r_\\{[0|1]\\}', \\{ [A-Za-z0-9_,{} ']+ \\}", graph):
|
||||
#print(edge)
|
||||
index = int(re.findall("(?<=id = )(.*?)(?=\\{)", edge)[0])
|
||||
educts = re.findall("(?<=\\{)(.*?)(?=\\}, 'r_\\{[0-1]\\}',)", edge)[0]
|
||||
@@ -21,6 +21,11 @@ with open('014_dg_0_11100.dot', 'r') as file:
|
||||
products = re.findall("(?<='r_\\{[0-1]\\}', \\{)(.*?)(?=\\ })", edge)[0]
|
||||
product = re.findall("(?<= ')(.*?)(?=')", products)
|
||||
HYPERGRAPH[index] = (educt, product)
|
||||
for outflow in re.findall("// id = [0-9]+, graphName = [A-Za-z0-9_,\\{\\} ']+", graph):
|
||||
index = int(re.findall("(?<=id = )(.*?)(?=,)", outflow)[0])
|
||||
mol = re.findall("(?<=graphName = )Butadien|p_\\{0,[0-9]+\\}", outflow)[0]
|
||||
HYPERGRAPH[index] = ([f'{mol}'], [])
|
||||
HYPERGRAPH = dict(sorted(HYPERGRAPH.items()))
|
||||
|
||||
with open('hypergraph.txt', 'w') as f:
|
||||
f.write("HYPERGRAPH = {\n")
|
||||
|
||||
Reference in New Issue
Block a user