162 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
3
answers
141
views
Pythonic way to conditionally replace values in a numpy array based on neighbour's values
I am processing a greyscale (8 bit) black-and-white image in Python with OpenCV.
The image (2D numpy array with shape (100,200) ) contains pixels of only 2 colors - black (0) and white (255).
Here is ...
0
votes
0
answers
159
views
LSH (Locality Sensitive Hashning)-based neighbor search
Say, I have a point cloud of 30,000 points in 3D. I want to count the neighbors for each point at a cut-off distance.
the following code always shows the neighbor count as 1 no matter what the ...
2
votes
1
answer
66
views
Finding intersections between a large number of sets with unique elements each
The following is an interesting algorithmic problem.
Inputs:
The set of elements S (say, non-negative integers).
A mapping N that maps some elements from S to a subset S_k \subset S. (not all ...
1
vote
2
answers
159
views
Find all unique neighbor pairs between segments of ndimage labeling in an efficient manner
Below I give an example in 2D, but my real question would be regarding 3D (with or without periodic boundaries). Find all unique neighbors for each segment id using 8 neighbors (2d) or 26 neighbors (...
1
vote
1
answer
213
views
Javascript matrix check neighbor state to find edges
i am making a virtual Hama beads tool online. (its a kids toy where you put plastic beads on a matrix and iron them to make them stick together and form a solid shape)like this one below (real hama)
...
0
votes
1
answer
501
views
Create graph using edges from csv files and calculate common neighbors between its nodes
I have two files': nodes.csv and edges.csv that contains nodes and edges between them as follow
nodes.csv (182 nodes) look like
0
1
2
.
.
.
and edges represented by 2 columns (300 edges) as
1 2
0 2
...
0
votes
0
answers
74
views
Near-Neighbor Searching in Ternary Search Tree
How is the search for the nearest neighbors in the tree? Trying to find information, I get only some formulas without illustrative examples.
enter image description here
Example of a function:
void ...
0
votes
2
answers
41
views
How I end a loop for not sum first and last number as a pair?
I've got everything working correctly except this one problem - with the third output it says the max pair sum is 13 due to taking sum of the first and last number. It should be 11 (as 9+2 or 4+7). I ...
0
votes
1
answer
99
views
Finding neighbors in a matrix and storing those neighbors in a new matrix
What I have is a matrix of characters that looks like this:
matrix = [
['-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-'],
['-', '-', '-', '+',...
0
votes
2
answers
152
views
how fill na in matrix with neighbor? R
this my first question and I hope to collaborate in the community.
I am in a project in which I must fill the NA values with the average of their neighbors from a matrix of ncol = 10 and nrow = 10. ...
0
votes
1
answer
156
views
python - Conway's Game of Life bug at calculating neighbors, and therefore gets wrong results
I'm trying to built 'Conway's Game of Life' but for some reason the number of neighbors are not calculated correctly, therefore I gets wrong results. please help me:)
I'm pretty lost I don't know what'...
0
votes
1
answer
69
views
Netlogo - "agents-here" not behaving as expected
Thank you for earlier input on my question. In this model the boat moves diagonally across the world (which does not wrap, 00 bottom left, max-pycor & max-pxcor 49) and 20 fish move in the ...
-1
votes
1
answer
184
views
Create dummy variable for all neighborhood region depending on another dummy variable (sf object)
I have a spatial dataframe (sf) of all European NUTS2 regions. Within this sf object certain regions have a dummy = 1, and others a dummy = 0.
How can I create a new dummy (lets say "...
0
votes
1
answer
114
views
Spawning pathfinder neighbours
I am trying to spawn the neighbours of my path finder but when doing so the original path (path) blue also becomes covered up. I have tried switching of the order of spawn but this does not seem to ...
0
votes
1
answer
496
views
Most efficient way to check cells and change neighbors matching a condition in a dataframe
I'm using a pandas dataframe to store a dynamic 2D game map for a rougelike style game map editor. The player can draw and erase rooms. I need to draw walls around these changing rooms.
I have this:
0 ...