Reduce number of immediate expand/contracts.
This commit is contained in:
parent
daf1e229f7
commit
bb3dafa3b5
@ -1444,18 +1444,30 @@ def find(seq, predicate):
|
|||||||
frontier.pop(i)
|
frontier.pop(i)
|
||||||
|
|
||||||
elif len(frontier[i]) > 1:
|
elif len(frontier[i]) > 1:
|
||||||
name = frontier[i].pop(0)
|
# Expand forawrd after doing all back connections
|
||||||
deps = [name]
|
|
||||||
|
|
||||||
out.write(indent)
|
out.write(indent)
|
||||||
out.write("| " * i)
|
out.write("| " * i)
|
||||||
out.write("|\ ")
|
out.write("|\\")
|
||||||
out.write("\ " * (len(frontier) - i - 1))
|
|
||||||
|
if (i+1 < len(frontier) and len(frontier[i+1]) == 1
|
||||||
|
and frontier[i+1][0] in frontier[i]):
|
||||||
|
# We need to connect to the element to the right.
|
||||||
|
# Keep lines straight by connecting directly and
|
||||||
|
# avoiding immediate expand/contract.
|
||||||
|
name = frontier[i+1][0]
|
||||||
|
frontier[i].remove(name)
|
||||||
|
out.write("| " * (len(frontier) - i - 1))
|
||||||
out.write("\n")
|
out.write("\n")
|
||||||
|
|
||||||
|
else:
|
||||||
|
# Just allow the expansion here.
|
||||||
|
name = frontier[i].pop(0)
|
||||||
|
deps = [name]
|
||||||
|
out.write(" \\" * (len(frontier) - i - 1))
|
||||||
|
out.write("\n")
|
||||||
connect_deps(i, deps, label="expansion")
|
connect_deps(i, deps, label="expansion")
|
||||||
|
|
||||||
# Handle any back edges to the right
|
# Handle any remaining back edges to the right
|
||||||
j = i+1
|
j = i+1
|
||||||
while j < len(frontier):
|
while j < len(frontier):
|
||||||
deps = frontier.pop(j)
|
deps = frontier.pop(j)
|
||||||
|
Loading…
Reference in New Issue
Block a user