Artifact 7857b17ad5edb6a752dd5335d60d8cc11b45d0e4
- File
YNGraph.rb
- 2013-05-11 19:07:14 - part of checkin [2ba3bf09a0] on branch trunk - TCO 13 2C (user: kinaba) [annotate]
STDERR.print "Number of nodes? " V = gets.to_i STDERR.print "Directed (u/d)? " D = (gets.chomp.downcase=="d"); ES = [] loop do STDERR.print "Edge (u v)? " edge = gets.split.map(&:to_i) break if edge.size==0 ES << edge end V.times do |y| puts (0...V).map{|x| (D ? ES.index([y,x]) : ES.index([y,x]) || ES.index([x,y])) ? "Y" : "N" }*"" end