39 typedef std::shared_ptr<MetisIndex> shared_ptr;
44 std::map<Key, int32_t> left;
45 std::unordered_map<int32_t, Key> right;
46 void insert(
const Key& left_value,
const int32_t& right_value) {
47 left[left_value] = right_value;
48 right[right_value] = left_value;
52 std::vector<int32_t> xadj_;
53 std::vector<int32_t> adj_;
64 template<
class FactorGraphType>
65 MetisIndex(
const FactorGraphType& factorGraph) :
80 template<
class FactorGraphType>
81 void augment(
const FactorGraphType& factors);
83 const std::vector<int32_t>& xadj()
const {
return xadj_; }
84 const std::vector<int32_t>& adj()
const {
return adj_; }
85 size_t nValues()
const {
return nKeys_; }
87 Key intToKey(int32_t value)
const {
return intKeyBMap_.right.find(value)->second; }
94 void print(
const std::string& str =
"MetisIndex:")
const {
95 std::cout << str <<
"\nxadj_: ";
96 for (
const auto& x : xadj_) std::cout << x <<
" ";
97 std::cout <<
"\nadj_: ";
98 for (
const auto& x : adj_) std::cout << x <<
" ";
99 std::cout <<
"\nKey <-> Index: ";
100 for (
const auto& [i, k] : intKeyBMap_.left) std::cout << i <<
" <-> " << k <<
", ";
101 std::cout << std::endl;