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:

371 questions
0
votes
1 answer

Printing all elements of graph one by one in python

I tried to traverse a graph in this algorithm in python. What Changes should I make if I want to print all elements of graph one by one or traversing the whole graph. Any help will be very much appreciated. Thanks. grapth={'A':…
0
votes
1 answer

how many hops does it take?

Im searching for information on an experiment where it was determined how many hops it would take for a message to theoretically reach everyone on Earth (i.e. 8 billion). So if every reciever would forward the messae to X contacts, it would…
TeaOverflow
  • 2,468
  • 3
  • 28
  • 40
0
votes
1 answer

does creating order of adjacency list affect the searching performance?

I'm working on graphs and traversal techniques. However, i have a question about adjacency list. As you know in adjacency method you declare an array or a list for each vertex which keeps adjacent vertexes. So my question is "does adding order of…
0
votes
1 answer

Discover All Paths in Single Source, Multi-Terminal (possibly cyclic) Directed Graph

I have a graph G = (V,E), where V is a subset of {0, 1, 2, 3, …} E is a subset of VxV There are no unconnected components in G The graph may contain cycles There is a known node v in V, which is the source; i.e. there is no u in V such that…
inspectorG4dget
  • 110,290
  • 27
  • 149
  • 241
0
votes
1 answer

Detecting unusual path patterns in a gigantic directed graph

I have a gigantic directed graph (100M+ nodes) of nodes, with multiple path instance records between sets of nodes. the path taken between any two nodes may vary, but what I'd like to find are paths that share multiple intermediary nodes except for…
Loki
  • 6,205
  • 4
  • 24
  • 36
0
votes
1 answer

Node-level graph-style traversal visualisation?

I am looking for a JavaScript library which can do node-level traversal of a graph. The most similar thing I could find (to help explain what I want) is ThinkMap, which is used by visualthesaurus. Basically starting from a single circular node…
0
votes
2 answers

How to replace node ids with their respective properties?

I am using Neo4j for graph database, and using Java to extract the path from it. I have a path as follows: [(3)--[KNOWS,5]-->(4)--[KNOWS,6]-->(5)--[KNOWS,9]-->(6)--[KNOWS,10]-->(7)--[KNOWS,12]-->(9)] I want to replace the node ids in the path with…
0
votes
2 answers

Finding a path in a 2d grid and returning all matched nodes

Say I have an rows*columns grid, and each node on the grid has an integer (state) value. state[NUMBER_OF_ROWS][NUMBER_OF_COLUMNS] If the value of state[row][0] == state[row][NUMBER_OF_COLUMNS -1] I want to check if there is a "path" consisting of…
0
votes
1 answer

Displaying Depth-First Search Graph Traversal C++

I am working on traversing a graph which I have set up as a class, using vectors to store the vertices and edges. I am using a Depth-First Search on the graph to show paths as it is traversed, but I would like to somehow get my code to display the…
Norm
  • 31
  • 2
  • 7
0
votes
2 answers

What is the maximum number of nodes I can traverse in an undirected graph visiting each node exactly once?

So I have an un-directed un-weighted graph. It contains cycles. I would like to find the path which visits the most nodes with no repeat visits to any node. Since this is a graph traversal, you can start and end at any node you like. Background…
Chirayu Shishodiya
  • 544
  • 2
  • 7
  • 14
0
votes
1 answer

Traversal of directed acyclic weighted graph with constraints

I have a directed acyclic weighted graph which I want to traverse. The constraints for a valid solution route are: The sum of the weights of all edges traversed in the route must be the highest possible in the graph, taking in mind the second…
0
votes
1 answer

Lowest cost path of a graph

I am working on a problem which drills down to this: There is a connected undirected graph. I need to visit all the nodes without visiting a node more than once. I can start and end at any arbitrary node. How can I go about this? Shall I apply…
bdhar
  • 21,619
  • 17
  • 70
  • 86
-1
votes
2 answers

Calculate the lowest cost of running several resource collectors on an undirected acyclic graph

We have an undirected acyclic graph where there is only a single path between two connected nodes that may look something like this. Simple guide to the image: Black numbers: Node id's (note that each node contains a resource collector) Resource…
-1
votes
2 answers

Algorithm to traverse edges of a hex grid between two points

Background Looking to trace a path between two points on a hexagonal grid while following the nearest edge. Problem Determining the algorithm to constrain the all iterations after the first one to the edge. Code Given: vac -- The X coordinate of…
Dave Jarvis
  • 30,436
  • 41
  • 178
  • 315
-1
votes
1 answer

How does this Dijkstra code return minimum value (and not maximum)?

I am solving this question on LeetCode.com called Path With Minimum Effort: You are given heights, a 2D array of size rows x columns, where heights[row][col] represents the height of cell (row, col). Aim is to go from top left to bottom right. You…
Someone
  • 611
  • 4
  • 13
1 2 3
24
25