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

organize an example pagerank app employing the gar library (#44) #46

Merged
merged 6 commits into from
Dec 20, 2022

Conversation

andydiwenzhu
Copy link
Contributor

Proposed changes

Organize the original PageRank test code as an example application. It demonstrates how to edit CMake to integrate GAR C++ library and how to extend an input graph with its PageRank values using GAR methods.

Types of changes

What types of changes does your code introduce to GraphAr?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

Copy link
Contributor

@acezen acezen left a comment

Choose a reason for hiding this comment

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

Nice work! The pull request looks good. It has basically met the issue requirement but some modification still need.


int main(int argc, char* argv[]) {
// read file and construct graph info
std::string path = "/tmp/ldbc_sample/parquet/ldbc_sample.graph.yml";
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a little hard-code. Use the relative path to test/gar-test or add a soft link to it maybe better

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 purpose is to make this example a new project over the GAR library.


// extend the original vertex info and write results to gar using writer
// construct property group
GraphArchive::Property pagerank = {
Copy link
Contributor

Choose a reason for hiding this comment

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

As a pagerank example, I don't know if we just write the result to file not extend as a property would be better. That would have two benefits:

  • simpler and clear for a example
  • no need to include arrow header any more.
    @lixueclaire what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree. To remove arrow here, you can use VertexBuilder instead of VertexPropertyWriter to write results. (please refer to "method 1 for writing results" in https://github.com/alibaba/GraphAr/blob/main/test/test_example/test_bgl_example.cc)

@@ -0,0 +1,23 @@
cmake_minimum_required(VERSION 2.8)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if we need a CMakeList here. Seems put these to CMakeLists in root path and make example as a new target would be better.
A new CMakeList.txt here would bring some cons:

  • it need user/develop to install GraphAr first, not just make
  • it's building need to build arrow again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I think what you suggested is the in-project examples. What I want to show here is a new application employing the GAR library, in which case, users should first install GAR, and then build their own application projects.

@@ -0,0 +1,92 @@
# Licensed to the Apache Software Foundation (ASF) under one
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto. We can reuse the apache-arrow.cmake of GraphAr.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I prefer remove arrow from our example

@@ -6,7 +6,7 @@ You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
Unless assertd by applicable law or agreed to in writing, software
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, Why we need to change required to assertd here and the assertd has a typo ?

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 is a replace mistake, I will revert it back 😁

Copy link
Contributor

@acezen acezen left a comment

Choose a reason for hiding this comment

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

Except the required to asserted question, this PR is LGTM

Copy link
Contributor

@lixueclaire lixueclaire left a comment

Choose a reason for hiding this comment

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

I have no additional comments except the filenames.

@@ -107,16 +107,16 @@ Meanwhile, BFS could be implemented in a **push**-style which only traverses the
In some cases, it is required to record the path of BFS, that is, to maintain each vertex's predecessor (also called *father*) in the traversing tree rather than only recording the distance. The implementation of BFS with recording fathers can be found at `test_bfs_father_example.cc`_.


.. _test_pagerank_example.cc: https://github.com/alibaba/GraphAr/blob/main/test/test_example/test_pagerank_example.cc
.. _test_pagerank_example.cc: https://github.com/alibaba/GraphAr/blob/main/examples/pagerank_example.cc
Copy link
Contributor

Choose a reason for hiding this comment

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

please modify these file names, for example, "test_pagerank_example.cc" -> "pagerank_example.cc"


.. _test_pagerank_example.cc: https://github.com/alibaba/GraphAr/blob/main/test/test_example/test_pagerank_example.cc
.. _test_pagerank_example.cc: https://github.com/alibaba/GraphAr/blob/main/examples/pagerank_example.cc
Copy link
Contributor

Choose a reason for hiding this comment

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

"test_pagerank_example.cc" -> "pagerank_example.cc"

@andydiwenzhu andydiwenzhu merged commit 91251e4 into apache:main Dec 20, 2022
@andydiwenzhu andydiwenzhu deleted the 44-add-examples branch December 20, 2022 03:46
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.

3 participants