1

I'm new to R and want to construct a regular lattice with 30 nodes and k=4 (neighborhood connectivity).

I've tried the igraph package with graph.lattice function, but cannot produce what I'm looking for.

Cristian Ciupitu
  • 20,270
  • 7
  • 50
  • 76
Issac
  • 51
  • 5

1 Answers1

2

A regular lattice in iGraph with k = 4 neighbourhood connectivity:

require(igraph)
g <- graph.lattice( c(5,6) )
g <- connect.neighborhood(g, 4)
plot(g)

enter image description here

Simon O'Hanlon
  • 58,647
  • 14
  • 142
  • 184
  • Actually I look for something like this: 'd=graph.lattice(30,nei=2,directed=FALSE, circular=TRUE)' – Issac Mar 21 '13 at 01:06
  • 1
    @Issac have you answered your own question, or is there something else you are looking for? – Gary Weissman Mar 21 '13 at 01:47
  • 1
    @Issac I wonder if you could be more specific about *cannot produce what I'm looking for*? – Simon O'Hanlon Mar 21 '13 at 05:14
  • @Gary No, I wanted to add some hints about what I was trying to get in R. – Issac Mar 21 '13 at 14:53
  • @SimonO101 Thanks! This is what I was chasing. Sorry for not being to the point in the first post. – Issac Mar 21 '13 at 14:56
  • @Issac You are welcome! If it answered your question satisfactorily please could you press then green tick next to my answer so this question can be taken off the unanswered questions stack. Many thanks! Welcome to SO btw. – Simon O'Hanlon Mar 21 '13 at 15:39