Skip to content

Conversation

@jmatak
Copy link
Contributor

@jmatak jmatak commented Jan 10, 2022

Description

Implementation of Katz centrality algorithm which calculates the centrality corresponding to the numbers of paths flowing through the node, and their importance based on the walk length. Both static and dynamic algorithms are approximations but have the property that saves the centrality rankings in the final result. The algorithm is based on: Scalable Katz Ranking Computation in Large Static and Dynamic Graphs.

Pull request type

  • Algorithm/Module

######################################

Reviewer checklist (the reviewer checks this part)

Module/Algorithm

  • Core algorithm/module implementation
  • Query module implementation
  • Unit tests
  • End-to-end tests
  • Code documentation
  • README short description
  • Documentation on memgraph/docs

######################################

@jmatak jmatak added type: algorithm Initial algorithm implementation lang: cpp Issue on C++ codebase labels Jan 10, 2022
@jmatak jmatak self-assigned this Jan 10, 2022
@antepusic antepusic self-requested a review March 31, 2022 08:33
Copy link
Contributor

@antepusic antepusic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks solid! 👍

Quick comment - are the separate empty files in /algorithm_online necessary? The algorithm as implemented has both offline and online functionality.

Comment on lines 342 to 360
std::vector<std::uint64_t> GetEdgeIDsFromList(mgp_list *list) {
auto size = mgp::list_size(list);
auto edge_ids = std::vector<std::uint64_t>(size);
for (std::size_t i = 0; i < size; i++) {
auto edge = mgp::value_get_edge(mgp::list_at(list, i));
auto edge_id = mgp::edge_get_id(edge).as_int;
edge_ids[i] = edge_id;
}
return edge_ids;
}

std::vector<std::uint64_t> GetVerticesFromList(mgp_list *list) {
auto size = mgp::list_size(list);
auto vertices = std::vector<std::uint64_t>(size);
for (std::size_t i = 0; i < size; i++) {
vertices[i] = mgp::vertex_get_id(mgp::value_get_vertex(mgp::list_at(list, i))).as_int;
}
return vertices;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've implemented the GetNodeIDs and GetEdgeEndpointIDs utilities before; these may be redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was done before these methods, I should use them now 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad. It was here before, just didn't see it. Tnx

@jmatak jmatak marked this pull request as ready for review April 5, 2022 11:45
@jmatak jmatak requested a review from antepusic April 10, 2022 17:20
@jmatak jmatak requested review from antepusic and jbajic April 12, 2022 07:16
README.md Outdated
| [graph_analyzer](python/graph_analyzer.py) | Python | This Graph Analyzer query module offers insights about the stored graph or a subgraph. |
| [graph_coloring](python/graph_coloring.py) | Python | An algorithm for assigning labels to the graph elements subject to certain constraints. In this form, it is a way of coloring the graph vertices such that no two adjacent vertices are of the same color. |
| [json_util](python/json_util.py) | Python | A module for loading JSON from a local file or remote address.
| [katz_centrality](cpp/katz_centrality_module/katz_centrality_module.cpp.py) | C++ | Katz centrality is the centrality measurement that outputs the influence based on the number of shortest paths and their weighted length.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| [katz_centrality](cpp/katz_centrality_module/katz_centrality_module.cpp.py) | C++ | Katz centrality is the centrality measurement that outputs the influence based on the number of shortest paths and their weighted length.
| [katz_centrality](cpp/katz_centrality_module/katz_centrality_module.cpp.py) | C++ | Katz centrality is a centrality measurement that outputs a node's influence based on the number of shortest paths and their weighted length.

@jmatak jmatak merged commit aaf8824 into main Apr 15, 2022
@jmatak jmatak deleted the T166-MAGE_katz-centrality branch April 15, 2022 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lang: cpp Issue on C++ codebase type: algorithm Initial algorithm implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants