Skip to content
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

[Feature] output custom write #302

Closed
diaohancai opened this issue Jan 26, 2024 · 1 comment · Fixed by #303
Closed

[Feature] output custom write #302

diaohancai opened this issue Jan 26, 2024 · 1 comment · Fixed by #303
Labels
feature New feature

Comments

@diaohancai
Copy link
Contributor

Feature Description (功能描述)

Currently, all vertices output computation results.
But some scenarios do not require all vertices to output computation results.
Such as Single Source Shortest Path algorithm, when targetId = "abc", then just output the computation result with the vertex id abc, no need to output results for other vertices.

@diaohancai diaohancai added the feature New feature label Jan 26, 2024
Copy link

dosubot bot commented Jan 26, 2024

🤖

你好 @diaohancai, 很高兴再次看到你的贡献。

Based on your feature request, you want to modify the output computation results so that only specific vertices (such as targetId = "abc") are outputted, instead of all vertices. This can be achieved by modifying the writeVertex(Vertex vertex) method in the GraphComputeOutput interface or the write() method in the ComputerOutput class.

Currently, the writeVertex(Vertex vertex) method writes all vertices to the output. You can add a condition to check if the vertex id is equal to targetId before writing the vertex to the output. Here's a simple example:

public void writeVertex(Vertex vertex) {
    if (vertex.id().equals(targetId)) {
        // Write the vertex to the output
    }
}

Similarly, in the write() method of the ComputerOutput class, you can add a condition to check if the vertex id is equal to targetId before writing the vertex to the output.

public void write(Vertex vertex) {
    if (vertex.id().equals(targetId)) {
        // Write the vertex to the output
    }
}

Please note that targetId should be a variable that you can set to specify which vertices to output. Also, you need to ensure that targetId is in the correct format that can be compared with the vertex id.

This is a simple solution and may need to be adjusted based on your specific requirements and the actual implementation of the GraphComputeOutput interface and ComputerOutput class.

For more information, you can refer to the following sources:

I hope this helps! If you have any further questions or need more clarification, feel free to ask.

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant