28 std::map<int32_t, std::set<int32_t> > iAdjMap;
29 std::map<int32_t, std::set<int32_t> >::iterator iAdjMapIt;
38 int32_t keyCounter = 0;
42 for (
size_t i = 0; i < factors.
size(); i++) {
44 for(
const Key& key: *factors[i]) {
45 keySet.insert(keySet.end(), key);
46 if (intKeyBMap_.left.find(key) == intKeyBMap_.left.end()) {
47 intKeyBMap_.insert(bm_type::value_type(key, keyCounter));
55 for (
size_t i = 0; i < factors.
size(); i++) {
57 for(
const Key& k1: *factors[i])
58 for(
const Key& k2: *factors[i])
61 int i = intKeyBMap_.left.at(k1);
62 int j = intKeyBMap_.left.at(k2);
63 iAdjMap[i].insert(iAdjMap[i].end(), j);
69 nKeys_ = keySet.size();
72 for (iAdjMapIt = iAdjMap.begin(); iAdjMapIt != iAdjMap.end(); ++iAdjMapIt) {
73 std::vector<int32_t> temp;
75 std::copy(iAdjMapIt->second.begin(), iAdjMapIt->second.end(),
76 std::back_inserter(temp));
78 adj_.insert(adj_.end(), temp.begin(), temp.end());
80 xadj_.push_back((int32_t) adj_.size());
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:69
A factor graph is a bipartite graph with factor nodes connected to variable nodes.
Definition: FactorGraph.h:93
size_t size() const
return the number of factors (including any null factors set by remove() ).
Definition: FactorGraph.h:305
void augment(const FactorGraph< FACTOR > &factors)
Augment the variable index with new factors.
Definition: MetisIndex-inl.h:27