-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Zhanfu/csr Framework for the CSR structure #4688
Zhanfu/csr Framework for the CSR structure #4688
Conversation
unsigned int *labels = new unsigned int[l_count]; | ||
// load data vertices id and tags | ||
while (iterDV->valid()) { | ||
const auto v = iterDV->getColumn(nebula::kVid); // check if v is a vertex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are v and v2. Please use meaningful names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I change it to the new version in the code, v is the content of the vertex id while v2 is the content of the label id.
|
||
ResultBuilder builder; | ||
builder.value(iter->valuePtr()); | ||
unsigned int *offset = new unsigned int[v_count + 2]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(1) Please explain via comments why the size is +2
(2) Please use vector. Don't use new.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(1) as the offset is recording the starting position of the node 0 which suppose to be 0, and offset[1] should be the end of position node 0 and start of position node 1. The size of the offset should be at least v_count + 1;
(2) Ok
unsigned int src = iterDE->getEdgeProp("*", kSrc).getInt(); | ||
unsigned int dst = iterDE->getEdgeProp("*", kDst).getInt(); | ||
|
||
neighbors[offset[src + 1]] = dst; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not understand this. Please explain via comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(1) src and dst is the source and destination information.
(2) offset[src + 1] will be the position of the array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can change it and comment it in the new version
ResultBuilder builder; | ||
builder.value(iter->valuePtr()); | ||
unsigned int *offset = new unsigned int[v_count + 2]; | ||
unsigned int *neighbors = new unsigned int[e_count * 2]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember that for every edge A-B, we actually store 2 copies, A->B and B->A. You need to take this into consideration. They can be distinguished by edge type signs. Positive and Negative represent them respectively. Please think about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
const auto vertex = iterDV->getColumn(nebula::kVid); // check if v is a vertex | ||
auto v_id = vertex.getInt(); | ||
const auto label = iterDV->getColumn(1); // get label by index | ||
auto l_id = label.getInt(); | ||
// unsigned int v_id = (unsigned int)v.getInt(0); | ||
labels[v_id] = l_id; // Tag Id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can vID used as the index of the labels
array? There is no restriction on what vID will look like, e.g., may be from 1000 to 100000.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Therefore, it's better to use map here.
iterDE->next(); | ||
} | ||
for (unsigned int i = 0; i < v_count; i++) { | ||
offset[i + 1] = offset[i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this wrong?
@@ -90,4 +93,4 @@ nebula_add_library( | |||
mutate/UpdateExecutor.cpp | |||
) | |||
|
|||
nebula_add_subdirectory(test) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this line deleted
iterDE->next(); | ||
} | ||
|
||
// caldulate the start position of each vertex in the neighborhood array | ||
for (unsigned int i = 0; i < v_count; i++) { | ||
offset[i + 1] += offset[i]; | ||
offset[i + 1] += degree[i] + offset[i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+=?
What type of PR is this?
What problem(s) does this PR solve?
Issue(s) number:
Description:
How do you solve it?
Special notes for your reviewer, ex. impact of this fix, design document, etc:
Checklist:
Tests:
Affects:
Release notes:
Please confirm whether to be reflected in release notes and how to describe: