def friendly_unique_node_names
      node_names = {}
      # Try to use shorter .name method that InventoryCollection has.
      nodes.group_by { |n| n.respond_to?(:name) ? n.name.to_s : n.to_s }.each do |base_name, ns|
        ns.each_with_index do |n, i|
          name = ns.size == 1 ? base_name : "#{base_name}_#{i}"
          name = '"' + name.gsub(/["\\]/) { |c| "\\" + c } + '"' unless name =~ /^[A-Za-z0-9_]+$/
          node_names[n] = name
        end
      end
      node_names
    end
def friendly_unique_node_names
      node_names = {}
      # Try to use shorter .name method that InventoryCollection has.
      nodes.group_by { |n| n.respond_to?(:name) ? n.name.to_s : n.to_s }.each do |base_name, ns|
        ns.each_with_index do |n, i|
          name = ns.size == 1 ? base_name : "#{base_name}_#{i}"
          name = '"' + name.gsub(/["\\]/) { |c| "\\" + c } + '"' unless name =~ /^[A-Za-z0-9_]+$/
          node_names[n] = name
        end
      end
      node_names
    end
Returns Hash of {node => name}, appending numbers if needed to make unique, quoted if needed. Used for the
 GraphViz format

 @return [Hash] Hash of {node => name}