---------------------ruby code--------------------

after running ruby code

in below output at first occurrence of

“sssssssssssssssssssssss”

can anyone explain how “nearValues” is updating

$hash2={“value1”=>[“value2”, “value3”, “value6”], “value2”=>[“value1”,

“value3”, “value6”], “value3”=>[“value1”, “value2”, “value6”],

“value4”=>[“value5”, “value6”], “value5”=>[“value4”, “value6”],

“value6”=>[“value4”, “value5”, “value1”, “value2”, “value3”]}

$subgraphs = []

def get_subgraphs(setGroup, nearValues, checkedValues)

p

“aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa”

p “setGroup”

p setGroup

p “nearValues”

p nearValues

p “checkedValues”

p checkedValues

if nearValues.empty? && checkedValues.empty?

$subgraphs << setGroup.sort.join(", ") if setGroup.size > 2

else

possible_pivots = nearValues + checkedValues

p “possible_pivots”

p possible_pivots

```
pivot = possible_pivots.inject(nil) do |best, p|
best.nil? || $hash2[p].size > best.size ? best = p : best
end
p " pivot "
p pivot
nearValues.size.times do |i|
n = nearValues[i]
next if $hash2[n].include?(pivot)
nearValues[i] = nil
p "i"
p i
p "checkedValues"
p checkedValues
p "nearValues.compact & $hash2[n]"
p nearValues.compact & $hash2[n]
p " checkedValues & $hash2[n]"
p checkedValues & $hash2[n]
get_subgraphs(setGroup + [n], nearValues.compact & $hash2[n],
```

checkedValues & $hash2[n])

p “sssssssssssssssssssssss”

```
checkedValues << n
p "checkedValues"
p checkedValues
p "nearValues"
p nearValues
end
```

end

end

p “$hash2 =”

p $hash2

p “$hash2.keys =”

p $hash2.keys

get_subgraphs([], $hash2.keys, [])

p “$subgraphs =”

p $subgraphs

puts $subgraphs.sort.join("\n") << “\n”

----------------------end--------------------

---------------- output is as follows ---------------------------

Hello World

“$hash2 =”

{“value1”=>[“value2”, “value3”, “value6”], “value2”=>[“value1”,

“value3”, “value6”], “value3”=>[“value1”, “value2”, “value6”],

“value4”=>[“value5”, “value6”], “value5”=>[“value4”, “value6”],

“value6”=>[“value4”, “value5”, “value1”, “value2”, “value3”]}

“$hash2.keys =”

[“value1”, “value2”, “value3”, “value4”, “value5”, “value6”]

“aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa”

“setGroup”

[]

“nearValues”

[“value1”, “value2”, “value3”, “value4”, “value5”, “value6”]

“checkedValues”

[]

“possible_pivots”

[“value1”, “value2”, “value3”, “value4”, “value5”, “value6”]

" pivot "

“value1”

“i”

0

“checkedValues”

[]

“nearValues.compact & $hash2[n]”

[“value2”, “value3”, “value6”]

" checkedValues & $hash2[n]"

[]

“aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa”

“setGroup”

[“value1”]

“nearValues”

[“value2”, “value3”, “value6”]

“checkedValues”

[]

“possible_pivots”

[“value2”, “value3”, “value6”]

" pivot "

“value2”

“i”

0

“checkedValues”

[]

“nearValues.compact & $hash2[n]”

[“value3”, “value6”]

" checkedValues & $hash2[n]"

[]

“aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa”

“setGroup”

[“value1”, “value2”]

“nearValues”

[“value3”, “value6”]

“checkedValues”

[]

“possible_pivots”

[“value3”, “value6”]

" pivot "

“value3”

“i”

0

“checkedValues”

[]

“nearValues.compact & $hash2[n]”

[“value6”]

" checkedValues & $hash2[n]"

[]

“setGroup”

[“value1”, “value2”, “value3”]

“nearValues”

[“value6”]

“checkedValues”

[]

“possible_pivots”

[“value6”]

" pivot "

“value6”

“i”

0

“checkedValues”

[]

“nearValues.compact & $hash2[n]”

[]

" checkedValues & $hash2[n]"

[]

“setGroup”

[“value1”, “value2”, “value3”, “value6”]

“nearValues”

[]

“checkedValues”

[]

“sssssssssssssssssssssss”

“checkedValues”

[“value6”]

“nearValues”

[nil]

“sssssssssssssssssssssss”

“checkedValues”

[“value3”]

“nearValues”

[nil, “value6”]

“sssssssssssssssssssssss”

“checkedValues”

[“value2”]

“nearValues”

[nil, “value3”, “value6”]

“sssssssssssssssssssssss”

“checkedValues”

[“value1”]

“nearValues”

[nil, “value2”, “value3”, “value4”, “value5”, “value6”]

“i”

3

“checkedValues”

[“value1”]

“nearValues.compact & $hash2[n]”

[“value5”, “value6”]

" checkedValues & $hash2[n]"

[]

“setGroup”

[“value4”]

“nearValues”

[“value5”, “value6”]

“checkedValues”

[]

“possible_pivots”

[“value5”, “value6”]

" pivot "

“value5”

“i”

0

“checkedValues”

[]

“nearValues.compact & $hash2[n]”

[“value6”]

" checkedValues & $hash2[n]"

[]

“setGroup”

[“value4”, “value5”]

“nearValues”

[“value6”]

“checkedValues”

[]

“possible_pivots”

[“value6”]

" pivot "

“value6”

“i”

0

“checkedValues”

[]

“nearValues.compact & $hash2[n]”

[]

" checkedValues & $hash2[n]"

[]

“setGroup”

[“value4”, “value5”, “value6”]

“nearValues”

[]

“checkedValues”

[]

“sssssssssssssssssssssss”

“checkedValues”

[“value6”]

“nearValues”

[nil]

“sssssssssssssssssssssss”

“checkedValues”

[“value5”]

“nearValues”

[nil, “value6”]

“sssssssssssssssssssssss”

“checkedValues”

[“value1”, “value4”]

“nearValues”

[nil, “value2”, “value3”, nil, “value5”, “value6”]

“i”

4

“checkedValues”

[“value1”, “value4”]

“nearValues.compact & $hash2[n]”

[“value6”]

" checkedValues & $hash2[n]"

[“value4”]

“setGroup”

[“value5”]

“nearValues”

[“value6”]

“checkedValues”

[“value4”]

“possible_pivots”

[“value6”, “value4”]

" pivot "

“value6”

“i”

0

“checkedValues”

[“value4”]

“nearValues.compact & $hash2[n]”

[]

" checkedValues & $hash2[n]"

[“value4”]

“setGroup”

[“value5”, “value6”]

“nearValues”

[]

“checkedValues”

[“value4”]

“possible_pivots”

[“value4”]

" pivot "

“value4”

“sssssssssssssssssssssss”

“checkedValues”

[“value4”, “value6”]

“nearValues”

[nil]

“sssssssssssssssssssssss”

“checkedValues”

[“value1”, “value4”, “value5”]

“nearValues”

[nil, “value2”, “value3”, nil, nil, “value6”]

“$subgraphs =”

[“value1, value2, value3, value6”, “value4, value5, value6”]

value1, value2, value3, value6

value4, value5, value6