Method: Plexus::GraphBuilder#complement

Defined in:
lib/plexus/graph.rb

#complementGraph

Computes the complement of the current graph.

Returns:



586
587
588
589
590
591
# File 'lib/plexus/graph.rb', line 586

def complement
  vertices.inject(self.class.new) do |a,v|
    a.add_vertex!(v)
    vertices.each { |v2| a.add_edge!(v, v2) unless edge?(v, v2) }; a
  end
end