Questions tagged [graph-traversal]

Graph traversal is the problem of visiting all the nodes in a graph in a particular manner, updating and/or checking their values along the way.

Two famous graph traversal algorithms are:

See also:

324 questions
-1
votes
1 answer

Python Boolean Shortcut Clarification

So I was watching a solution video for a matrix problem, and in the problem we had to define the first row, last row, first column, and last column as a border. In the video this is how they handled that logic: for row in range(len(matrix)): …
-1
votes
3 answers

How to resolve OutOfMemoryError: Java heap space when traversing to find all possible paths with huge graph?

I am implementing a graph traversal to look for all possible paths, and it works fine with a small sample graph. But when I bring it to a larger graph (having 1000 vertex), the program crashes with OutOfMemoryError: Java heap space. The error…
-1
votes
1 answer

How to find the shortest path in a multi-route graph

Consider a graph with V vertices and n routes (cars). Each path (car) starts from one vertex and traverses the V vertices just one time (there is not any loop in each route). In each iteration (i.e., time), just one route (car) can be in each of…
-1
votes
1 answer

Find the shortest path that traverses through a required set of nodes and returns to the starting point

Suppose I have a set of edges in the form (where each tupe (i,j) is a directed edge from node i to node j): E=[(1, 6), (1, 7), (2, 3), (2, 6), (3, 2), (3, 8), (4, 5), (4, 7), (5, 4), (5, 9), (6, 1), (6, 7), (6, 2), (7, 1), (7, 6), (7, 4), (8, 9),…
Stoner
  • 706
  • 1
  • 8
  • 22
-1
votes
1 answer

traversing a graph in DFS order using stack

I'm trying to traverse a graph, iteratively, in dfs order. Below is the code I had. When I tested this, the output is NOT the same as the output of a recursive dfs (also included below). Can someone help debugging this? public static void…
One Two Three
  • 18,931
  • 22
  • 63
  • 100
-1
votes
2 answers

DFS to find all possible paths - Where am I going wrong?

I need to implement DFS to find all possible paths from a vertex, say "item" So far I have the following and I cannot understand where I am going wrong. void dfs() { int i; for(i=1;i<=nodecount;i++) { visited[i]=0; } …
user24603
  • 1
  • 3
-2
votes
1 answer

CosmosDB Gremlin API alternative for storing and processing Graph data

I currently use CosmosDB Gremlin API to store nodes and edges of an organization chart. To keep the data and occasional traversal, it is costing me minimum of $20 every month. Is there an alternative to CosmosDB Gremlin API which is cheaper and can…
-3
votes
1 answer

Getting neighbours in given distance BFS algorithm

I have to write a function that will return a set that contains neighbours of a source vertex in given distance. For example for exemplary graph: {0: [1, 3], 1: [2], 2: [], 3: [4], 4: [1, 5], 5:…
The Robcio
  • 13
  • 3
-4
votes
2 answers

how new traverse api works

nowadaya i m learning new traverse api of neo4j and i followed the link below http://neo4j.com/docs/stable/tutorial-traversal-java-api.html so now i know how to use uniqueness,evaluater etc. that is i know how to change beahviours of the api. but…
brtb
  • 1,772
  • 5
  • 28
  • 50
1 2 3
21
22