javeme commented on code in PR #285:
URL: 
https://github.com/apache/incubator-hugegraph-computer/pull/285#discussion_r1401705929


##########
computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/ShortestPathMessage.java:
##########
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * 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
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hugegraph.computer.algorithm.path.shortest;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.hugegraph.computer.core.graph.value.DoubleValue;
+import org.apache.hugegraph.computer.core.graph.value.IdList;
+import org.apache.hugegraph.computer.core.graph.value.ListValue;
+import org.apache.hugegraph.computer.core.graph.value.Value;
+import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
+import org.apache.hugegraph.computer.core.io.RandomAccessInput;
+import org.apache.hugegraph.computer.core.io.RandomAccessOutput;
+
+public class ShortestPathMessage implements Value.CustomizeValue<List<Object>> 
{
+
+    /**
+     * path
+     */
+    private final IdList path;
+
+    /**
+     * weight of path
+     */
+    private final ListValue<DoubleValue> pathWeight;
+
+    public ShortestPathMessage() {
+        this.path = new IdList();
+        this.pathWeight = new ListValue<DoubleValue>();
+    }
+
+    @Override
+    public void read(RandomAccessInput in) throws IOException {
+        this.path.read(in);
+        this.pathWeight.read(in);
+    }
+
+    @Override
+    public void write(RandomAccessOutput out) throws IOException {
+        this.path.write(out);
+        this.pathWeight.write(out);
+    }
+
+    @Override
+    public List<Object> value() {
+        return this.path.value();
+    }
+
+    public void value(ShortestPathMessage message) {
+        this.path.clear();
+        this.pathWeight.clear();
+
+        this.path.addAll(message.path().copy().values());
+        this.pathWeight.addAll(message.pathWeight().copy().values());
+    }
+
+    public void addToPath(Vertex vertex, double weight) {
+        this.path.add(vertex.id());
+        this.pathWeight.add(new DoubleValue(weight));
+    }
+
+    public void addToPath(IdList path, ListValue<DoubleValue> pathWeight,
+                          Vertex vertex, double weight) {
+        this.path.addAll(path.copy().values());
+        this.pathWeight.addAll(pathWeight.copy().values());
+
+        this.path.add(vertex.id());
+        this.pathWeight.add(new DoubleValue(weight));

Review Comment:
   can we remove these 2 lines since users can call like this:
   ```java
   addToPath(IdList path, ListValue<DoubleValue> pathWeight);
   addToPath(Vertex vertex, double weight);
   ```



##########
computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/SourceTargetShortestPath.java:
##########
@@ -0,0 +1,197 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * 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
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hugegraph.computer.algorithm.path.shortest;
+
+import java.util.Iterator;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.hugegraph.computer.core.common.exception.ComputerException;
+import org.apache.hugegraph.computer.core.config.Config;
+import org.apache.hugegraph.computer.core.graph.edge.Edge;
+import org.apache.hugegraph.computer.core.graph.value.DoubleValue;
+import org.apache.hugegraph.computer.core.graph.value.Value;
+import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
+import org.apache.hugegraph.computer.core.worker.Computation;
+import org.apache.hugegraph.computer.core.worker.ComputationContext;
+import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
+public class SourceTargetShortestPath implements 
Computation<ShortestPathMessage> {
+
+    private static final Logger LOG = 
Log.logger(SourceTargetShortestPath.class);
+
+    public static final String OPTION_SOURCE_ID = 
"source_target_shortest_path.source_id";
+    public static final String OPTION_TARGET_ID = 
"source_target_shortest_path.target_id";
+    public static final String OPTION_WEIGHT_PROPERTY =
+            "source_target_shortest_path.weight_property";
+    public static final String OPTION_DEFAULT_WEIGHT =
+            "source_target_shortest_path.default_weight";
+
+    /**
+     * source vertex id
+     */
+    private String sourceId;
+
+    /**
+     * target vertex id
+     */
+    private String targetId;
+
+    /**
+     * weight property.
+     * weight value must be a positive number.
+     */
+    private String weightProperty;
+
+    /**
+     * default weight.
+     * default 1
+     */
+    private Double defaultWeight;
+
+    @Override
+    public String category() {
+        return "path";
+    }
+
+    @Override
+    public String name() {
+        return "source_target_shortest_path";
+    }
+
+    @Override
+    public void init(Config config) {
+        this.sourceId = config.getString(OPTION_SOURCE_ID, "");
+        if (StringUtils.isBlank(this.sourceId)) {
+            throw new ComputerException("The param %s must not be blank, ", 
OPTION_SOURCE_ID);

Review Comment:
   `%s` => `'%s'`
   `blank,` => `blank`



##########
computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/SourceTargetShortestPath.java:
##########
@@ -0,0 +1,197 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * 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
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hugegraph.computer.algorithm.path.shortest;
+
+import java.util.Iterator;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.hugegraph.computer.core.common.exception.ComputerException;
+import org.apache.hugegraph.computer.core.config.Config;
+import org.apache.hugegraph.computer.core.graph.edge.Edge;
+import org.apache.hugegraph.computer.core.graph.value.DoubleValue;
+import org.apache.hugegraph.computer.core.graph.value.Value;
+import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
+import org.apache.hugegraph.computer.core.worker.Computation;
+import org.apache.hugegraph.computer.core.worker.ComputationContext;
+import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
+public class SourceTargetShortestPath implements 
Computation<ShortestPathMessage> {
+
+    private static final Logger LOG = 
Log.logger(SourceTargetShortestPath.class);
+
+    public static final String OPTION_SOURCE_ID = 
"source_target_shortest_path.source_id";
+    public static final String OPTION_TARGET_ID = 
"source_target_shortest_path.target_id";
+    public static final String OPTION_WEIGHT_PROPERTY =
+            "source_target_shortest_path.weight_property";
+    public static final String OPTION_DEFAULT_WEIGHT =
+            "source_target_shortest_path.default_weight";
+
+    /**
+     * source vertex id
+     */
+    private String sourceId;
+
+    /**
+     * target vertex id
+     */
+    private String targetId;
+
+    /**
+     * weight property.
+     * weight value must be a positive number.
+     */
+    private String weightProperty;
+
+    /**
+     * default weight.
+     * default 1
+     */
+    private Double defaultWeight;
+
+    @Override
+    public String category() {
+        return "path";
+    }
+
+    @Override
+    public String name() {
+        return "source_target_shortest_path";
+    }
+
+    @Override
+    public void init(Config config) {
+        this.sourceId = config.getString(OPTION_SOURCE_ID, "");
+        if (StringUtils.isBlank(this.sourceId)) {
+            throw new ComputerException("The param %s must not be blank, ", 
OPTION_SOURCE_ID);
+        }
+
+        this.targetId = config.getString(OPTION_TARGET_ID, "");
+        if (StringUtils.isBlank(this.targetId)) {
+            throw new ComputerException("The param %s must not be blank, ", 
OPTION_TARGET_ID);
+        }
+
+        this.weightProperty = config.getString(OPTION_WEIGHT_PROPERTY, "");
+
+        this.defaultWeight = config.getDouble(OPTION_DEFAULT_WEIGHT, 1);
+        if (this.defaultWeight <= 0) {
+            throw new ComputerException("The param %s must be greater than 0, 
" +
+                                        "actual got '%s'",
+                                        OPTION_DEFAULT_WEIGHT, 
this.defaultWeight);
+        }
+    }
+
+    @Override
+    public void compute0(ComputationContext context, Vertex vertex) {
+        ShortestPathValue value = new ShortestPathValue();
+        vertex.value(value);
+
+        // start from source vertex
+        if (!this.idEquals(vertex, this.sourceId)) {
+            vertex.inactivate();
+            return;
+        }
+
+        value.updatePath(vertex, 0); // source vertex
+
+        // source vertex == target vertex
+        if (this.sourceId.equals(this.targetId)) {
+            LOG.info("source vertex {} equals target vertex {}", 
this.sourceId, this.targetId);

Review Comment:
   keep log.debug?



##########
computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/SourceTargetShortestPath.java:
##########
@@ -0,0 +1,197 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * 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
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hugegraph.computer.algorithm.path.shortest;
+
+import java.util.Iterator;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.hugegraph.computer.core.common.exception.ComputerException;
+import org.apache.hugegraph.computer.core.config.Config;
+import org.apache.hugegraph.computer.core.graph.edge.Edge;
+import org.apache.hugegraph.computer.core.graph.value.DoubleValue;
+import org.apache.hugegraph.computer.core.graph.value.Value;
+import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
+import org.apache.hugegraph.computer.core.worker.Computation;
+import org.apache.hugegraph.computer.core.worker.ComputationContext;
+import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
+public class SourceTargetShortestPath implements 
Computation<ShortestPathMessage> {
+
+    private static final Logger LOG = 
Log.logger(SourceTargetShortestPath.class);
+
+    public static final String OPTION_SOURCE_ID = 
"source_target_shortest_path.source_id";
+    public static final String OPTION_TARGET_ID = 
"source_target_shortest_path.target_id";
+    public static final String OPTION_WEIGHT_PROPERTY =
+            "source_target_shortest_path.weight_property";
+    public static final String OPTION_DEFAULT_WEIGHT =
+            "source_target_shortest_path.default_weight";
+
+    /**
+     * source vertex id
+     */
+    private String sourceId;
+
+    /**
+     * target vertex id
+     */
+    private String targetId;
+
+    /**
+     * weight property.
+     * weight value must be a positive number.
+     */
+    private String weightProperty;
+
+    /**
+     * default weight.
+     * default 1
+     */
+    private Double defaultWeight;
+
+    @Override
+    public String category() {
+        return "path";
+    }
+
+    @Override
+    public String name() {
+        return "source_target_shortest_path";
+    }
+
+    @Override
+    public void init(Config config) {
+        this.sourceId = config.getString(OPTION_SOURCE_ID, "");
+        if (StringUtils.isBlank(this.sourceId)) {
+            throw new ComputerException("The param %s must not be blank, ", 
OPTION_SOURCE_ID);
+        }
+
+        this.targetId = config.getString(OPTION_TARGET_ID, "");
+        if (StringUtils.isBlank(this.targetId)) {
+            throw new ComputerException("The param %s must not be blank, ", 
OPTION_TARGET_ID);
+        }
+
+        this.weightProperty = config.getString(OPTION_WEIGHT_PROPERTY, "");
+
+        this.defaultWeight = config.getDouble(OPTION_DEFAULT_WEIGHT, 1);
+        if (this.defaultWeight <= 0) {
+            throw new ComputerException("The param %s must be greater than 0, 
" +
+                                        "actual got '%s'",
+                                        OPTION_DEFAULT_WEIGHT, 
this.defaultWeight);
+        }
+    }
+
+    @Override
+    public void compute0(ComputationContext context, Vertex vertex) {
+        ShortestPathValue value = new ShortestPathValue();
+        vertex.value(value);
+
+        // start from source vertex
+        if (!this.idEquals(vertex, this.sourceId)) {
+            vertex.inactivate();
+            return;
+        }
+
+        value.updatePath(vertex, 0); // source vertex
+
+        // source vertex == target vertex
+        if (this.sourceId.equals(this.targetId)) {
+            LOG.info("source vertex {} equals target vertex {}", 
this.sourceId, this.targetId);
+            vertex.inactivate();
+            return;
+        }
+
+        if (vertex.numEdges() <= 0) {
+            // isolated vertex
+            LOG.info("source vertex {} can not reach target vertex {}",

Review Comment:
   keep log.debug?



##########
computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/ListValue.java:
##########
@@ -188,7 +192,7 @@ public void write(RandomAccessOutput out) throws 
IOException {
     }
 
     protected void write(RandomAccessOutput out, boolean writeElemType)
-                         throws IOException {
+            throws IOException {

Review Comment:
   ditto



##########
computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/SourceTargetShortestPath.java:
##########
@@ -0,0 +1,197 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * 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
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hugegraph.computer.algorithm.path.shortest;
+
+import java.util.Iterator;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.hugegraph.computer.core.common.exception.ComputerException;
+import org.apache.hugegraph.computer.core.config.Config;
+import org.apache.hugegraph.computer.core.graph.edge.Edge;
+import org.apache.hugegraph.computer.core.graph.value.DoubleValue;
+import org.apache.hugegraph.computer.core.graph.value.Value;
+import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
+import org.apache.hugegraph.computer.core.worker.Computation;
+import org.apache.hugegraph.computer.core.worker.ComputationContext;
+import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
+public class SourceTargetShortestPath implements 
Computation<ShortestPathMessage> {
+
+    private static final Logger LOG = 
Log.logger(SourceTargetShortestPath.class);
+
+    public static final String OPTION_SOURCE_ID = 
"source_target_shortest_path.source_id";
+    public static final String OPTION_TARGET_ID = 
"source_target_shortest_path.target_id";
+    public static final String OPTION_WEIGHT_PROPERTY =
+            "source_target_shortest_path.weight_property";
+    public static final String OPTION_DEFAULT_WEIGHT =
+            "source_target_shortest_path.default_weight";
+
+    /**
+     * source vertex id
+     */
+    private String sourceId;
+
+    /**
+     * target vertex id
+     */
+    private String targetId;
+
+    /**
+     * weight property.
+     * weight value must be a positive number.
+     */
+    private String weightProperty;
+
+    /**
+     * default weight.
+     * default 1
+     */
+    private Double defaultWeight;
+
+    @Override
+    public String category() {
+        return "path";
+    }
+
+    @Override
+    public String name() {
+        return "source_target_shortest_path";
+    }
+
+    @Override
+    public void init(Config config) {
+        this.sourceId = config.getString(OPTION_SOURCE_ID, "");
+        if (StringUtils.isBlank(this.sourceId)) {
+            throw new ComputerException("The param %s must not be blank, ", 
OPTION_SOURCE_ID);
+        }
+
+        this.targetId = config.getString(OPTION_TARGET_ID, "");
+        if (StringUtils.isBlank(this.targetId)) {
+            throw new ComputerException("The param %s must not be blank, ", 
OPTION_TARGET_ID);

Review Comment:
   ditto



##########
computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/ShortestPathValue.java:
##########
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * 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
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hugegraph.computer.algorithm.path.shortest;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.hugegraph.computer.core.graph.value.DoubleValue;
+import org.apache.hugegraph.computer.core.graph.value.IdList;
+import org.apache.hugegraph.computer.core.graph.value.ListValue;
+import org.apache.hugegraph.computer.core.graph.value.Value;
+import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
+import org.apache.hugegraph.computer.core.io.RandomAccessInput;
+import org.apache.hugegraph.computer.core.io.RandomAccessOutput;
+
+public class ShortestPathValue implements Value.CustomizeValue<List<Object>> {
+
+    /**
+     * path
+     */
+    private final IdList path;
+
+    /**
+     * weight of path
+     */
+    private final ListValue<DoubleValue> pathWeight;
+
+    /**
+     * total weight.
+     * infinity(Double.MAX_VALUE) means unreachable.
+     */
+    private final DoubleValue totalWeight;
+
+    public ShortestPathValue() {
+        this.path = new IdList();
+        this.pathWeight = new ListValue<DoubleValue>();
+        this.totalWeight = new DoubleValue(Double.MAX_VALUE);
+    }
+
+    @Override
+    public void read(RandomAccessInput in) throws IOException {
+        this.path.read(in);
+        this.pathWeight.read(in);
+        this.totalWeight.read(in);
+    }
+
+    @Override
+    public void write(RandomAccessOutput out) throws IOException {
+        this.path.write(out);
+        this.pathWeight.write(out);
+        this.totalWeight.write(out);
+    }
+
+    @Override
+    public List<Object> value() {
+        return this.path.value();
+    }
+
+    public void updatePath(Vertex vertex, double weight) {
+        this.path.add(vertex.id());
+        this.pathWeight.add(new DoubleValue(weight));
+        this.totalWeight.value(this.getTotalWeight());
+    }
+
+    public void updatePath(IdList path, ListValue<DoubleValue> pathWeight, 
Vertex vertex) {
+        this.path.clear();
+        this.pathWeight.clear();
+
+        this.path.addAll(path.copy().values());
+        this.pathWeight.addAll(pathWeight.copy().values());
+
+        this.path.add(vertex.id());
+        this.totalWeight.value(this.getTotalWeight());
+    }
+
+    public IdList path() {
+        return this.path;
+    }
+
+    public ListValue<DoubleValue> pathWeight() {
+        return this.pathWeight;
+    }
+
+    public double totalWeight() {
+        return this.totalWeight.doubleValue();
+    }
+
+    private double getTotalWeight() {

Review Comment:
   prefer calcTotalWeight



##########
computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/ListValue.java:
##########
@@ -163,7 +167,7 @@ public void read(RandomAccessInput in) throws IOException {
     }
 
     protected void read(RandomAccessInput in, boolean readElemType)
-                        throws IOException {
+            throws IOException {

Review Comment:
   keep the origin style?



##########
computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/ShortestPathValue.java:
##########
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * 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
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hugegraph.computer.algorithm.path.shortest;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.hugegraph.computer.core.graph.value.DoubleValue;
+import org.apache.hugegraph.computer.core.graph.value.IdList;
+import org.apache.hugegraph.computer.core.graph.value.ListValue;
+import org.apache.hugegraph.computer.core.graph.value.Value;
+import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
+import org.apache.hugegraph.computer.core.io.RandomAccessInput;
+import org.apache.hugegraph.computer.core.io.RandomAccessOutput;
+
+public class ShortestPathValue implements Value.CustomizeValue<List<Object>> {
+
+    /**
+     * path
+     */
+    private final IdList path;
+
+    /**
+     * weight of path
+     */
+    private final ListValue<DoubleValue> pathWeight;
+
+    /**
+     * total weight.
+     * infinity(Double.MAX_VALUE) means unreachable.
+     */
+    private final DoubleValue totalWeight;
+
+    public ShortestPathValue() {
+        this.path = new IdList();
+        this.pathWeight = new ListValue<DoubleValue>();
+        this.totalWeight = new DoubleValue(Double.MAX_VALUE);
+    }
+
+    @Override
+    public void read(RandomAccessInput in) throws IOException {
+        this.path.read(in);
+        this.pathWeight.read(in);
+        this.totalWeight.read(in);
+    }
+
+    @Override
+    public void write(RandomAccessOutput out) throws IOException {
+        this.path.write(out);
+        this.pathWeight.write(out);
+        this.totalWeight.write(out);
+    }
+
+    @Override
+    public List<Object> value() {
+        return this.path.value();
+    }
+
+    public void updatePath(Vertex vertex, double weight) {

Review Comment:
   also rename to addToPath? or do clear first if we keep updatePath name



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to