Artifact Content
Not logged in

Artifact 7857b17ad5edb6a752dd5335d60d8cc11b45d0e4


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