# File lib/puppet/resource/catalog.rb, line 320
320:     def relationship_graph
321:         unless defined? @relationship_graph and @relationship_graph
322:             # It's important that we assign the graph immediately, because
323:             # the debug messages below use the relationships in the
324:             # relationship graph to determine the path to the resources
325:             # spitting out the messages.  If this is not set,
326:             # then we get into an infinite loop.
327:             @relationship_graph = Puppet::SimpleGraph.new
328: 
329:             # First create the dependency graph
330:             self.vertices.each do |vertex|
331:                 @relationship_graph.add_vertex vertex
332:                 vertex.builddepends.each do |edge|
333:                     @relationship_graph.add_edge(edge)
334:                 end
335:             end
336: 
337:             # Lastly, add in any autorequires
338:             @relationship_graph.vertices.each do |vertex|
339:                 vertex.autorequire(self).each do |edge|
340:                     unless @relationship_graph.edge?(edge.source, edge.target) # don't let automatic relationships conflict with manual ones.
341:                         unless @relationship_graph.edge?(edge.target, edge.source)
342:                             vertex.debug "Autorequiring %s" % [edge.source]
343:                             @relationship_graph.add_edge(edge)
344:                         else
345:                             vertex.debug "Skipping automatic relationship with %s" % (edge.source == vertex ? edge.target : edge.source)
346:                         end
347:                     end
348:                 end
349:             end
350:             @relationship_graph.write_graph(:relationships) if host_config?
351: 
352:             # Then splice in the container information
353:             @relationship_graph.splice!(self, Puppet::Type::Component)
354: 
355:             @relationship_graph.write_graph(:expanded_relationships) if host_config?
356:         end
357:         @relationship_graph
358:     end