read_dot2: +{}
This commit is contained in:
parent
eccc313b9e
commit
6e6a330573
13
srcxray.py
13
srcxray.py
|
@ -643,15 +643,18 @@ def read_dot2(dot):
|
||||||
# read_dot pydot.graph_from_dot_data parse_dot_data from_pydot
|
# read_dot pydot.graph_from_dot_data parse_dot_data from_pydot
|
||||||
dg = nx.DiGraph()
|
dg = nx.DiGraph()
|
||||||
for a in dot:
|
for a in dot:
|
||||||
|
a = a.strip()
|
||||||
if '->' in a:
|
if '->' in a:
|
||||||
m = re.match('^(.+) -> {(.+)}', a)
|
m = re.match('"?([^"]+)"? -> {(.+)}', a)
|
||||||
if m:
|
if m:
|
||||||
dg.add_edges_from([(m.group(1), b) for b in m.group(2).split()])
|
dg.add_edges_from([(m.group(1), b.strip('"')) for b in m.group(2).split() if b != m.group(1)])
|
||||||
else:
|
else:
|
||||||
m = re.match('(.+) -> (.*);', a)
|
m = re.match('"?([^"]+)"? -> "?([^"]*)"?;', a)
|
||||||
if m:
|
if m:
|
||||||
dg.add_edge(m.group(1), m.group(2))
|
if m.group(1) != m.group(2):
|
||||||
print(m.group(1), m.group(2))
|
dg.add_edge(m.group(1), m.group(2))
|
||||||
|
else:
|
||||||
|
log(a)
|
||||||
return dg
|
return dg
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue