skip to Main Content

I have been trying to implement Tarjan’s algorithm to measure strongly connected components in a graph Can anyone provide guidance on how to implement Tarjan’s algorithm in Apache-Age to measure connectivity between nodes since I could not find anything yet?
Here is the code in python

index = 0
stack = []
ids = {}
lowlink = {}
onStack = {}
result = []

def tarjan(current_node):
    global index
    ids[current_node] = index
    lowlink[current_node] = index
    index += 1
    stack.append(current_node)
    onStack[current_node] = True

    for neighbor in current_node.get_neighbors():
        if neighbor not in ids:
            tarjan(neighbor)
            lowlink[current_node] = min(lowlink[current_node], lowlink[neighbor])
        elif onStack[neighbor]:
            lowlink[current_node] = min(lowlink[current_node], ids[neighbor])

    if ids[current_node] == lowlink[current_node]:
        connected_component = []
        while True:
            neighbor = stack.pop()
            onStack[neighbor] = False
            connected_component.append(neighbor)
            if neighbor == current_node:
                break
        result.append(connected_component)

how to I implement this code using apache age to measure connectivity?

2

Answers


  1. Unfortunately, Apache AGE doesn’t support implementing algorithms like Tarjan’s algorithm directly within the graph database using openCypher. However, you can use Apache AGE to fetch the graph data and then apply the algorithm using Python or another programming language.

    To implement Tarjan’s algorithm with Apache AGE, you’ll need to first fetch the graph data from Apache AGE using the appropriate openCypher query and then apply the Tarjan’s algorithm on the fetched data.

    Login or Signup to reply.
  2. You can follow this article Which shows that you can implement this algorithm with the help of Apache TinkerPop API.
    You may know that Apache-Age is a new graph database which is built on top of Apache Cassandra and designed to be compatible with Apache TinkerPop. So that, You can use Apache-Age with the TinkerPop API, just like you would with any other TinkerPop-compatible graph database.

    You may know that Apache TinkerPop is a graph computing framework that provides a graph traversal API for accessing and manipulating graph data stored in a variety of graph databases.

    For that purpose you would need to set up an Apache-Age cluster and connect to it using a Driver Remote Connection object, just like you would with any other TinkerPop-enabled graph database.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search