tre czyta poprawnie wyjcie z dgp

This commit is contained in:
Tomasz Obrebski 2013-11-19 13:31:38 +01:00
parent b97a55609b
commit b30c30d500

View File

@ -277,11 +277,11 @@ def parsegraph(nodes)
$len[i] = dgp[1].to_i
$sat << i if parts[1]=="s"
$arcs |= parts[2].split(',').map{ |a| case a
when /\-\-(\w+)-(\d+)\((\d+)~(\d+)\)/
$arcs |= parts[2].scan(/\([^()]+\)/).map{ |a| case a
when /\-\-(\w+):(\d+)/
# [i, $2.to_i, $1, $3.to_i, $4.to_i]
[i, $2.to_i, $1, 0, 0]
when /\+\+(\w+)-(\d+)\((\d+)~(\d+)\)/
when /\+\+(\w+):(\d+)/
# [$2.to_i, i, $1, $3.to_i, $4.to_i]
[$2.to_i, i, $1, 0, 0]
end }
@ -379,6 +379,7 @@ end
def buildR(min, max, tree)
if $DEBUG then print "buildR--#{min}--#{max}--#{tree.inspect}\n" end
trees=[]
print $arcs
for arc in $arcs.select{|a| a[0]==max && $vis.include?([min,a[1]]) }
if $DEBUG then print "ARC: #{arc.inspect}\n" end
for r in buildR(arc[1],arc[0],tree+[arc]) #!!! buildR(a[1],a[3],tree+[a])