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

Finding maximum number of nodes in set of undirected graphs

I have a set of nodes (N=7) {a, b, c, d, e, f, g} These nodes form one or more distinct undirected graphs, I want to find the graph with the maximum number of nodes. However, I have a constraint that the complexity can not be more than (N*M) where…
3
votes
0 answers

Memoizing traversal over a cyclic graph

I have a directed graph that is cyclic in general, and I want to find relationships between nodes and sinks. Traversals over directed graphs seem to be well-suited for memoization with recursion, since the graph can be mapped to the results of the…
concat
  • 2,793
  • 11
  • 27
3
votes
2 answers

Moving from one set of points in 3d space to another set of points with the shortest possible accumulative distance

We have 2 lists(black and red), each one contains multiple points in 3d space. We have to move each black point to a red point, and do this in such a way that the total distance to make the moves is the least it can be. The lists can be of…
3
votes
3 answers

All pairs all paths on a graph

This is possibly a problem with possibly no optimal solution. Suppose I have a directed graph, have no clue whether it has any cycles or not(cycle detection will be one of the aspects of this problem). Given a set of vertices(possibly millions of…
sc_ray
  • 7,385
  • 9
  • 59
  • 94
3
votes
2 answers

Neo4j graph backtracking algorithm

I have a complex question about Neo4j and what Traversal can do. Imagine you have the following Neo4j graph My idea is to traverse the whole graph, and if I find a 'false' node, expand this status to his neighbours and so on, and finally in this…
jpadilladev
  • 1,286
  • 1
  • 14
  • 22
3
votes
1 answer

Gremlin- How to compute percentage of vertices with a certain property

I am trying to use a single gremlin query to determine the percentage of vertices that satisfy a certain predicate, but I'm having trouble storing and propagating the computed values. Say I want to compute the percentage of all vertices with label…
3
votes
0 answers

OrientDb graph TRAVERSE between two vertex with conditions

This is my graph schema (little part): BusStation is class which extends V (Vertex). Every BusStation element has stationId property with some value (1,2,3,4,5...). Bus is class which extends E (Edge). Every Bus element has three…
Juraj Ćutić
  • 196
  • 1
  • 10
3
votes
2 answers

Arangodb AQL recursive graph traversal

I have a graph with three collections which items can be connected by edges. ItemA is a parent of itemB which in turn is a parent of itemC. Elements only can be connected by edges in direction "_from : child, _to : parent" Currently I can get…
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
  • 21,419
  • 4
  • 68
  • 99
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,234
  • 18
  • 47
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
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
  • 22,411
  • 17
  • 53
  • 84
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
  • 7
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…
1 2
3
21 22