lib/dagwood/dependency_graph.rb
# Generate a subgraph starting at the given node
Generate a subgraph starting at the given node
Generate a subgraph starting at the given node
def subgraph(node)
      return self.class.new({}) unless @dependencies.key? node
      hash = {}
      hash[node] = @dependencies[node]
      @dependencies[node].each { |dep| hash.merge! subgraph(dep).dependencies }
      self.class.new hash
    end
def subgraph ( node ) return self . class . new ( { } ) unless @dependencies . key? node hash = { } hash [ node ] = @dependencies [ node ] @dependencies [ node ] . each { | dep | hash . merge! subgraph ( dep ) . dependencies } self . class . new hash end
Generate a subgraph starting at the given node
Generate a subgraph starting at the given node
# Add the given node and its dependencies to our hash # For every dependency of the given node, recursively create a subgraph and merge it into our result
node
<not_specific>