385 questions
Advice
0
votes
2
replies
33
views
DFS VS DSFVisit
I'm in college learning about DFS and BFS. I knew about this before, although what's throwing me in a loop is DFSVisit.
I just want to know what's the difference between DFS and DFSVisit. Is DFS just ...
3
votes
1
answer
155
views
Efficient Algorithems to find position of vector in 2D array
I have an interesting problem but cannot find the relevant literature, so need algorithem suggestions or just the correct way to phrase the problem so I can find the literature.
I'm given a vector of ...
0
votes
0
answers
57
views
Indirect and direct link in a tree
Suppose 3 sets of nodes, each corresponding to a distinct set in an undirected graph:
Set-A = {1, 2, 3, 4, 5}
Set-B = {6, 7, 8, 9, 10}
Set-C = {11, 12, 13, 14, 15}
The graph is defined by ...
2
votes
1
answer
138
views
Graph traversal algorithm using shapely geometry points
I am trying to create a path planning algorithm for a robotic mower to cut all the grass in a defined area while avoiding obstacles or restricted areas. I am using the Python Shapely library to define ...
2
votes
1
answer
254
views
Why are back edges and forward edges said to be impossible in BFS for an undirected graph?
Is it true that there are no back edges and no forward edges in a BFS of an undirected graph?
I feel this is incorrect. Here is my counterexample (graph is represent using adjacency list):
0 : 1
...
0
votes
1
answer
71
views
gremlin apache: how to use the weights of edges to define the order in which an edge is followed?
I'm trying to traverse a graph (directed) where the edges have weights.
How do I use the weights to define the order in which an edge is followed: the lower the weight (module of the weight to be ...
-1
votes
1
answer
50
views
Which algorithm can I use to number the graph as follows
Each node in the above graph has been numbered.
I am trying to find the graph traversal algorithm that can be used to number the graph in this order. Appreciate if anyone can suggest an algorithm that ...
0
votes
0
answers
130
views
Given an undirected weighted graph, how to find the minimum cost so that I can start from any node and traverse all other nodes that is in the graph?
Title: Finding the Maximum of Minimum Costs in a Modified Kruskal's Algorithm
Question:
I'm working on a graph problem where I need to find the maximum of the minimum costs starting from a specific ...
1
vote
1
answer
74
views
leetCode590. N-ary Tree Postorder Traversal
I am trying to solve LeetCode problem 590. N-ary Tree Postorder:
Given the root of an n-ary tree, return the postorder traversal of its nodes' values.
I made code considering each condition.
I ...
0
votes
1
answer
88
views
Python IDDFS missing potential results
I'm using bfs and iddfs to find the optimal solution of the 8 tile puzzle, however, my IDDFS is missing solutions and i'm not sure why. ive checked and it seems that every node visits all it's sons, ...
0
votes
0
answers
82
views
How to detect any cycles in lisp list
I am thinking about the problem of detecting cycles in lisp lists (based on cons cells). Traditional cycle detection algorithms like Floyd's (Tortoise and hare) or Brent's algorithm all assume that ...
0
votes
1
answer
21
views
Retrieving distinct data without using the DISTINCT keyword for better query performance
I have a very large graph. My objective is the following:
Return pathways related to the target 'GIPR' and also related to compounds. Where the compounds are related to the disease 'Leukemia'
My ...
1
vote
0
answers
210
views
ArcadeDB | `All hosts are considered unavailable due to previous exceptions. Check the error log to find the actual reason.`
What are the details of your problem?
Why is Tinkerpop-Gremlin AnonymousTraversalSource finding ArcadeDB unavailable?
I looked at log/arcadedb.log.x files but they're empty.
And the Log4j2 logs also ...
1
vote
1
answer
158
views
Why is it slow when OpenMP runs in parallel independent instances of shortest path algorithm that uses BFS (BFS in itself is not parallelized)?
I am trying to run multiple instances of a shortest path algorithm, for independent pairs of nodes in a graph.
The algorithm internally uses the bfs method, which is "sandboxed" (self-...
0
votes
2
answers
436
views
Caching BFS traversal in an undirected and unweighted graph
I have an undirected and unweighted graph with about a million nodes - visualized in a matrix format.
Representation of a sample graph:
The red cells are blocked.
My problem is to find the shortest ...
3
votes
1
answer
217
views
Code to find the shortest path in Breadth First Search
#Breadth First Search
graph = {
'S' : ['A','B'],
'A' : ['B','C','D'],
'B' : ['C'],
'C' : ['D'],
'D' : []
}
visited = []
queue = []
goal = 'D'
def bfs(visited, graph, node):
...
1
vote
0
answers
390
views
How to count the number of subgraphs in a collection?
I have been able to find the number of subgraphs in a collection using the below query, after much trial and error and documentation consultation. It seems to work ok. It's crafted to work in the ...
0
votes
0
answers
93
views
Do we always have to run Bellman-Ford N-1 times?
This is more a theoretical question because I can see this question being asked in an exam.
Assuming we have a directed graph G(V,E) with |V| = 10 and we want to know the shortest path from S to all ...
0
votes
1
answer
486
views
Recursive DFS graph traversal in Scala
I've seen the following code to traverse a graph depth first, in Scala:
def dfs(node: Node, seen: Set[Node]) = {
visit(node)
node.neighbours.filterNot(seen).foreach(neighbour => dfs(node, ...
1
vote
1
answer
219
views
Acyclic undirected graph allocation problem
We have an allocation problem: each node is a fuel source, and every edge contains a number of evenly spaced out lamps (think of them as being 1 m apart from each other). Each fuel source can power ...
0
votes
0
answers
44
views
How can I avoid collecting multiple instances of vertices and edges?
I've created a query to return all "descendant" edges and vertices for a particular queried vertex.
The query works, but it duplicates edges and vertices with each iteration of the repeat ...
0
votes
1
answer
440
views
how to take tree roots in a DFS forest?
A DFS starting at some vertex v explores the graph by building up a
tree that contains all vertices that are reachable from v and all
edges that are used to reach these vertices. We call this tree a ...
-1
votes
2
answers
406
views
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 ...
1
vote
1
answer
367
views
Determine whether certain nodes on a graph are directly connected
How can I determine whether selected nodes on a graph are directly connected?
I think, I need to calculate paths for each selected node to all of the other selected nodes. Then, when I have the path, ...
0
votes
1
answer
483
views
Neo4j Cypher - How to query for multiple variables within a single traversal
I have a case of scenario that there are TOURIST who wants to travel and every country has VISA control and there is a path along countries so some of connections you are not allowed to visit that ...