Questions tagged [traversal]
Traversal is the action of iterating over all the elements in a sequence of elements.
2,006
questions
0
votes
1
answer
39
views
Node Traversal to Java String Set?
So I am having trouble how I would convert a nodeTraversal into Hashset.
GraphTraversal<vertex, vertex>nodeTraversal = this.central.V().has(nodeid).in("node").values(nodeId);
So far I ...
0
votes
1
answer
27
views
PHP - Object or Array for Variable Number of Values per Item?
I need to track a fixed number of items with a variable number of value pairs for each in PHP (7.x or 8.x). Meaning item 1 may have 1 value pair (e.g. "red",32) whereas another item may have ...
0
votes
1
answer
32
views
Traversal with .closest() fails [duplicate]
I'm puzzled why thew second traversal with .closest seems to fail in this simple example:
function testClosest(element) {
let firstParentDiv = element.closest('div');
...
-1
votes
1
answer
111
views
Constructing a Binary Tree from Inorder and Preorder Traversals
I have the following sequences:
Inorder: {4, 2, 5, 1, 6, 3}
Preorder: {1, 2, 4, 5, 3, 6}
I'd like to understand how to construct a binary tree from these sequences and why it's possible with this ...
0
votes
0
answers
38
views
Finding shortest and longest distance using depth first search in a weighted grid by traversing all four directions
I am trying to do a Dfs on a weighted grid to find both the shortest distance and longest distance to reach from the index 0,0 to the end cell in the bottom right corner.
I know this can be achieved ...
0
votes
1
answer
9
views
Improve efficiency of data traversal in PieCloudDB
As the volume of PieCloudDB Database grows, and if there are an increasing number of tables, both wide and small, along with numerous chunk objects stored in S3, how can we improve the efficiency of ...
-1
votes
1
answer
81
views
How to calculate the sum of all connected nodes faster?
There are N bidirectionally connected nodes (Pn), each node represents a value, and there is an attenuation value (0 - 1) between the nodes. Now I want to calculate the maximum value from each node to ...
0
votes
1
answer
68
views
How do I use a for loop with an if statement in a kdb/Q table?
I am new to kdb/Q. I've used Python in the past, and am trying to find out how I can traverse a kdb table using the equivalent of a for loop. I have a table called SymbolList that looks like this:
...
0
votes
0
answers
17
views
This a code of DFS traversal two piece of code are same but one is giving segmentation fault and another is running well why?
void dfs(int row,int col,vector<vector<int>>& vis,vector<vector<char>>& mat,int delrow[],int delcol[]){
// giving segmentation fault
// vis[row][col] = 1;
...
0
votes
1
answer
234
views
How to visit all points in a 2D grid?
I am trying to have 2 points visit all points in a 3 x 3 grid. The method of visiting the points is:
I have points P1 and P2, starting from (0, 0).
P1 moves from (0, 0) to (0, 1), (1, 0) until (3, 3)....
0
votes
1
answer
45
views
modification during array traversal
int * decrementArrayElements(int numbers[], int size){
for (int &x: numbers)
{
x = x-1;
}
return numbers ;
}
well as mentioned am trying to dec val of each array ele by 1 ...
0
votes
2
answers
61
views
Understanding recursion in binary tree traversal
I'm trying to understand how this code works:
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self....
0
votes
1
answer
80
views
Reconstruct binary tree from array [duplicate]
Given an array representing the level-order traversal of a binary tree (not BST), reconstruct the tree.
Example:
Input: [6,x,8,4,x]
output: 6
\
8
/
4
x in the ...
0
votes
1
answer
48
views
pre_order_traversal vs post_order_traversal
I have the two functions below
"PRE_ORDER_TRAVERSAL"
def pre_order_traversal(root: Node):
if root is not None:
print(root.val)
pre_order_traversal(root.left)
...
-3
votes
2
answers
65
views
I am traversing the linked list in Python and when I am passing arguments, it's giving me an error. How can I take objects to see the result?
Consider:
class Node:
def __init__(self,data):
self.data=data
self.ref=ref
class LinkedList:
def __init__(self):
self.head= None
def print_LL(self):
if self.head==...
1
vote
0
answers
79
views
Is this n-ary weighted tree implementation idiomatic rust? I find it too repetitive
Context and description of the encountered problem
Currently I'm learning the Rust Programming Language and last weekend I found myself implementing a generic n-Ary weighted tree data structure whose ...
0
votes
2
answers
43
views
How to traverse a list in postorder manner which was made in preorder?
In java I have a list where each element consist of a leftName and rightName. If the left or rightName is null it indicates that it has an another leaf/node (if both of them are null they have 2 ...
3
votes
2
answers
183
views
Using lenses to view a Map as key-value pairs?
The traverse lens (is it a lens?) allows looking at Map key value in a value-by-value basis. For example:
import Data.Map
import Control.Lens
simpleMap :: Map Int Char
simpleMap = fromList [(1, 'a'), ...
0
votes
0
answers
23
views
AQL - ArangoDB. Cycles. Recalculating paths after cycles. Add the last node from a cycle
Context
The graph is oriented, all connections have one specific type and traversal of the graph occurs in a certain direction of connections.
In the graph, there are possible cases:
cycles
loops (...
0
votes
0
answers
16
views
I hava json for filter. how can I traverse and generate json from It?
I have a json for filter .
"filter": {
"logic": "or",
"filters": [
{
"field": "substanceName",
...
0
votes
0
answers
39
views
React Native - Traverse through all elements
I need to examine all the elements within the following layout of React Native app:
const App: () => Node = () => {
return (
<Debugger>
<SafeAreaView style={styles.body}>
...
0
votes
0
answers
50
views
travel salesman problem with capacity constraint
I'm trying to solve a simple TSP problem using CPLEX with an additional constraint.
At the beginning, my .mod look like this::
// Stops
int n = 4;
// Indexes for the stops
range nodes = 1 .. n;
// ...
0
votes
0
answers
48
views
janusGraphManagement.getOrCreatePropertyKey() Causing Could not read messages for timestamp
Problem
Why is an empty JanusGraph not able to read messages for timestamp?
What message is JanusGraph referring for janusGraphManagement.getOrCreatePropertyKey()?
How is this warning fixed and why ...
1
vote
1
answer
27
views
Finding all possible connections between two disjoint hierarchical trees
I am looking for the best data structure to store two hierarchical trees, where my aim is to find whether all the possible connections between these two trees are covered.
I will describe my problem ...
-1
votes
2
answers
75
views
How do I do a pre-order file traversal in bash?
I was looking for a simple bash one-liner for traversing a file system and printing all the files in pre-order arrangement. It seems as though find is not capable of doing this. I could try to sort ...
3
votes
2
answers
122
views
Error while mapping the sanity schema in my react webiste
I am trying to map a sanity schema, but I am unable to do so, please help me if any knows:
This is the sanity schema categories.js which I want to traverse, here I want to traverse the features array ...
0
votes
2
answers
168
views
How can I get a forward iterator to the last element?
I'm looking for a convenient option to get the last element from a container/range which only supports forward traversal, which essentially means I cannot do stuff like std::prev(std::end()). For now ...
0
votes
1
answer
23
views
I do not know the solution of this, a program of an AVLTREEHow can i solve the error error: cannot find symbol node = rotateWithRightChild(node);
This is the code of my program, it is an AVL Tree but it shows error error: cannot find symbol
This error message is indicating that the compiler cannot find the symbol rotateWithRightChild. This ...
0
votes
0
answers
20
views
Return e(edge) in traversal in ArangoDB
FOR v, e, p IN 1..2 INBOUND 'company_nodes_2018_2023/6066a658fee3c9fc8c1c84b7'
GRAPH supply_chain_graph
OPTIONS { uniqueVertices: 'path', maxIterations: 100000}
FILTER p.edges[0].hs_codes == 820559 ...
0
votes
0
answers
18
views
What would be the value of "left" in left = dfs(root.left)?
I'm currently working on a leetcode question "Flatten Binary Tree to LinkedList", and I didnt quite understand how leftTail = dfs(root.left) would flatten the left side of the tree.
link : ...
0
votes
0
answers
29
views
Having issues with traversals in an App-lab School Project. How do I get an input value to pull up values related to it?
So, I don't exactly know how to put it, but I'm working on the "Create Task" in App Lab on Code.org for a CSP project. The app is based around building molecules, and the input I'm talking ...
0
votes
0
answers
41
views
How to stop talkback navigation from traversing to outside element
Currently running into an issue where I've tried almost everything. I have a situation where I have a HeaderManager and HeaderHolder. In this particular header it consists of 2 LinearLayouts that acts ...
0
votes
0
answers
20
views
Traverse and find JSON Object By its name in Java
I have this JSON Object and I have been given this "wizard.SCHEMA_PARAM.SELECTION" dataProviderPath. this path contains each object's name and is in the parent-child relationship from the ...
0
votes
0
answers
24
views
Arangodb traverse a graph and query a previously updated document
I'm trying to calculate the total cost of a project by traversing through all its parts and summing them up by price and quantity.
The problem that I am having is the subquery is querying a vertex ...
0
votes
1
answer
136
views
find - Traverse all subdirectories from a starting point and check if specific subdirectory is contained in them
I was looking for a way to traverse the full path (all the subdirectories) from a given starting point (current directory in my example) and then check if the full path has a directory called "...
1
vote
1
answer
43
views
three js only some child shadows show
i currently have a scene with a GLB model, the model has child meshes but only some are casting shadows
you can see the word peripherals, the big island and the small island and the whale all cast ...
-2
votes
3
answers
221
views
Print matrix elements in diamond pattern using python
I need to traverse and print the matrix elements in a diamond pattern.
matrix = [[ 1, 2, 3, 4, 5],
[ 6, 7, 8, 9, 10],
[11, 12, 13, 14, 15],
[16, 17, 18, 19, 20],...
0
votes
1
answer
16
views
Why does it say I don't declare a varibale but actually I declared?
It's about Bitree.
It should output Postorder traversal after input Preorder traversal and Inorder traversal.
#include <stdio.h>
#include <string.h>
void traverBitree(char *first, char *...
0
votes
2
answers
61
views
How to call class from another class in python
I am pretty new and trying to work on an algorithm challenge (Binary Inorder Traversal). I am trying to go through a tree (iterative) but for some reason there is a disconnect when I call the function....
1
vote
2
answers
168
views
How to iterate through a circular array multiple times in python?
I want to circle through the array multiple times. When I reach the last index, the next index should be the first one.
For example, I have an array of 6 elements
array1 = [1,2,3,4,5,6]
and I have K =...
0
votes
2
answers
109
views
Cannot resolve method 'findNode' in 'Transaction'
I'm trying to understand Traversal API for Neo4j, but I have a problem with dependencies:
Cannot resolve method 'findNode' in 'Transaction'
also:
Cannot resolve method 'traversalDescription' in '...
0
votes
0
answers
37
views
Graph traversal adding too many items
I'm trying to do graph traversal for partitions where the values decrease and are at least two items in length. For example the partitions where n = 6 would be [3, 2, 1], [4, 2], [5, 1]. Something in ...
0
votes
1
answer
95
views
Why do we need DFS or BFS algorithms for graphs?
I used list implementation to create a graph. However, I don't get why we need to perform a breath-first with queue or depth-first with stack to reach all nodes because when we use this implementation,...
0
votes
1
answer
49
views
Discovering plus patterns in 2-dimensional array
I'm not looking for a solution. All I'm looking for is guidance. I am stuck on this problem and I have no idea what to study or learn in order to solve it. I tried many solutions but they all have ...
0
votes
0
answers
98
views
Graph traversal with a minimum number of "steps" (steps based on edge parameters)
There is a bidirectional graph. The graph edges have parameters (let it be a color). A step is a transition from one vertex to another. If at a certain moment the already visited vertices have ...
0
votes
0
answers
30
views
Translating an AST with clang RecursiveASTVisitor
The RecursiveASTVisitor class implements a stateless visitor for the AST of some source. I would like to process the AST into some JSON that describes the parent classes, methods and their arguments, ...
2
votes
1
answer
438
views
Retrieving object metadata while traversing S3 using Minio client's list_objects method
I am using the list_objects method of the python minio client and trying to retrieve the metadata for each object while traversing folders in S3. I attempted to do this by setting the ...
0
votes
1
answer
21
views
Oracle: query or procedure to traverse table
I have a table made in this way:
COLUMN_A
COLUMN_B
COLUMN_C
35108337
B0110555
35108337
E15627104
35108338
E15627104
800384
L0309599
18181
800384
E1359191
800385
B0110556
800385
E1359191
...
0
votes
0
answers
31
views
How to format source in code playground to show proper line numbers?
I'm working on Code playground and I have loops protection inspired by CodePen.
When I have code like this:
function draw() {
for (let i = 0; i < 1; ++i) {
console.log(x());
}
}
it'...
0
votes
1
answer
39
views
File indexing issue in python
for this function, i need to traverse through a file and count each line based on certain signifiers. If that certain signifier is present in the line, i need to add the string as a key to the ...