# File lib/puppet/resource/catalog.rb, line 305
305:   def relationship_graph
306:     unless @relationship_graph
307:       # It's important that we assign the graph immediately, because
308:       # the debug messages below use the relationships in the
309:       # relationship graph to determine the path to the resources
310:       # spitting out the messages.  If this is not set,
311:       # then we get into an infinite loop.
312:       @relationship_graph = Puppet::SimpleGraph.new
313: 
314:       # First create the dependency graph
315:       self.vertices.each do |vertex|
316:         @relationship_graph.add_vertex vertex
317:         vertex.builddepends.each do |edge|
318:           @relationship_graph.add_edge(edge)
319:         end
320:       end
321: 
322:       # Lastly, add in any autorequires
323:       @relationship_graph.vertices.each do |vertex|
324:         vertex.autorequire(self).each do |edge|
325:           unless @relationship_graph.edge?(edge.source, edge.target) # don't let automatic relationships conflict with manual ones.
326:             unless @relationship_graph.edge?(edge.target, edge.source)
327:               vertex.debug "Autorequiring #{edge.source}"
328:               @relationship_graph.add_edge(edge)
329:             else
330:               vertex.debug "Skipping automatic relationship with #{(edge.source == vertex ? edge.target : edge.source)}"
331:             end
332:           end
333:         end
334:       end
335:       @relationship_graph.write_graph(:relationships) if host_config?
336: 
337:       # Then splice in the container information
338:       @relationship_graph.splice!(self, Puppet::Type::Component)
339: 
340:       @relationship_graph.write_graph(:expanded_relationships) if host_config?
341:     end
342:     @relationship_graph
343:   end