98 ArrayView<const gno_t> edgeIds;
99 ArrayView<const offset_t> offsets;
100 ArrayView<StridedData<lno_t, scalar_t> > wgts;
102 const size_t nVtx = model->getLocalNumVertices();
103 model->getEdgeList(edgeIds, offsets, wgts);
104 const int numWeightsPerEdge = model->getNumWeightsPerEdge();
105 if (numWeightsPerEdge > 1){
106 throw std::runtime_error(
"Multiple weights not supported.");
111 cout <<
"Debug: Local graph from getLocalEdgeList" << endl;
112 cout <<
"rank " << comm->getRank() <<
": nVtx= " << nVtx << endl;
113 cout <<
"rank " << comm->getRank() <<
": edgeIds: " << edgeIds << endl;
114 cout <<
"rank " << comm->getRank() <<
": offsets: " << offsets << endl;
118 const ArrayRCP<lno_t> invPerm = solution->getPermutationRCP(
true);
119 const ArrayRCP<lno_t> tmpPerm(invPerm.size());
123 if (offsets[nVtx] == 0) {
124 for (
size_t i = 0; i < nVtx; ++i) {
127 solution->setHaveInverse(
true);
132 Tpetra::global_size_t
INVALID = Teuchos::OrdinalTraits<Tpetra::global_size_t>::invalid();
133 for (
size_t i = 0; i < nVtx; ++i) {
143 Teuchos::Array<std::pair<gno_t, offset_t> > children;
145 while (count < nVtx) {
149 while ((next < nVtx) && (
static_cast<Tpetra::global_size_t
>(invPerm[next]) !=
INVALID)) next++;
153 std::string root_method = pl->get(
"root_method",
"pseudoperipheral");
154 if (root_method == std::string(
"first"))
156 else if (root_method == std::string(
"smallest_degree"))
157 root = findSmallestDegree(next, nVtx, edgeIds, offsets);
158 else if (root_method == std::string(
"pseudoperipheral"))
159 root = findPseudoPeripheral(next, nVtx, edgeIds, offsets);
162 throw std::runtime_error(
"invalid root_method");
168 invPerm[root] = count++;
169 tmpPerm[invPerm[root]] = root;
179 for (
offset_t ptr = offsets[v]; ptr < offsets[v+1]; ++ptr){
180 gno_t child = edgeIds[ptr];
181 if (
static_cast<Tpetra::global_size_t
>(invPerm[child]) ==
INVALID){
183 std::pair<gno_t,offset_t> newchild;
184 newchild.first = child;
185 newchild.second = offsets[child+1] - offsets[child];
186 children.push_back(newchild);
194 typename Teuchos::Array<std::pair<gno_t,offset_t> >::iterator it = children.begin ();
195 for ( ; it != children.end(); ++it){
197 gno_t child = it->first;
198 invPerm[child] = count++;
199 tmpPerm[invPerm[child]] = child;
212 for (
size_t i=0; i < nVtx/2; ++i) {
219 invPerm[tmpPerm[nVtx-1-i]] = i;
220 invPerm[temp] = nVtx-1-i;
225 solution->setHaveInverse(
true);