Recent Changes - Search:

Research

Aviation?

Motorcycles

Blog

edit SideBar

ScaleFreeNetworks

addPreferentialNode <- function(graph,gedges){
	nodeNames = length(nodes(graph)) + 1
	graph = addNode(paste(nodeNames),graph)
	for(edge in gedges){
		graph = addEdge(paste(nodeNames),edge,graph)
	}
	graph
}

m0 = 3

mat = matrix(0,m0,m0)
rownames(mat) = paste(1:m0)
colnames(mat) = paste(1:m0)

mat[1,2] = 1
mat[2,1] = 1

#mat[lower.tri(mat)] = mat[upper.tri(mat)]
G0 = new("graphAM",adjMat = mat, edgemode="undirected")
G0 = as(G0,"graphNEL")

#loop here
for(i in 1:1000){
	prob = degree(G0,nodes(G0))/sum(degree(G0,nodes(G0)))
	nodeList = names(prob)
	G0 = addPreferentialNode(G0,sample(nodes(G0),m0-1,FALSE,prob))
}

We end up with a nice, preferentially grown network according to the algorithm laid out by Barabasi et al.

A graphNEL graph with undirected edges Number of Nodes = 1003 Number of Edges = 2001

Wikipedia says: Another important characteristic of scale-free networks is the clustering coefficient distribution, which decreases as the node degree increases. This distribution also follows a power law. That means that the low-degree nodes belong to very dense sub-graphs and those sub-graphs are connected to each other through hubs.

Edit - History - Print - Recent Changes - Search
Page last modified on April 28, 2009, at 12:48 PM