Shortest Path between two vertices

Matt Huang 0 Reputation points
2023-08-10T14:46:20.7766667+00:00

Is there a possible query that is able to find the shortest path between two vertices in a graph that is connected with edges that all have a weight property (int). It needs to be able to take into account the weights of each edge, and not just find the shortest path, because the longest path could be the shortest its total sum of weighted edges is the smallest. Or is there a built in feature in Gremlin for this?

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,845 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ShaktiSingh-MSFT 16,276 Reputation points
    2023-08-11T05:40:12.7566667+00:00

    Hi
    Matt Huang
    •,

    Welcome to Microsoft Q&A forum and thanks for using Azure Services.

    As I understand, you want to find the Shortest Path between two vertices.

    Could you please take a look at the similar questions over stackoverflow which might help:

    https://stackoverflow.com/questions/34040500/best-way-to-find-a-shortest-path-between-two-nodes-in-tinkerpop-3-1

    https://stackoverflow.com/questions/53297082/shortest-path-taking-into-consideration-the-weight-on-tinkergraph-in-java

    Let us know if this helps or else share more details so that we can assist you.

    Thanks for your support.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.