Skip to content

Commit

Permalink
Remove vector in definition of DegreeMatrix (#459)
Browse files Browse the repository at this point in the history
* Remove `std::vector<int>` in def of `DegreeMatrix`

* Update calculation of degree matrix

* Remove useless line
  • Loading branch information
sbaldu authored Jun 25, 2024
1 parent 1057808 commit 3c98352
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions include/CXXGraph/Graph/Graph_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,9 +545,7 @@ shared<DegreeMatrix<T>> Graph<T>::getDegreeMatrix() const {
const std::vector<std::pair<shared<const Node<T>>, shared<const Edge<T>>>>
&neighbors = nodePair.second;

int degree = (int)neighbors.size();

(*degreeMatrix)[node] = {degree};
(*degreeMatrix)[node] = neighbors.size();
}

return degreeMatrix;
Expand Down
2 changes: 1 addition & 1 deletion include/CXXGraph/Utility/Typedef.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ using AdjacencyMatrix = std::unordered_map<

template <typename T>
using DegreeMatrix =
std::unordered_map<shared<const Node<T>>, std::vector<int>, nodeHash<T>>;
std::unordered_map<shared<const Node<T>>, unsigned int, nodeHash<T>>;

template <typename T>
using LaplacianMatrix = std::unordered_map<
Expand Down

0 comments on commit 3c98352

Please sign in to comment.