# Re: Common point puzzle

**URL:** <https://www.ruby-forum.com/t/re-common-point-puzzle/80116>\
**Category:** Ruby\
**Created:** [December 21, 2006, 3:14pm UTC](https://www.ruby-forum.com/t/re-common-point-puzzle/80116 "2006-12-21T15:14:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [December 21, 2006, 3:14pm UTC](https://www.ruby-forum.com/t/re-common-point-puzzle/80116/1 "2006-12-21T15:14:26Z")

</div>

Dear Bill,

what about something like this ?

# an example set of graphs - hashes with names and sets of coordinates

as  
values  
all\_graphs={‘coarsest’,[[1,2],[3,4]],‘subgraph’,[[1,2],[3,4],[1.5,2],[3.5,4]],  
‘subsubgraph’,[[1,2],[3,4],[1.25,2],[1.5,2],[3.25,4],[3.5,4]]}  
points\_in\_subgraph={}  
all\_graphs.each{|graph,points|  
lazy\_points=points-all\_graphs[‘coarsest’]  
do\_something\_here\_points=points-lazy\_points  
points\_in\_subgraph.update({graph,do\_something\_here\_points})  
}

work\_done\_in\_subgraphs={}  
points\_in\_subgraph.each{|k,v|  
work\_done\_in\_subgraphs.update({k,v.my\_divisions})

}

class Array  
def my\_divisions

# …perform your divisions on each point here

end  
end

Best regards,

Axel
