Skip to content

Group return values of renumber_edgelist and input parameters of graph_t & graph_view_t constructors.#1816

Merged
rapids-bot[bot] merged 4 commits intorapidsai:branch-21.10from
seunghwak:enh_refactor
Sep 15, 2021
Merged

Group return values of renumber_edgelist and input parameters of graph_t & graph_view_t constructors.#1816
rapids-bot[bot] merged 4 commits intorapidsai:branch-21.10from
seunghwak:enh_refactor

Conversation

@seunghwak
Copy link
Contributor

Group return values of renumber_edgelist (except for the main renumber_map) and return as a renumber_meta_t object.
Group input parameters of graph_t & graph_view_t constructors (except for the raft::handle and input parameters for the actual graph data) as a single graph_(view_)meta_t variable.

This is to make it easier to add more meta data in the future.

@seunghwak seunghwak requested a review from a team as a code owner September 10, 2021 19:48
@seunghwak seunghwak added 3 - Ready for Review improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Sep 10, 2021
@codecov-commenter
Copy link

codecov-commenter commented Sep 10, 2021

Codecov Report

Merging #1816 (09ffec8) into branch-21.10 (bf64c2c) will increase coverage by 9.71%.
The diff coverage is n/a.

❗ Current head 09ffec8 differs from pull request most recent head 58f96d0. Consider uploading reports for the commit 58f96d0 to get more accurate results
Impacted file tree graph

@@               Coverage Diff                @@
##           branch-21.10    #1816      +/-   ##
================================================
+ Coverage         59.85%   69.56%   +9.71%     
================================================
  Files                77      137      +60     
  Lines              3547     8579    +5032     
================================================
+ Hits               2123     5968    +3845     
- Misses             1424     2611    +1187     
Impacted Files Coverage Δ
python/cugraph/dask/traversal/sssp.py
python/cugraph/community/louvain.py
python/cugraph/dask/community/__init__.py
python/cugraph/cores/__init__.py
python/cugraph/community/subgraph_extraction.py
python/cugraph/link_analysis/hits.py
python/cugraph/dask/common/part_utils.py
python/cugraph/community/triangle_count.py
python/cugraph/link_analysis/__init__.py
python/cugraph/generators/__init__.py
... and 204 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df2d81d...58f96d0. Read the comment docs.


} // namespace detail

template <typename vertex_t, typename edge_t, bool multi_gpu, typename Enable = void>
Copy link
Collaborator

Choose a reason for hiding this comment

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

graph_view_meta_t seems repetitive of a functionality that graph_meta_t already offers. Is there a strong motivation for this apparent code duplication? Would it be possible to delegate this grouping functionality to only one such meta pair?

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, they are currently pretty much the same but this restructuring is mainly to pass additional parameters. When we support (key, value) pairs for row/column properties, pointers to unique rows/columns will be only passed to graph_view_meta_t.

So, these two will diverge (and possibly diverge even more over time), and that's the key motivation for having two separate classes.

Copy link
Member

Choose a reason for hiding this comment

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

@seunghwak will graph_meta_t always be a subset of graph_view_meta_t (e.g. derived class) or will the two be completely unique over time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There will be an overlap but the two will have non-overlapping parts.

minor_ptrs,
edgelist_edge_counts,
edgelist_intra_partition_segment_offsets);
std::tie(renumber_map_labels, meta) = cugraph::renumber_edgelist<vertex_t, edge_t, multi_gpu>(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps time to progressively replace std::tie() by C++17 structural bindings, which might be a bit more readable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah... Here I used std::tie instead of structural binding as renumber_map_labels & meta are defined outside the {} block, but I don't see much need for this block (besides, releasing the host memory hold by std::vector<vertex_t const*> major_ptrs & minor_ptrs little early... I will update this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

store_transposed ? edgelist_cols.data() : edgelist_rows.data(),
store_transposed ? edgelist_rows.data() : edgelist_cols.data(),
static_cast<edge_t>(edgelist_rows.size()));
std::tie(*renumber_map_labels, meta) = cugraph::renumber_edgelist<vertex_t, edge_t, multi_gpu>(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same comment on std::tie() vs. structural bindings.

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 not possible because renumber_map_labels & meta are defined outside the if (renumber) {} block.

@BradReesWork BradReesWork added this to the 21.10 milestone Sep 14, 2021
@BradReesWork
Copy link
Member

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 44be72a into rapidsai:branch-21.10 Sep 15, 2021
@seunghwak seunghwak deleted the enh_refactor branch October 19, 2021 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improvement / enhancement to an existing function non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants