Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Algorithm standardisation #1896

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

wyatt-joyner-pometry
Copy link
Contributor

What changes were proposed in this pull request?

Standardization of docstrings, method signatures, and return types of many of the algorithms.

Why are the changes needed?

Improves developer experience of the platform.

Does this PR introduce any user-facing change? If yes is this documented?

All docstrings have been updated to reflect changes to method signatures in the Python and Rust functions.
raphtory-graphql/src/model/algorithms/algorithms.rs featured a small internal change to reflect the updates to Dijkstra's algorithm. The code is functionally equivalent, Dijkstra's algorithm just returns an AlgorithmResult which needed to be unpacked properly in the surrounding code.

How was this patch tested?

All Rust and Python tests pass with idempotent results.

Are there any further changes required?

The AlgorithmResults will soon be changed to NodeState results. This PR is still worth it, imo, since it will be easier to mechanically change AlgorithmResult outputs to NodeState outputs and all of the documentation and signature normalizations are valuable.

Copy link
Collaborator

@ljeub-pometry ljeub-pometry left a comment

Choose a reason for hiding this comment

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

some minor comments to address, also, I would vote for standardising on graph for the input argument instead of g

python/python/raphtory/algorithms/__init__.pyi Outdated Show resolved Hide resolved
python/python/raphtory/algorithms/__init__.pyi Outdated Show resolved Hide resolved
raphtory/src/algorithms/algorithm_result.rs Outdated Show resolved Hide resolved
raphtory/src/algorithms/algorithm_result.rs Outdated Show resolved Hide resolved
Comment on lines +49 to 52
/// The largest degree
pub fn max_degree<'graph, G: GraphViewOps<'graph>>(graph: &G) -> usize {
graph.nodes().degree().max().unwrap_or(0)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

this algorithm is fairly useless now that it's just graph.nodes().degree().max()...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. I'll just take it out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, to be fair, all of these 'max_in_degree', 'max_out_degree'... etc do not really rise to the level of algorithms, imo. They're all just one-liners.

raphtory/src/python/packages/algorithms.rs Show resolved Hide resolved
raphtory/src/python/packages/algorithms.rs Outdated Show resolved Hide resolved
raphtory/src/python/packages/algorithms.rs Show resolved Hide resolved
raphtory/src/python/packages/algorithms.rs Show resolved Hide resolved
raphtory/src/python/packages/algorithms.rs Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants