Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

create a network without matrix in r or python

$
0
0

I have a large dataset that contains 30000 data (as a csv file). The data is like this:

dataset <- data.frame(person = c(1331688384,910725927,1479941022,1606882065,1877559309),
dahak = c(9,1,4,3,2))

personid, dahak

1331688384, 9

910725927, 1

1479941022, 4

1606882065, 3

1877559309, 2

I have to calculate the weight of the edges from the dahak list ... If two dahak numbers are equals then weight of this edge is 1, if two dahak numbers are not equals then calculate their difference and the weight is x.

x = 1 - (abs(as.numeric(dahak[j]) - as.numeric(dahak[k])) / 10)

How can i create a weighted network with the personid as nodes and weight as edges? I now i can do that with create a matrix and then using the networkx library in python or statnet library in R, but matrix has 900 million entries! and my laptop can't hold this ... I'm looking for another way.


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>