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
20
votes
2 answers

Completeness of depth-first search

I quote from Artificial Intelligence: A Modern Approach: The properties of depth-first search depend strongly on whether the graph-search or tree-search version is used. The graph-search version, which avoids repeated states and redundant paths, is…
15
votes
1 answer

Post-order Graph Traversal?

Given the directed graph below, how did we achieve the post-order traversal? DFS Visiting order in Pre-order traversal: 1 2 5 4 6 3 Visiting order in Post-order traversal: 4 6 5 2 1 3
33ted
  • 667
  • 1
  • 5
  • 14
12
votes
1 answer

Neo4j vs Apache Giraph in graph traversal

Apache Giraph vs Neo4j : Are the traversal algorithms across nodes totally different in theses two graph processing systems ? If we were to traverse say a social graph using Giraph and Neo4j on data stored in single machine (not distributed) , which…
Ranjith
  • 477
  • 6
  • 17
11
votes
4 answers

Good graph traversal algorithm

Abstract problem : I have a graph of about 250,000 nodes and the average connectivity is around 10. Finding a node's connections is a long process (10 seconds lets say). Saving a node to the database also takes about 10 seconds. I can check if a…
Paul Tarjan
  • 44,540
  • 54
  • 163
  • 207
10
votes
3 answers

What algorithm do I use to calculate voltage across a combination circuit?

I'm trying to programmatically calculate voltage changes over a very large circuit. *This question may seem geared toward electronics, but it's more about applying an algorithm over a set of data. To keep things simple, here is a complete…
Trevor Hickey
  • 31,728
  • 22
  • 131
  • 236
9
votes
8 answers

How to implement a DFS with immutable data types

I'm trying to figure out a neat way of traversing a graph Scala-style, preferably with vals and immutable data types. Given the following graph, val graph = Map(0 -> Set(1), 1 -> Set(2), 2 -> Set(0, 3, 4), …
aioobe
  • 383,660
  • 99
  • 774
  • 796
9
votes
2 answers

Get Predecessors for BasicBlock in LLVM

What is the easiest way to get the predecessors of a BasicBlock in the LLVM framework? I have taken a look at DepthFirstIterator and idf_iterator, but I actually need to do a breadth-first search on the control flow graph. I feel like…
adu
  • 930
  • 8
  • 13
9
votes
3 answers

How can I order a list of connections

I currently have a list of connections stored in a list where each connection is a directed link that connects two points and no point ever links to more than one point or is linked to by more than one point. For example: connections = [ (3, 7), (6,…
Jonathon Vandezande
  • 2,258
  • 2
  • 20
  • 29
8
votes
1 answer

JavaScript Graph Traversal Libraries

I'd like a recommendation on a good javascript library for operating on graphs/networks. I'm not interested in visualization, just things like finding the shortest path and spanning trees. I've looked at crow, it seems pretty good, but is object…
SooDesuNe
  • 9,472
  • 9
  • 52
  • 88
7
votes
1 answer

Representing and performing IOs on graphs and subgraphs

I have a problem in which I need to perform CRUD operations on cyclic graphs. Now I know that there are a bunch of graph databases out there, but I have a specific set of use cases which are not supported in those databases (or at least I'm not…
Amith Koujalgi
  • 9,628
  • 2
  • 16
  • 22
7
votes
0 answers

Retrieving all edges of specific type starting from given node

I have a problem with graph traversal. My use case is not solvable using typical graph traversal algorithms (DFS, BFS). I want traverse nodes, starting from specific Node (N), where edge is of type ET. I want to retrieve all nodes with their &path…
goral
  • 1,185
  • 10
  • 16
7
votes
1 answer

Neo4j which Traversal should one use?

I'm currently trying Neo4J Koan Tutorial. I'm getting really confused at Koan06 where Traversal are introduced. Method Node.traversal is deprecated in favour for Traversal.traverse. As I tried it, I saw, that the whole Traversal class is deprecated,…
Rafael T
  • 14,504
  • 14
  • 72
  • 137
6
votes
3 answers

How can I programmatically create/detect keyboard runs in passwords?

I'm looking for a method to create a list of or detect keyboard runs in a password. I can bound my problem with password criteria such as length and number of special characters required. An example simple key run could be "6yhn^YHN" or…
Evan
  • 650
  • 1
  • 8
  • 19
6
votes
2 answers

Finding maximum weighted edge in a networkx graph in python

I want to find 'n' maximum weighted edges in a networkx graph. How can it be achieved. I have constructed a graph as follows : g_test = nx.from_pandas_edgelist(new_df, 'number', 'contactNumber', edge_attr='callDuration') Now, I want to find top 'n'…
Anand Nautiyal
  • 205
  • 1
  • 4
  • 11
6
votes
1 answer

Gremlin graph traversal that uses previous edge property value to filter later edges

In a graph traversal I only want to consider edges that have a property that is equal to the property of one of the edges visited in a previous step in the traversal. I found…
Chris Reeves
  • 61
  • 1
  • 3
1
2 3
21 22