Dateien nach "mod/butadien" hochladen
This commit is contained in:
@@ -6,9 +6,11 @@ import re
|
||||
#for edge in graph:
|
||||
#dir(edge)
|
||||
|
||||
HYPERGRAPH = {}
|
||||
HYPERGRAPH = {
|
||||
1: ([], ['Butadien']),
|
||||
}
|
||||
|
||||
with open('out/014_dg_0_11100.dot', 'r') as file:
|
||||
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):
|
||||
@@ -16,7 +18,13 @@ with open('out/014_dg_0_11100.dot', 'r') as file:
|
||||
index = int(re.findall("(?<=id = )(.*?)(?=\\{)", edge)[0])
|
||||
educts = re.findall("(?<=\\{)(.*?)(?=\\}, 'r_\\{[0-1]\\}',)", edge)[0]
|
||||
educt = re.findall("(?<= ')(.*?)(?=' )", educts)
|
||||
products = re.findall("(?<='r_\\{[0-1]\\}', \\{)(.*?)(?=\\})", edge)[0]
|
||||
product = re.findall("(?<= ')(.*?)(?=' )", products)
|
||||
products = re.findall("(?<='r_\\{[0-1]\\}', \\{)(.*?)(?=\\ })", edge)[0]
|
||||
product = re.findall("(?<= ')(.*?)(?=')", products)
|
||||
HYPERGRAPH[index] = (educt, product)
|
||||
print(HYPERGRAPH)
|
||||
|
||||
with open('hypergraph.txt', 'w') as f:
|
||||
f.write("HYPERGRAPH = {")
|
||||
for edge, (head, tail) in HYPERGRAPH.items():
|
||||
f.write(f'\t {edge}, ({head}, {tail}),\n')
|
||||
f.write('}')
|
||||
f.close
|
||||
|
||||
Reference in New Issue
Block a user