Skip to content

Commit 3c98352

Browse files
authored
Remove vector in definition of DegreeMatrix (#459)
* Remove `std::vector<int>` in def of `DegreeMatrix` * Update calculation of degree matrix * Remove useless line
1 parent 1057808 commit 3c98352

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

include/CXXGraph/Graph/Graph_impl.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,9 +545,7 @@ shared<DegreeMatrix<T>> Graph<T>::getDegreeMatrix() const {
545545
const std::vector<std::pair<shared<const Node<T>>, shared<const Edge<T>>>>
546546
&neighbors = nodePair.second;
547547

548-
int degree = (int)neighbors.size();
549-
550-
(*degreeMatrix)[node] = {degree};
548+
(*degreeMatrix)[node] = neighbors.size();
551549
}
552550

553551
return degreeMatrix;

include/CXXGraph/Utility/Typedef.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ using AdjacencyMatrix = std::unordered_map<
249249

250250
template <typename T>
251251
using DegreeMatrix =
252-
std::unordered_map<shared<const Node<T>>, std::vector<int>, nodeHash<T>>;
252+
std::unordered_map<shared<const Node<T>>, unsigned int, nodeHash<T>>;
253253

254254
template <typename T>
255255
using LaplacianMatrix = std::unordered_map<

0 commit comments

Comments
 (0)