2,015 questions
0
votes
2
answers
93
views
python basics: can someone help me understand processing one file vs processing all files at a time?
This will output all csv files from the directory, but only show one of the csv dataframes.
OUTPUT_PATH = "./static/output/"
FILE_LIST = glob.glob("./static/*.json")
def all_data():...
0
votes
1
answer
61
views
Focus traversal on TextField not working as expected in Flutter
Below code generates UI as follows, here which ever container is selected it gets highlighted with border and its descendants are traversable on tapping tab, other container's children does not get ...
3
votes
3
answers
111
views
Iterative graph traversal: non-BFS and non-DFS ordering
Consider this traversal algorithm in pseudocode:
Traverse(G, v):
S is stack
stack.push(v)
label v as visited
while S is not empty:
v = S.pop()
for all w in G....
0
votes
0
answers
41
views
flutter webOS navigate with arrow key between widgets
I want to make webOS app with Flutter and use this app in TV, I have a List of items, consider 3 rows which are having 10 items each, and all scrollable, I want to move between them by keyboard and ...
1
vote
1
answer
248
views
TypeError: Cannot read properties of undefined (reading 'traverse') in VTK.js when trying to render an image in React
I'm working on a project using React and VTK.js, and I'm encountering an error when trying to render a medical image using vtkRenderWindow and vtkRenderer. The error I am getting is:
TypeError: Cannot ...
0
votes
1
answer
24
views
Select elements between two elements in HTML, at different levels
Alternative headline: traverse all nodes in a tree between two nodes.
I have a DOM tree (an ordered tree, where child elements at each level have a specific order). I am given start and stop nodes in ...
2
votes
1
answer
265
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
123
views
Can't figure out a water-flowing algorithm
Context:
I have a matrix of x and y dimensions.
The left-most column and the top-most row are considered the edges of the North-West ocean.
The right-most column and the bottom-most row are ...
0
votes
1
answer
79
views
How can I do a post-order traversal of a tree, when the only function I have is getChildren()?
I'm trying to collect all nodes in specific post-order traversal order. However, I'm not quite sure how to do this when my only function is getChildren(), rather than a left or right child. Here is ...
0
votes
1
answer
120
views
Why am I getting "time limit exceeded" error in binary tree level order traversal problem in leetcode?
I'm trying to solve the problem: Binary tree level order traversal problem on LeetCode and I've also tried looking for the answers, but I'm still getting a time limit exceeded (TLE) error. Please help ...
1
vote
2
answers
78
views
Graph traversal algorithm: when it is possible to move to the next node only after having visited it earlier with all incoming edges of the graph
There is a graph that consists of vertices (industrial installations) and edges flows of raw materials, intermediates and products between this nodes.
I need some kind of algorithm for "...
1
vote
2
answers
134
views
How can I efficiently find the k-th node from the end and m-th node from the beginning of a singly linked list in one pass?
I'm working with a singly linked list in Java and need to implement a method that can simultaneously find the k-th node from the end and m-th node from the beginning of the list in a single traversal. ...
0
votes
1
answer
54
views
Traverse elements of nested sections list python
I have a list of dictionarys named "sections" in this format:
[{
"elements": [
"/sections/1",
"/sections/5",
"/sections/6&...
1
vote
0
answers
196
views
BigQuery SQL query for traversing an undirected cyclic graph and returning all vertices found
I have an edges table in my Bigquery database that represents the edges of a directed cyclic graph, with two columns: (node_from, node_to).
Given a set of initial nodes (initial_node), I'd like to be ...
1
vote
1
answer
47
views
Traversal with conditions
I am working with a hierarchical dataset traversing through all levels of children and transforming them based on some conditions. Once, I am done with the transformation, I need to store the ...
2
votes
1
answer
58
views
Why is my traversing in BST not showing the results like the sample output?
My question is with traversing. In my problem the sequence of the traversal is not following as it should. I am using the general logic for the inorder, preorderand the postorder traversal but it is ...
0
votes
1
answer
86
views
Top View Of Binary Tree Depth First Search Using TreeMap
This is my attempt for coding-ninja question top view of binary tree
https://www.naukri.com/code360/problems/top-view-of-binary-tree_799401?leftPanelTabValue=PROBLEM
I wish to do it with TreeMap only. ...
0
votes
1
answer
112
views
How to parse a nested XML using PowerShell
I'm going to parse a nested xml file using PowerShell. Is there a way to traverse its childnodes and the nodes of its child one by one?
For example:
<?xml version="1.0"?>
<root ...
0
votes
1
answer
104
views
How to convert an array of text segments into DOM tree object?
Let's edit a text block in Figma as shown in the image:
Figma Plugin API gives the following segments for this text block:
const segments = [
{ "characters": "Lorem ", "...
0
votes
1
answer
152
views
Problem Working with Arrays in Pharo 11.0
I am working on a class named Boggle which contains two class-side methods below:
search: board for: words
| result visited trie |
result := Dictionary new.
trie := CTTrie new.
words do: [:...
2
votes
1
answer
149
views
Finding the least costly cycle on a graph where at least one node out of multiple node subsets must be met and each edge has a cost
I have a group of nodes and edges connecting these nodes, each edge has a cost to traverse. All of these nodes are put into their subsets and a cycle must be found for the lowest cost to visit at ...
2
votes
4
answers
167
views
A common lisp subst variant that can traverse defstructs
I am using SBCL and I don't mind a compiler-specific solution. I have form that involves some structs and I would like to walk and modify some sub-forms but subst can't see behind structs:
CL-USER> ...
0
votes
1
answer
485
views
Finding leftmost nodes in every level of a tree
Here's my code to set up tree nodes.
class TreeNode {
constructor(value, left, right, level) {
this.value = value;
this.left = left;
this.right = right;
this.level = level
}
}
...
1
vote
3
answers
131
views
Inorder Binary Tree Traversal
I created Binary Tree with some nodes and trying to get the result of inorder traversal using dictionary, but It does not really work.
Why the list does not append, even tho it prints the result?
...
0
votes
1
answer
89
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
1
answer
75
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
34
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 ...
-1
votes
1
answer
42
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
398
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
115
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
20
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
139
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
247
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
28
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
385
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
55
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
139
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
166
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
57
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
125
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
votes
2
answers
85
views
Replace verbose nested data traversal with recursive code [closed]
I wrote my own function to display array structure in a comfortable way.
It shows array like that:
$data:
$data[id] = 3
$config:
$config[last_offer_day] = 01.07.2023
and etc.
I think my code is too ...
1
vote
0
answers
134
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
98
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
267
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
82
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
65
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 ...
0
votes
2
answers
133
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 ...
4
votes
2
answers
253
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
649
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
32
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 ...