I would like to generate a lattice with 100 nodes but would like to ensure that all nodes have the same number of neighbours.
However when I do:
d=graph.lattice(100,0,nei=10,directed=TRUE,circular=TRUE)
get.edgelist(d)
then I can see that many of the nodes do not have the same number of neighbours.
Is there any way to ensure that every node has the same number of connections assuming that the first column represents nodes and the second column connections?
This is because the default edge directions for
graph.latticeare not the best for directed graphs. What you can do is creating an undirected graph, and then converting it to directed:If you want non-mutual edges, then the easiest (but somewhat less readable) solutions is