1

Apologies if this question was not framed well. I am experimenting my novice R skills, to analyse SNA on ecommerce data from SNAP. I got the large data sets on product co-purchased information. The data set has details on #FromNode & #ToNode information apart from other transaction details (which has recommendation details about the product). I wish to test the data on some of the network parameters like closeness centrality, betweenness, Egocentricity, density etc. following is the first code i tried on the dataset, and I got struck with the error.

library(igraph)  
dat=read.csv(file.choose(),skip=4, header=FALSE) 
m=as.matrix(dat)
g=graph.adjacency(m,mode="undirected",weighted=NULL)

Error in .Call("R_igraph_graph_adjacency", adjmatrix, as.numeric(mode), : At structure_generators.c:272 : Non-square matrix, Non-square matrix

The data set says "Directed graph (each unordered pair of nodes is saved once)". I don't know how to proceed from here on. Also, how to link the transaction details with these node&edges analysis (nodes being products & edges being link between one product and co-purchased product)

1 Answers1

0

Impossible to answer without knowing what your data look like (you need to provide more information), but "non-square matrix" suggests that your data are not an adjacency matrix (i.e. an N x N matrix where elements are information about ties). "Unordered pair of nodes saved once" sounds like an edgelist; check the igraph documentation on loading data in this format. If that doesn't work you will probably need to provide more information to get a useful answer. For example, what does head(m) look like?

tvg
  • 388
  • 2
  • 13
  • Hi TVG, Thanks for the comments. I am using the data from the following link (http://goo.gl/JpABp4). Also the data has both nodes & edges information. Requesting you to help me to get the appropriate learning material to kick start graph analysis in SNA followed by product recommendation mapping. – sundarrajan mugunthan Sep 23 '15 at 06:07
  • Based on looking at the data quickly, it looks like an edgelist; again, check the igraph documentation on how to read it (and a description of this data format). Not sure how to help beyond that, this is a huge area. – tvg Sep 23 '15 at 16:58