Skip to content

Conversation

zyxxoo
Copy link
Contributor

@zyxxoo zyxxoo commented Aug 3, 2021

No description provided.

@zyxxoo zyxxoo force-pushed the degree_centrality branch 3 times, most recently from b67e173 to cf3cdc1 Compare August 3, 2021 11:49
@codecov
Copy link

codecov bot commented Aug 3, 2021

Codecov Report

❗ No coverage uploaded for pull request base (master@9a14659). Click here to learn what that means.
The diff coverage is 33.33%.

Impacted file tree graph

@@ Coverage Diff @@ ## master #77 +/- ## ========================================= Coverage ? 87.95% Complexity ? 2618 ========================================= Files ? 271 Lines ? 9874 Branches ? 829 ========================================= Hits ? 8685 Misses ? 785 Partials ? 404 
Impacted Files Coverage Δ
...r/algorithm/degreecentrality/DegreeCentrality.java 0.00% <0.00%> (ø)
...gegraph/computer/core/graph/value/DoubleValue.java 86.20% <0.00%> (ø)
...ugegraph/computer/core/graph/value/FloatValue.java 86.20% <0.00%> (ø)
.../hugegraph/computer/core/graph/value/IntValue.java 86.20% <0.00%> (ø)
...hugegraph/computer/core/graph/value/LongValue.java 86.20% <0.00%> (ø)
.../algorithm/centrality/degree/DegreeCentrality.java 35.29% <35.29%> (ø)
...ithm/centrality/degree/DegreeCentralityParams.java 100.00% <100.00%> (ø)

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 9a14659...9408263. Read the comment docs.

Comment on lines +62 to +70
@Override
public void init(Config config) {
// pass
}

@Override
public void close(Config config) {
// pass
}
Copy link
Contributor

Choose a reason for hiding this comment

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

remove these empty methods

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 class inherits Computer interface, must override these methods

Comment on lines +73 to +80
public void beforeSuperstep(WorkerContext context) {
// pass
}

@Override
public void afterSuperstep(WorkerContext context) {
// pass
}
Copy link
Contributor

Choose a reason for hiding this comment

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

remove these empty methods

@Override
public void compute0(ComputationContext context, Vertex vertex) {
long normalization = context.totalVertexCount() - 1;
if (normalization <= 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

0L

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, this version we don't use normalization

if (normalization <= 0) {
vertex.value(new DoubleValue(1.0));
} else {
vertex.value(new DoubleValue(vertex.numEdges() / normalization));
Copy link
Contributor

Choose a reason for hiding this comment

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

don't need to this version, since context.totalVertexCount() - 1 is not the max degree in hugegraph

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ditto

@zyxxoo zyxxoo force-pushed the degree_centrality branch 2 times, most recently from 82344ff to 3b52c65 Compare August 6, 2021 09:34
@zyxxoo zyxxoo force-pushed the degree_centrality branch 6 times, most recently from 06de4da to ee3a3ee Compare August 6, 2021 12:17
while (edges.hasNext()) {
edge = edges.next();
DoubleValue value = edge.properties().get(this.weight);
E.checkArgumentNotNull(value, "The edge's '%s' weight " +
Copy link
Contributor

Choose a reason for hiding this comment

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

set 0 if not exist weight property?

Copy link
Contributor Author

@zyxxoo zyxxoo Aug 6, 2021

Choose a reason for hiding this comment

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

graph server weightShortestPath default value is 1.0 if not exist, so here we also set 1.0 if not exist

@zyxxoo zyxxoo force-pushed the degree_centrality branch 4 times, most recently from bfff46a to 008c0d2 Compare August 7, 2021 05:23
@Override
public void write(Vertex vertex) {
super.write(vertex);
isRun = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

change to counter++?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

algorithm verify logic lie on write code block, isRun only mark the algorithm is running, so use boolean maybe is enough

Copy link
Contributor

Choose a reason for hiding this comment

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

if use counter, can assert write times is expected.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in fact, assert logic is different on different algorithm, degree centrality don't need verify write times, so maybe other algorithm can use counter

@zyxxoo zyxxoo force-pushed the degree_centrality branch from 008c0d2 to 7d59cbb Compare August 10, 2021 03:20
vertex.value(new DoubleValue(vertex.numEdges()));
} else {
Edge edge = null;
BigDecimal totalWeight = BigDecimal.valueOf(0.0);
Copy link
Contributor

Choose a reason for hiding this comment

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

seems double value is ok?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

==, here consider super vertex, and maybe overflow

Copy link
Contributor

Choose a reason for hiding this comment

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

calling totalWeight.doubleValue() with BigDecimal may also overflow

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, BigDecimal can handle overflow, but BigDecimal.doubleValue() can overflow

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we consider implement "BigDecimalValue" earliest, so use these, but now no time to do it, so maybe here we change to double ,and annotation to use BigDecimalValue in the future

@Override
public void write(Vertex vertex) {
super.write(vertex);
isRun = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

if use counter, can assert write times is expected.

@zyxxoo zyxxoo force-pushed the degree_centrality branch 3 times, most recently from 6cebe71 to 546966b Compare August 10, 2021 06:17
vertex.value(new DoubleValue(vertex.numEdges()));
} else {
Edge edge = null;
BigDecimal totalWeight = BigDecimal.valueOf(0.0);
Copy link
Contributor

Choose a reason for hiding this comment

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

calling totalWeight.doubleValue() with BigDecimal may also overflow

@zyxxoo zyxxoo force-pushed the degree_centrality branch from 246a39e to e8f1fe1 Compare August 10, 2021 08:15
javeme
javeme previously approved these changes Aug 10, 2021
@javeme
Copy link
Contributor

javeme commented Aug 11, 2021

ci blocked:

2021-08-11 03:26:20 1422628 [pool-59-thread-3] [INFO ] com.baidu.hugegraph.computer.core.bsp.EtcdClient [] - Wait for keys with prefix 'BSP_WORKER_OUTPUT_DONE' and timeout 86400000ms, expect 2 keys but actual got 1 keys 2021-08-11 03:26:30 1432628 [pool-59-thread-3] [INFO ] com.baidu.hugegraph.computer.core.bsp.EtcdClient [] - Wait for keys with prefix 'BSP_WORKER_OUTPUT_DONE' and timeout 86400000ms, expect 2 keys but actual got 1 keys 2021-08-11 03:26:40 1442629 [pool-59-thread-3] [INFO ] com.baidu.hugegraph.computer.core.bsp.EtcdClient [] - Wait for keys with prefix 'BSP_WORKER_OUTPUT_DONE' and timeout 86400000ms, expect 2 keys but actual got 1 keys
Comment on lines +74 to +75
(Value) edge.properties()
.get(this.weightProperty));
Copy link
Contributor

Choose a reason for hiding this comment

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

add edge.property(key) method

*/
public class MockWorkerService extends WorkerService {


Copy link
Contributor

Choose a reason for hiding this comment

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

remove unused empty line

params.put(RpcOptions.RPC_SERVER_HOST.name(), "localhost");
params.put(RpcOptions.RPC_SERVER_PORT.name(), "8090");
params.put(ComputerOptions.JOB_ID.name(), "local_002");
params.put(ComputerOptions.JOB_WORKERS_COUNT.name(), "1");
Copy link
Contributor

Choose a reason for hiding this comment

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

seems not effect in ci tests

@coderzc coderzc force-pushed the degree_centrality branch from 3a1745c to b65be6c Compare August 11, 2021 09:02
@coderzc coderzc force-pushed the degree_centrality branch from b2622d5 to 9408263 Compare August 11, 2021 09:21
@zyxxoo zyxxoo merged commit aa8daec into master Aug 11, 2021
@javeme javeme deleted the degree_centrality branch August 12, 2021 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants