Hi Tamas,
I have tried out one code to make geometric graphs in 3D. Below is my R
script.
###
get.dist = function(x)
{
sqrt(x[1]^2 + x[2]^2)
}
get.pairs = function(N)
{
M = matrix(0, nrow = N * (N - 1)/2, ncol = 2)
x = 1:N
k = 1
for (i in head(x, -1))
{
for (j in (i + 1):(length(x)))
{
M[k, ] = c(i, j)
k = k +1
}
}
M
}
create.graph = function(N = 100, d = 0.3)
{
rnd.points = matrix(runif(3 * N), ncol = 3)
perms = get.pairs(N)
Edges = apply(perms, 1, FUN = function(x){
vec.diff = rnd.points[x[1], ] - rnd.points[x[2], ]
get.dist(vec.diff)
})
res = cbind(Edges, perms)
colnames(res) = c('E', 'V1', 'V2')
list(M = res, N = N, d = d, pts = rnd.points)
}
After achieving M with all the with associated distance value i will fetch
only those values which are less than or equal to provided threshold. Is it
a proper way of doing it.?
On Tue, May 31, 2016 at 7:45 PM, Tamas Nepusz <[email protected]> wrote:
> Hi,
>
> No, there is no such function; you need to code it yourself.
>
> T.
>
>
> On Tue, May 31, 2016 at 4:07 PM, seema aswani <[email protected]>
> wrote:
> > Hi all,
> >
> > I want to generate geometric random graphs in 3D. Is there any in igraph
> to
> > generate random geometric graphs in 3D..?? Please help.
> >
> >
> > Seema
> >
> > _______________________________________________
> > igraph-help mailing list
> > [email protected]
> > https://lists.nongnu.org/mailman/listinfo/igraph-help
> >
>
> _______________________________________________
> igraph-help mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help