# File lib/mcollective/application/inventory.rb, line 55
  def collectives_map(file)
    File.open(file, "w") do |graph|
      puts "Retrieving collective info...."
      collectives = get_collectives

      graph.puts 'graph {'

      collectives[:collectives].keys.sort.each do |collective|
        graph.puts '   subgraph "%s" {' % [ collective ]

        collectives[:collectives][collective].each do |member|
          graph.puts '      "%s" -- "%s"' % [ member, collective ]
        end

        graph.puts '   }'
      end

      graph.puts '}'

      puts "Graph of #{collectives[:total_nodes]} nodes has been written to #{file}"
    end
  end