dosubot[bot] commented on issue #2691:
URL: 
https://github.com/apache/incubator-hugegraph/issues/2691#issuecomment-2461718122

   <!-- Greeting -->
   Hey @dbwuc, I'm here to help with any bugs, questions, or contributions you 
have regarding the K-neighbor API. Let's work together to resolve this issue 
while we wait for a human maintainer.
   
   <!-- Answer -->
   To ensure that each vertex returns its corresponding upstream vertex when 
using the K-neighbor API (POST, advanced version), you need to set the 
`withPath` parameter to `true` in your request. This configuration will allow 
the API to return paths, which include the upstream vertices for each vertex. 
Here's an example of how you might structure your request:
   
   ```json
   {
     "source": "your-source-vertex-id",
     "steps": {
       "direction": "BOTH",
       "edge_steps": [
         {"label": "knows", "properties": {"weight": "P.gt(0.1)"}},
         {"label": "created", "properties": {"weight": "P.gt(0.1)"}}
       ],
       "vertex_steps": [],
       "max_degree": 10000,
       "skip_degree": 100000
     },
     "max_depth": 3,
     "limit": 10000,
     "with_vertex": true,
     "with_path": true
   }
   ```
   
   By setting `withPath` to `true`, the API will return paths that include the 
upstream vertices, ensuring that each vertex returns its corresponding upstream 
vertex 
<sup>[[1]](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/KneighborAPI.java)</sup><sup>[[2]](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/KneighborApiTest.java)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
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