Questions tagged [neighbours]

166 questions
0
votes
2 answers

Accessing data in neighbor cells

I have a matrix M of size m x n which is saved as a one dimensional array N of length m * n. Every cell of this array contains some integer variables which are the ID of data points. The amount of integer variables in every cell changes over…
Gilfoyle
  • 3,282
  • 3
  • 47
  • 83
0
votes
1 answer

Checking the neighbours of a cell value from a matrix

I have a matrix filled with * and -, where * represents a virus and - a free spot for a virus, I have to check in my matrix the neighbours of every virus, a valid neighbour is another virus and not a free spot, in order to establish their number.…
Julanu
  • 162
  • 2
  • 5
  • 15
0
votes
2 answers

Prolog , find neighbors of a graph

Given a graph G = [1 - 5, 2 - 4, 2 - 6, 3 - 4, 3 - 6, 3 - 9, 4 - 7, 5 - 7, 6 - 7, 6 - 8, 6 - 9] I must find all neighbors for each node , and create a list with this form Graph = [(1, [5]), (2, [4, 6]), (3, [4, 6, 9]), (4, [2, 3, 7]), (5, [1,…
Haki Terror
  • 343
  • 3
  • 15
0
votes
1 answer

Implementing CakePHP find() operations in datasource

I'm implementing a custom datasource in my CakePHP application, I've implemented the basic functions for a datasource (read(), listSources(), describe()). The datasource uses Xml as input and I would really like to use find('neighbors') on the Xml…
mensch
  • 4,411
  • 3
  • 28
  • 49
0
votes
1 answer

finding neighbours around central rows and columns MATLAB

I was wondering if some can help me regarding the row-column looping. I have my row, col positions as [row,col]. e.g. array 300X2 I am trying to find their 8 neighbour values as: neighbors_id= [matrix_cell_id(row, col),... matrix_cell_id(row-1,…
Marcos
  • 1
  • 1
0
votes
0 answers

Accessing elements returned by ego function in R

I am using ego function to find the immediate neighbors of node i. nbr <- ego(graph1, 1, i) print(nbr) The print statement outputs: [[1]] + 4/1000 vertices: [1] 119 95 237 276 How can I access an integer from the list: 119 95 237 276?
Sonu Mishra
  • 1,659
  • 4
  • 26
  • 45
0
votes
1 answer

How to create a set of neighboring nodes based on "from" and "to" arc data

Imagine that you have a set of nodes (1 2 3) and that these nodes are connected through arcs (1,2), (1,3) and (2,3). Together representing a network. How can I create a subset of nodes, containing all neighboring nodes? i.e. I wan't the following…
Martin K
  • 1
  • 1
0
votes
1 answer

how to manipulate a list in python

I just wanting to ask you about an excercise in school based on construction of a maze in python. We start with a known (x,y) point and the n*n graph. In each recursion we should make a neighbouring_list for every couple (x,y) which will contain the…
nikiforosb
  • 23
  • 1
  • 1
  • 9
0
votes
0 answers

Link closest points accross altitudes in Matlab and form chains

I have a 3d matrix with scattered points (Nx4 matrix, x-y-z-data). My aim is to link the closest points together and register each chain in an Kx4 array (x, y, z, data), K being the chain length. The total number of chains depends on the points... A…
pcpc
  • 3
  • 2
0
votes
3 answers

How to find neighbors in 4D array in MATLAB?

I am a bit confused and would greatly appreciate some help. I have read many posts about finding neighboring pixels, with this being extremely helpful: http://blogs.mathworks.com/steve/2008/02/25/neighbor-indexing-2/ However I have trouble applying…
ziggy
  • 17
  • 4
0
votes
2 answers

Counting neighbors with wrap around in 2d array(game of life)

So I'm trying to build the game of life program and I am fairly fresh to java/coding in general and I am having issues wrapping my head around wrap around in 2D arrays. I have a constructor and methods that will build me an array and place "cells"…
0
votes
4 answers

Assigning same value to the neighbours

I'm trying to assign that value which is more repeated in an 8x8 neighbourhood to be the value of all the pixels in that neighbourhood. I made a call to the following function: function ret = spatial_val(x) [m,n]=size(x); …
Simplicity
  • 47,404
  • 98
  • 256
  • 385
0
votes
1 answer

Most repeated values

I know how to check an 8-neighbourhood in matlab (i.e; nlfilter). But, I want to assign the value which is more repeated to the center value. So, say for instance that I have the following values in the 8-neighbourhood: 2-values = 56 3-values =…
Simplicity
  • 47,404
  • 98
  • 256
  • 385
0
votes
1 answer

counting neighbors of boids in python

I am making a program to simulate a flock of birds in python by means of boids. One of the tasks is to count the neighboring boids (distance <= 50). I tried to do it like this (see code) but I don't get good results. The 'print distance' gives 20x…
0
votes
1 answer

How to sum up the value of neigburs in matlab?

I'm new to matlab and trying to code game of life. But i have some difficulties making the sum of the neigbors. Every cell can have a value of 0 or 1. I'm trying to use a counter (like in Python, the only program i'm somewhat familiar with) but that…
user2162627
  • 11
  • 1
  • 4