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
3
votes
1 answer

Fill all connected grid squares of the same type

Foreword: I am aware there is another question like this, however mine has very specific restrictions. I have done my best to make this question applicable to many, as it is a generic grid issue, but if it still does not belong here, then I am…
3
votes
1 answer

ArangoDB Graph-Traversal: Exclude Edges

I'm executing a query similar to: FOR v, e IN 1..10 ANY @start GRAPH @graph FILTER e.someCondition RETURN v What I expected to happen was that if e.someCondition was false, then the edge in question wouldn't be traversed (and transitively,…
thwd
  • 23,956
  • 8
  • 74
  • 108
3
votes
1 answer

Designing an Algorithm to find the length of a simple cycle in a d-regular graph

I understand the question in general but don't know how to design and analyze the algorithm in the question. I was thinking of applying some sort of graph search algorithm like depth-first / breadth-first search. UPDATE: This is what I have tried,…
Mutating Algorithm
  • 2,604
  • 2
  • 29
  • 66
3
votes
1 answer

Execute query lazily in Orient-DB

In current project we need to find cheapest paths in almost fully connected graph which can contain lots of edges per vertex pair. We developed a plugin containing functions for special traversal this graph to lower reoccurences of similar paths…
3
votes
1 answer

Select paths from traversal and filter on the destination vertex (OrientDB)

I am new to graph databases and OrientDB, so I appreciate your patience. I have the following SQL query to produce an expanded set of results for the shortest path between two vertices (I am using the GratefulDeadConcerts database): select…
Apollo
  • 945
  • 2
  • 9
  • 24
3
votes
2 answers

Returning a single document of vertices and edges from an AQL traversal

When I do a traversal in Arango I get an array of json structures that look like this: { "vertex" : { "_id" : "vertices/857831247835", "_key" : "857831247835", "_rev" : "857831247835", }, "path" : { "edges" : [ { …
mikewilliamson
  • 24,303
  • 17
  • 59
  • 90
3
votes
1 answer

How does GraphX internally traverse the Graph?

I want to know the internal traversal of Graph by GraphX. Is it vertex and edges based traversal or sequential traversal of RDDS? For example given a vertex of graph, i want to fetch only of its neighbors Not the neighbors of all the vertices ? How…
mas
  • 145
  • 8
3
votes
2 answers

Determining if graph is connected in prolog

I need to make a predicate isConnected/1 that takes a graph as an argument and determines if there is an undirected path between the pairs. Suppose I have a list of edges (where G is a graph): isEdge(G,1,2). isEdge(G,2,3). isEdge(G,4,5). So because…
3
votes
0 answers

neo4j parallel traversal api

The answer to this post (find distinct paths in neo4j database) recommends using the Traversal API to identify distinct paths in a graph (please see original question) instead of a Cypher query. For a graph containing 10,000 nodes the API returned…
user3952770
3
votes
1 answer

Random Walk on Bipartite Graph with Gremlin

I would like to rank items according to a given users preference (items liked by the user) based on a random walk on a directed bipartite graph using gremlin in groovy. The graph has the following basic structure: [User1] ---'likes'---> [ItemA]…
Faber
  • 1,504
  • 2
  • 13
  • 21
3
votes
0 answers

Is there a language (or language spec) to extract elements from a DAG

I have a problem where I have a huge number of DAGs and I have to visit each DAG, and extract many different sets of items. This may sound a bit abstract so let me use an example. Xpath or JSONPath are languages that specify how i can extract an…
3
votes
1 answer

More efficient way of running a random traversal of a directed graph with Networkx

I am trying to simulate a random traversal through a directed networkx graph. The pseudo code is as follows Create graph G with nodes holding the value true or false. // true -> visited, false -> not visited pick random node N from G save…
Linus Liang
  • 287
  • 2
  • 15
3
votes
3 answers

Finding the (guaranteed unique) path between two nodes in a tree

I have a (likely) simple graph traversal question. I'm a graph newbie using networkx as my graph data structures. My graphs always look like this: 0 1 8 2 3 9 10 4 5 6 7 11 12 13 14 I need…
paradiso
  • 379
  • 3
  • 14
3
votes
1 answer

algorithm to get cycle in graph?

If you have a graph represented as an adjacency list, how can you detect any odd length-ed cycles in python? Suppose you have a graph given as input: A = { 1: [2, 4], 2: [1, 5], 3: [4, 5], 4: [1, 3, 5], 5: [2, 3, 4], 6:…
omega
  • 40,311
  • 81
  • 251
  • 474
3
votes
2 answers

Fastest way traversing a graph with several unknown weight edges

Given a undirected and positive weighted graph G, some edges of G have unknown weight. For instance, where edge(B, C) has unknown weight. Traversing from A to B costs you 7. We are allowed to derive the unknown weight e = weight(B,C) by traversing…
ylc
  • 438
  • 5
  • 14