Skip to main content
Filter by
Sorted by
Tagged with
5 votes
2 answers
209 views

I have a dataset of 150 individual cows (150 IDs) with 288 GPS locations per day and for 10 days, where each row is a relocation (432.000 rows) and columns store cow's ID, a time stamp (date and time)...
cmoreno's user avatar
  • 115
3 votes
2 answers
110 views

I have a matrix M with size (37, N) and an additionnal 1D reference vector of size (37,1) I am looking for a way to compute the spearman correlation between each sample of M and my reference to obtain ...
QuanticDisaster's user avatar
1 vote
1 answer
81 views

I am using graph-tool to plot an adjacency matrix from a dataframe. The adjacency matrix looks correct and symmetric, but when I plot it using graph-tool, the resulting visualization is incorrect. (I ...
JYB's user avatar
  • 23
2 votes
2 answers
67 views

I want to do exactly the same thing as this post, but in python; aka given a list of natural integers, generate a random adjacency matrix whose degrees would match the list. I had great hope as the ...
Qise's user avatar
  • 276
1 vote
1 answer
130 views

How to convert a graph to a sparse ‘dgTmatrix’ in one step? library(igraph) library(Matrix) g <- make_ring(5) adj <- as_adjacency_matrix(g, sparse = TRUE) class(adj) # [1] "dgCMatrix" #...
clp's user avatar
  • 1,602
1 vote
0 answers
34 views

It's relatively easy to see that, for a network with Adjacency matrix A, the number of 3-loops is (1/6)Tr(A^3). For 4-loops, we need (1/8)[Tr(A^4) - 2(sigma(k^2)) + sigma(k)] where k are the node ...
Aydin Onac's user avatar
0 votes
0 answers
85 views

The data x and y represent the geographic coordinates of the centroids of cities 1 to 8: > df <- data.frame( + ID = 1:8, + x = c(4.0, 7.0, 2.5, 8.0, 3.0, 5.0, 6.0, 7.0), + y = c(8, 9, 4, 5,...
César Macieira's user avatar
0 votes
1 answer
54 views

I have a dataframe that consists of x rows and n columns. Each row represents a document and each column represents a category of tag associated with the document. The values in each cell are a 0 (...
PositivePotato90's user avatar
0 votes
1 answer
58 views

In our problem, rows (index) and columns belong to the same category of objects. We want to enlarge a Pandas DataFrame, adding rows and columns filled with NaNs or predefined values, so that both the ...
Mateusz's user avatar
  • 49
3 votes
3 answers
100 views

I have a dataframe of this structure: A <- data.frame(A = c("B",NA,NA,NA), B = c("C","D",NA,NA), C = c(NA,NA,NA,NA), ...
tony13s's user avatar
  • 191
0 votes
1 answer
240 views

I am working on a fraud detection project using GNN. My graph has banking codes (SWIFT BIC codes) as nodes and the edges represent transactions. Below are the shapes of my tensors: Node Features ...
Marie-Lyne Roustom's user avatar
2 votes
2 answers
84 views

The following is a seemingly simple recursion for finding a hybercube matrix. The recursion is defined as: (Formula) I tried to put it into code but I keep running into broadcasting issues with numpy. ...
mo-alowais's user avatar
0 votes
1 answer
59 views

For the follwoing data that represents the flow of the tourist by months for these five countries, I would like to draw a multiple bar plot such that one row of the mutliple bar plot represents the ...
Pankaj's user avatar
  • 23
1 vote
3 answers
210 views

What is a good way to define this graph data structure: typedef struct { unsigned short isExists : 1; WEIGHT_TYPE weight; } Weight; typedef struct { Weight adjacencyMatrix[VERTICES_NUM][...
Lior v's user avatar
  • 540
0 votes
1 answer
77 views

I'm experiencing a strange exception when calling the fit_predict method on a PageRank object, with data coming from an edge list. I get the 'TypeError: The input matrix must be in Scipy sparse format ...
Herve Kabla's user avatar
0 votes
1 answer
93 views

I have a nxn dataframe as follows Col1 Col2 Col3 Col4 Col5 Col6 Col1 0 0 0 0 0 0 Col2 0 0 0 0 0 0 Col3 0 ...
Science11's user avatar
  • 883
-1 votes
2 answers
110 views

I would like to repeat a list N times but without repeating an item itself. For example, from itertools import * items = [ _ for _ in range(3)] # repeat each item twice row = sorted(list(chain(*...
DaCard's user avatar
  • 641
0 votes
0 answers
42 views

Good day! I'm trying to write a python script that can model the temperature of a space. I've chosen an 11x11 matrix to represent this space, the edges are 20 degrees, and the centre is 3000 degrees. ...
SollyPolly's user avatar
1 vote
0 answers
57 views

I'm trying implement Prim's Minimum Spanning Tree Algorithm of a graph represented using Adjacency Matrix in Java. The code is running successfully, but not able to generate expected output. The ...
Sree Teja's user avatar
0 votes
1 answer
466 views

I am trying to build an adjacency matrix from pixels of an elevation raster. The raster is a GeoTIFF image with specified nodata values outside a watershed. The solution I have now is working but is ...
Rik Ferreira's user avatar
0 votes
0 answers
64 views

I have assembled a massive sparse stiffness matrix using its DOFs and some rules of assembly. In order to do an efficient Bragg scattering analysis, I would now like to reorder them based on 3 zones: ...
BetaCaviar's user avatar
2 votes
1 answer
75 views

I need to calculate the adjacency matrix (in flat format) of a very large graph. Number nodes is 54327 and number edges is 46 million. The input are 46 million edges, so input looks like 1 6 2 7 1 6 3 ...
Eurico Covas's user avatar
2 votes
2 answers
92 views

I really need help with code to create a weighted adjacency matrix from a dataset; some rows contain 1 or 2 ingredients, but others have more (up to 8). The resulting matrix will likely be upwards of ...
AMM's user avatar
  • 31
0 votes
2 answers
108 views

I have a dataframe similar to mydf <- data.frame(Country=c('USA','Brazil','China','Italy','Ghana','Brazil','USA','China','USA'), Pattern=c('XXZ','XXX','XYX','XXZ','...
Discovery2020's user avatar
1 vote
0 answers
108 views

I am doing empirical research on the impact of wind turbine proximity on property values. I've built the spatial lag, error, and SAC models. My problem is that, after specifying the weights matrix, I ...
Rasim's user avatar
  • 11
1 vote
0 answers
116 views

I have this graph: The starting node is Hotel and I want the program to find paths for all valid Hamiltonian cycles. But I cannot seem to get the code to work despite following examples of the ...
D.Man's user avatar
  • 311
1 vote
2 answers
151 views

I am using Boost 1.83 with the latest Cygwin. The problem I'm having also occurred with Boost 1.66. I am trying to use the Boost Graph Library isomorphism function on an adjacency_matrix: #include &...
Edward Doolittle's user avatar
0 votes
1 answer
63 views

I have the following function taking two NetworkX graphs as input. I debug printed the adjacency matrix and the edges returned by NetworkX, which do not match. If I hardcode the adjacency matrix, ...
user3748950's user avatar
0 votes
0 answers
61 views

In a grid LxL where L is the square root of the number of elements N (L=numpy.sqrt(N)) i want to obtain the adjacency matrix for all the points that are close to each other, including the diagonals. I ...
Mirk's user avatar
  • 117
0 votes
0 answers
57 views

I want to use MATLAB to create the adjacency matrix for the following undirected graph data in this link. When I apply "graph" function, I get the error that the matrix has duplicate edges. ...
AMGEO's user avatar
  • 13
3 votes
3 answers
77 views

I am correctly tokenizing single words from a line of strings; however, inserting them into a 2d array cuts off parts of the token. I also have a problem with NULL, and the code results in a segfault. ...
Januar Soepangat's user avatar
-1 votes
1 answer
163 views

I am attemping to create a weighted social network between a series of characters. I have manually created an adjacency matrix with weighted values: . This has been linked to a separate file, in which ...
peterkeenan's user avatar
0 votes
1 answer
91 views

The structure of the data in Stata looks something like this: id club_id 1 1 2 1 3 2 4 2 5 2 6 3 7 3 8 3 9 3 I assume that the network ...
Ele's user avatar
  • 7
0 votes
1 answer
230 views

I was tasked my my prof to solve a graph question. However, he hinted that one of his hidden test cases that I failed have over 80k, my code would fail as it exceeded the amount of memory that was ...
Shreamy's user avatar
  • 361
1 vote
1 answer
671 views

I took the code for the Dijkstra algorithm from this website and rewrote it for my needs (see below). Now I need to implement a feature that would store the shortest path for each node. I tried ...
GawronDev's user avatar
  • 137
1 vote
1 answer
293 views

In the below code, while trying to print all cycles, there comes the case where multiple cycles exist for one node. Even though I am increasing the value of k in the cycle function, it doesn't print ...
Dhruvil09's user avatar
1 vote
0 answers
58 views

I just need to find neighbors positions of 2d array using depth first search. for example assume below one is the 2D array. {{0,0,0,0,0,}, {0,1,1,1,0,}, {0,1,1,1,0,}, {0,1,1,1,0,}, {0,0,0,1,1,},}; ...
Senura Asanka's user avatar
0 votes
1 answer
142 views

I have an adjacency matrix which I am using as my pre detriment distance matrix. Instead of finding all the nearest points of all the nearest points I only want to group points that are all near each-...
mewspoon's user avatar
1 vote
1 answer
584 views

I have an adjacency matrix below (both column & headers are userIDs) with values either 0s or 1s. The value 1 denotes that the 1st user knows the 2nd user and vice versa (e.g User 0 knows User 1 ...
dephrenic's user avatar
1 vote
1 answer
114 views

I am implementing a simple document indexer for information retrieval. Now I need to implement an incidence matrix, that should be able to be extended dynamically (not satisfied with just a static ...
Capy Maths's user avatar
1 vote
1 answer
155 views

Hope you are well. I've been converting an adjacency matrix to a connectivity index. I am having problems trying to get it take the second neighbour, but have been having issues. I will try to explain ...
YZman's user avatar
  • 47
0 votes
1 answer
143 views

I have a data frame with more than 20 columns of actor names and I would like to make the adjacency matrix for the relationship among them, for the sake of simplicity let's say my data frame is as ...
Jina's user avatar
  • 57
1 vote
1 answer
92 views

I am creating a network by specifying points and edges. However, I want to make this code more generic so that it can handle large number of my_nodes (say 100) and generate a connection matrix. This ...
AEinstein's user avatar
  • 153
0 votes
2 answers
216 views

I have a network with nodes and vertices and the following numbering scheme. I want to generate an adjacency matrix A for the nodes 0,1 as shown below. I tried to do using networkx. I present the ...
AEinstein's user avatar
  • 153
1 vote
1 answer
550 views

I need to generate the following adjacency matrices: No of Nodes = 3 A B C AB AC BC A 0 1 1 0 0 1 B 1 0 1 0 1 0 C 1 1 0 1 0 0 AB 0 0 1 0 0 0 ...
Ahmad's user avatar
  • 774
1 vote
1 answer
106 views

I have a origin & destination airport and the number of flights between two airports on a certain year. ORIGIN_AIRPORT DESTINATION_AIRPORT Counts 0 ABE ATL ...
Tisi's user avatar
  • 13
0 votes
1 answer
88 views

I have a large collection of CSVs, each containing an "id" column of values, and a "neighbors" column with lists of strings. Values from id do not occur in any neighbors lists. ...
Rasmus's user avatar
  • 152
0 votes
0 answers
69 views

try { System.out.println("Enter the number of vertices"); number_of_vertices = scan.nextInt(); adjacency_matrix = new int[number_of_vertices + 1][number_of_vertices + 1]; ...
Akhil 546u's user avatar
2 votes
3 answers
820 views

I want to plot graph (which is an undirected connected graph) like the uploaded picture. I want to use the adjacency matrix in order to plot it. So my question is how can I plot a graph from its ...
Homer Jay Simpson's user avatar
0 votes
1 answer
34 views

So I am trying to generate my own adjacency list using random.randint. I am not able to view the output. Its just few values and then dots. I want to input these values into my algorithm. How to view ...
pri's user avatar
  • 1

1
2 3 4 5
19