45 #ifndef _ZOLTAN2_SORTEDDEGREE_HPP_
46 #define _ZOLTAN2_SORTEDDEGREE_HPP_
62 template <
typename Adapter>
67 const RCP<GraphModel<Adapter> > model;
68 const RCP<Teuchos::ParameterList> pl;
69 const RCP<const Teuchos::Comm<int> > comm;
73 typedef typename Adapter::lno_t
lno_t;
74 typedef typename Adapter::gno_t
gno_t;
80 const RCP<Teuchos::ParameterList> &pl__,
81 const RCP<
const Teuchos::Comm<int> > &comm__
82 ) : model(model__), pl(pl__), comm(comm__)
88 throw std::logic_error(
89 "AlgSortedDegree does not yet support global ordering.");
98 lno_t *perm = solution->getPermutationView();
101 std::cerr <<
"perm is NULL" << std::endl;
106 const size_t nVtx = model->getLocalNumVertices();
107 ArrayView<const gno_t> edgeIds;
108 ArrayView<const offset_t> offsets;
109 ArrayView<StridedData<lno_t, scalar_t> > wgts;
110 model->getEdgeList(edgeIds, offsets, wgts);
114 Teuchos::Array<std::pair<lno_t, offset_t> > degrees(nVtx);
116 degrees[i].first = i;
117 degrees[i].second = offsets[i+1] - offsets[i];
123 zort.
sort(degrees, inc);
127 perm[i] = degrees[i].first;
130 solution->setHavePerm(
true);