BranchChildren.cc
Go to the documentation of this file.
2 
3 #include <utility>
4 
5 namespace art {
6 
7  void
9  ProductID const item,
10  ProductIDSet& itemSet) const
11  {
12  auto const& items = const_cast<map_t&>(lookup)[item];
13  // For each parent(child)
14  for (auto const& i : items) {
15  // Insert the ProductID of the parents (children) into the set
16  // of ancestors (descendants). If the insert succeeds, append
17  // recursively.
18  if (itemSet.insert(i).second) {
19  append_(lookup, i, itemSet);
20  }
21  }
22  }
23 
24  void
26  {
27  childLookup_.clear();
28  }
29 
30  void
32  {
33  childLookup_.emplace(parent, ProductIDSet{});
34  }
35 
36  void
38  {
39  childLookup_[parent].insert(child);
40  }
41 
42  void
44  ProductIDSet& descendants) const
45  {
46  descendants.insert(parent);
47  append_(childLookup_, parent, descendants);
48  }
49 }
void appendToDescendants(ProductID parent, ProductIDSet &descendants) const
void insertEmpty(ProductID parent)
void insertChild(ProductID parent, ProductID child)
void append_(map_t const &lookup, ProductID item, ProductIDSet &itemSet) const
std::map< ProductID, ProductIDSet > map_t
def parent(G, child, parent_type)
Definition: graph.py:67
std::set< ProductID > ProductIDSet