Title: | Large-Scale Social Network Analysis |
---|---|
Description: | We present an implementation of the algorithms required to simulate large-scale social networks and retrieve their most relevant metrics. |
Authors: | Nazrul Shaikh [aut, cre], Xu Dong [aut], Luis Castro [aut], Christian Llano [ctb] |
Maintainer: | Nazrul Shaikh <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1.3 |
Built: | 2025-03-04 04:17:39 UTC |
Source: | https://github.com/networkgroupr/fastnet |
Obtain the degrees for all nodes.
dist.deg(net)
dist.deg(net)
net |
The input network. |
Obtain the degrees for all nodes.
A vector.
Xu Dong, Nazrul Shaikh.
## Not run: x.dist.deg <- dist.deg(x) summary(x.dist.deg) ## End(Not run)
## Not run: x.dist.deg <- dist.deg(x) summary(x.dist.deg) ## End(Not run)
Plot the degree distribution of a network.
draw.degdist(net)
draw.degdist(net)
net |
The input network. |
Plot the degree distribution of a network.
A .gif plot.
Xu Dong, Nazrul Shaikh.
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) draw.degdist(x) ## End(Not run)
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) draw.degdist(x) ## End(Not run)
Plot the cumulative degree distribution of a network, with a logarithm scale.
draw.degdist.cum(net)
draw.degdist.cum(net)
net |
The input network. |
Plot the cumulative degree distribution of a network, with a logarithm scale.
A .gif plot.
Xu Dong, Nazrul Shaikh.
## Not run: x <- net.barabasi.albert(1000, 20) draw.degdist.cum(x) ## End(Not run)
## Not run: x <- net.barabasi.albert(1000, 20) draw.degdist.cum(x) ## End(Not run)
Plot the cumulative degree distribution of a network, with a logarithm scale.
draw.degdist.cum.log(net)
draw.degdist.cum.log(net)
net |
The input network. |
Plot the cumulative degree distribution of a network, with a logarithm scale.
A .gif plot.
Xu Dong, Nazrul Shaikh.
## Not run: x <- net.barabasi.albert(1000, 20) draw.degdist.cum.log(x) ## End(Not run)
## Not run: x <- net.barabasi.albert(1000, 20) draw.degdist.cum.log(x) ## End(Not run)
Plot the degree distribution of a network, with a logarithm scale.
draw.degdist.log(net)
draw.degdist.log(net)
net |
The input network. |
Plot the degree distribution of a network, with a logarithm scale.
A .gif plot.
Xu Dong, Nazrul Shaikh.
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) draw.degdist.log(x) ## End(Not run)
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) draw.degdist.log(x) ## End(Not run)
Plot a small network.
draw.net(net)
draw.net(net)
net |
The input network. |
Plot a small network.
A .gif plot.
Xu Dong, Nazrul Shaikh.
## Not run: x <- net.ring.lattice(12,4) draw.net(x) ## End(Not run)
## Not run: x <- net.ring.lattice(12,4) draw.net(x) ## End(Not run)
fastnet
Transform an adjacency matrix to an ego-centric list form used in fastnet
.
from.adjacency(adj.mat)
from.adjacency(adj.mat)
adj.mat |
The input adjacency matrix |
A list containing the nodes of the network and their respective neighbors.
Xu Dong, Christian Llano.
adj.mat <- matrix(c(0,1,0,0,1,0,0,0,0,0,0,1,0,0,1,0), nrow = 4, ncol = 4) g <- from.adjacency(adj.mat)
adj.mat <- matrix(c(0,1,0,0,1,0,0,0,0,0,0,1,0,0,1,0), nrow = 4, ncol = 4) g <- from.adjacency(adj.mat)
fastnet
Transfer an edgelist to an ego-centric list form used in fastnet
.
from.edgelist(edgelist)
from.edgelist(edgelist)
edgelist |
The edge list, a vector with even number of entries. |
The n nodes are placed on a circle and each node is connected to the nearest k neighbors.
A list containing the nodes of the network and their respective neighbors.
Xu Dong, Christian Llano.
edgelist <- c(1, 3, 2, 3, 3, 4, 5, 6,5,7) g <- from.edgelist(edgelist)
edgelist <- c(1, 3, 2, 3, 3, 4, 5, 6,5,7) g <- from.edgelist(edgelist)
igraph
to fastnet
FormatTransform igraph
object to an ego-centric list form used in fastnet
.
from.igraph(net.igraph)
from.igraph(net.igraph)
net.igraph |
The input |
Masked from igraph::as_adj_list
.
A list containing the nodes of the network and their respective neighbors.
Xu Dong.
## Not run: library("igraph") net.igraph <- erdos.renyi.game(100,0.1) g <- from.igraph(net.igraph) ## End(Not run)
## Not run: library("igraph") net.igraph <- erdos.renyi.game(100,0.1) g <- from.igraph(net.igraph) ## End(Not run)
Plot the histogram of all degrees of a network.
histo.dist(g)
histo.dist(g)
g |
The input network. |
Plot the histogram of all degrees of a network.
A .gif plot.
Xu Dong, Nazrul Shaikh.
## Not run: x <- net.erdos.renyi.gnp(1000, 0.05) histo.dist(x) ## End(Not run)
## Not run: x <- net.erdos.renyi.gnp(1000, 0.05) histo.dist(x) ## End(Not run)
Calculate the global clustering coefficient of a graph.
metric.cluster.global(g)
metric.cluster.global(g)
g |
The input network. |
The global clustering coefficient measures the ratio of (closed) triples versus the total number of all possible triples in network g. metric.cluster.global()
calculates the global clustering coefficient of g.
A real constant.
Xu Dong, Nazrul Shaikh.
Wasserman, Stanley, and Katherine Faust. Social network analysis: Methods and applications. Vol. 8. Cambridge university press, 1994.
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) metric.cluster.global(x) ## End(Not run)
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) metric.cluster.global(x) ## End(Not run)
Calculate the average local clustering coefficient of a graph.
metric.cluster.mean(g)
metric.cluster.mean(g)
g |
The input network. |
The local clustering coefficient of a node is the ratio of the triangles connected to the node and the triples centered on the node.metric.cluster.mean()
calculates the (estimated) average clustering coefficient for all nodes in graph g with a justified error.
A real constant.
Xu Dong, Nazrul Shaikh.
Wasserman, Stanley, and Katherine Faust. Social network analysis: Methods and applications. Vol. 8. Cambridge university press, 1994.
## Not run: x <- net.erdos.renyi.gnp(n = 1000, ncores = 3, p = 0.06) metric.cluster.mean(x) ## End(Not run)
## Not run: x <- net.erdos.renyi.gnp(n = 1000, ncores = 3, p = 0.06) metric.cluster.mean(x) ## End(Not run)
Calculate the median local clustering coefficient of a graph.
metric.cluster.median(g)
metric.cluster.median(g)
g |
The input network. |
The local clustering coefficient of a node is the ratio of the triangles connected to the node and the triples centered on the node.metric.cluster.median()
calculates the (estimated) median clustering coefficient for all nodes in graph g with a justified error.
A real constant.
Xu Dong, Nazrul Shaikh.
Wasserman, Stanley, and Katherine Faust. Social network analysis: Methods and applications. Vol. 8. Cambridge university press, 1994.
## Not run: x <- net.erdos.renyi.gnp(1000, 0.1) metric.cluster.median(x) ## End(Not run)
## Not run: x <- net.erdos.renyi.gnp(1000, 0.1) metric.cluster.median(x) ## End(Not run)
Calculate the effective degree of a network.
metric.degree.effective(g, effective_rate = 0.9)
metric.degree.effective(g, effective_rate = 0.9)
g |
The input network. |
effective_rate |
The effective rate (0.9 is set by default). |
The effective degree
A real constant.
Xu Dong, Nazrul Shaikh.
## Not run: metric.degree.effective(x) ## End(Not run)
## Not run: metric.degree.effective(x) ## End(Not run)
Calculate the degree entropy of a graph.
metric.degree.entropy(g)
metric.degree.entropy(g)
g |
The input network. |
Calculates the degree entropy of graph g, i.e.
A real constant.
Xu Dong, Nazrul Shaikh.
Anand, Kartik, and Ginestra Bianconi. "Entropy measures for networks: Toward an information theory of complex topologies." Physical Review E 80, no. 4 (2009): 045102.
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) metric.degree.entropy(x) ## End(Not run)
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) metric.degree.entropy(x) ## End(Not run)
Calculate the maximal degree of a graph.
metric.degree.max(g)
metric.degree.max(g)
g |
The input network. |
The maximal degree.
A real constant.
Xu Dong, Nazrul Shaikh.
## Not run: metric.degree.max(x) ## End(Not run)
## Not run: metric.degree.max(x) ## End(Not run)
Calculate the efficient maximal degree of a graph.
metric.degree.max.efficient(g)
metric.degree.max.efficient(g)
g |
The input network. |
The efficient maximal degree is the 90
A real constant.
Xu Dong, Nazrul Shaikh.
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) metric.degree.max.efficient(x) ## End(Not run)
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) metric.degree.max.efficient(x) ## End(Not run)
Calculate the mean degree of a graph.
metric.degree.mean(g)
metric.degree.mean(g)
g |
The input network. |
The mean degree is the average value of the degrees of all nodes in graph g.
A real constant.
Xu Dong, Nazrul Shaikh.
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) metric.degree.mean(x) ## End(Not run)
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) metric.degree.mean(x) ## End(Not run)
Calculate the median degree of a graph.
metric.degree.median(g)
metric.degree.median(g)
g |
The input network. |
The median degree is the median value of the degrees of all nodes in graph g.
A real constant.
Xu Dong, Nazrul Shaikh.
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) metric.degree.median(x) ## End(Not run)
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) metric.degree.median(x) ## End(Not run)
Calculate the minimal degree of a network.
metric.degree.min(g)
metric.degree.min(g)
g |
The input network. |
The minimal degree.
A real constant.
Xu Dong, Nazrul Shaikh.
## Not run: metric.degree.min(x) ## End(Not run)
## Not run: metric.degree.min(x) ## End(Not run)
Calculate the standard deviation of all degrees of a network.
metric.degree.sd(g)
metric.degree.sd(g)
g |
The input network. |
The standard deviation of all degrees of a network.
A real constant.
Xu Dong, Nazrul Shaikh.
## Not run: metric.degree.sd(x) ## End(Not run)
## Not run: metric.degree.sd(x) ## End(Not run)
Calculate the average path length of a graph.
metric.distance.apl(Network, probability = 0.95, error = 0.03, Cores = detectCores(), full.apl = FALSE)
metric.distance.apl(Network, probability = 0.95, error = 0.03, Cores = detectCores(), full.apl = FALSE)
Network |
The input network. |
probability |
The confidence level probability. |
error |
The sampling error. |
Cores |
Number of cores to use in the computations. By default uses parallel function |
full.apl |
It will calculate the sampling version by default. If it is set to true, the population APL will be calculated and the rest of the parameters will be ignored. |
The average path length (APL) is the average shortest path lengths of all
pairs of nodes in graph Network. metric.distance.apl
calculates
the population APL and estimated APL of graph g with a sampling error set by the user.
The calculation uses a parallel load balancing approach, distributing jobs equally among the cores defined by the user.
A real value.
Luis Castro, Nazrul Shaikh.
E. W. Dijkstra. 1959. A note on two problems in connexion with graphs. Numer. Math. 1, 1 (December 1959), 269-271.
Castro L, Shaikh N. Estimation of Average Path Lengths of Social Networks via Random Node Pair Sampling. Department of Industrial Engineering, University of Miami. 2016.
## Not run: ##Default function x <- net.erdos.renyi.gnp(1000,0.01) metric.distance.apl(x) ##Population APL metric.distance.apl(x, full.apl=TRUE) ##Sampling at 99% level with an error of 10% using 5 cores metric.distance.apl(Network = x, probability=0.99, error=0.1, Cores=5) ## End(Not run)
## Not run: ##Default function x <- net.erdos.renyi.gnp(1000,0.01) metric.distance.apl(x) ##Population APL metric.distance.apl(x, full.apl=TRUE) ##Sampling at 99% level with an error of 10% using 5 cores metric.distance.apl(Network = x, probability=0.99, error=0.1, Cores=5) ## End(Not run)
Calculate the diameter of a graph.
metric.distance.diameter(Network, probability = 0.95, error = 0.03, Cores = detectCores(), full = TRUE)
metric.distance.diameter(Network, probability = 0.95, error = 0.03, Cores = detectCores(), full = TRUE)
Network |
The input network. |
probability |
The confidence level probability |
error |
The sampling error |
Cores |
Number of cores to use in the computations. By default uses parallel function |
full |
It will calculate the popular full version by default. If it is set to FALSE, the estimated diameter will be calculated. |
The diameter is the largest shortest path lengths of all pairs of nodes in graph Network.
metric.distance.diameter
calculates the (estimated) diameter
of graph Network with a justified error.
A real value.
Luis Castro, Nazrul Shaikh.
E. W. Dijkstra. 1959. A note on two problems in connexion with graphs. Numer. Math. 1, 1 (December 1959), 269-271.
Castro L, Shaikh N. Estimation of Average Path Lengths of Social Networks via Random Node Pair Sampling. Department of Industrial Engineering, University of Miami. 2016.
## Not run: ##Default function x <- net.erdos.renyi.gnp(1000,0.01) metric.distance.diameter(x) ##Population APL metric.distance.diameter(x, full=TRUE) ##Sampling at 99% level with an error of 10% using 5 cores metric.distance.diameter(Network = x, probability=0.99, error=0.1, Cores=5) ## End(Not run)
## Not run: ##Default function x <- net.erdos.renyi.gnp(1000,0.01) metric.distance.diameter(x) ##Population APL metric.distance.diameter(x, full=TRUE) ##Sampling at 99% level with an error of 10% using 5 cores metric.distance.diameter(Network = x, probability=0.99, error=0.1, Cores=5) ## End(Not run)
Calculate the effective diameter of a graph.
metric.distance.effdia(Network, probability = 0.95, error = 0.03, effective_rate = 0.9, Cores = detectCores(), full = TRUE)
metric.distance.effdia(Network, probability = 0.95, error = 0.03, effective_rate = 0.9, Cores = detectCores(), full = TRUE)
Network |
The input network. |
probability |
The confidence level probability |
error |
The sampling error |
effective_rate |
The effective rate (by default it is set to be 0.9) |
Cores |
Number of cores to use in the computations. By default uses parallel function |
full |
It will calculate the popular full version by default. If it is set to FALSE, the estimated diameter will be calculated. |
The diameter is the largest shortest path lengths of all pairs of nodes in
graph Network. metric.distance.diameter
calculates the (estimated)
diameter of graph Network with a justified error.
A real value.
Luis Castro, Nazrul Shaikh.
Dijkstra EW. A note on two problems in connexion with graphs:(numerische mathematik, _1 (1959), p 269-271). 1959.
Castro L, Shaikh N. Estimation of Average Path Lengths of Social Networks via Random Node Pair Sampling. Department of Industrial Engineering, University of Miami. 2016.
## Not run: ##Default function x <- net.erdos.renyi.gnp(1000,0.01) metric.distance.effdia(x) ##Population APL metric.distance.effdia(x, full=TRUE) ##Sampling at 99% level with an error of 10% using 5 cores metric.distance.effdia(Network = x, probability=0.99, error=0.1, Cores=5) ## End(Not run)
## Not run: ##Default function x <- net.erdos.renyi.gnp(1000,0.01) metric.distance.effdia(x) ##Population APL metric.distance.effdia(x, full=TRUE) ##Sampling at 99% level with an error of 10% using 5 cores metric.distance.effdia(Network = x, probability=0.99, error=0.1, Cores=5) ## End(Not run)
Calculate the mean eccentricity of a graph.
metric.distance.meanecc(g, p)
metric.distance.meanecc(g, p)
g |
The input network. |
p |
The sampling probability. |
The mean eccentricities of all nodes in graph g. Calculates the (estimated) mean eccentricity of graph g with a justified error.
A real constant.
Xu Dong, Nazrul Shaikh.
West, Douglas Brent. Introduction to graph theory. Vol. 2. Upper Saddle River: Prentice Hall, 2001.
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) metric.distance.meanecc(x, 0.01) ## End(Not run)
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) metric.distance.meanecc(x, 0.01) ## End(Not run)
Calculate the (estimated) median eccentricity of a graph.
metric.distance.medianecc(g, p)
metric.distance.medianecc(g, p)
g |
The input network. |
p |
The sampling probability. |
Is the median eccentricities of all nodes in graph g.
metric.distance.medianecc
calculates the (estimated) median eccentricity of graph g with a justified error.
A real constant.
Xu Dong, Nazrul Shaikh.
West, Douglas Brent. Introduction to graph theory. Vol. 2. Upper Saddle River: Prentice hall, 2001.
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) metric.distance.medianecc(x, 0.01) ## End(Not run)
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) metric.distance.medianecc(x, 0.01) ## End(Not run)
Calculate the median path length (MPL) of a network.
metric.distance.mpl(Network, probability = 0.95, error = 0.03, Cores = detectCores(), full = FALSE)
metric.distance.mpl(Network, probability = 0.95, error = 0.03, Cores = detectCores(), full = FALSE)
Network |
The input network. |
probability |
The confidence level probability |
error |
The sampling error |
Cores |
Number of cores to use in the computations. By default |
full |
It calculates the sampling version by default. If it is set to true, the population MPL will be calculated and the rest of the parameters will be ignored. |
The median path length (MPL) is the median shortest path lengths of all pairs of nodes in Network. metric.distance.mpl(g) calculates the population MPL OR estimated MPL of network g with a sampling error set by the user. The calculation uses a parallel load balancing approach, distributing jobs equally among the cores defined by the user.
A real integer
Luis Castro, Nazrul Shaikh.
E. W. Dijkstra. 1959. A note on two problems in connexion with graphs. Numer. Math. 1, 1 (December 1959), 269-271.
Castro L, Shaikh N. Estimation of Average Path Lengths of Social Networks via Random Node Pair Sampling. Department of Industrial Engineering, University of Miami. 2016.
## Not run: ##Default function x <- net.erdos.renyi.gnp(1000,0.01) metric.distance.mpl(x) ##Population MPL metric.distance.mpl(x, full=TRUE) ##Sampling at 99% level with an error of 10% using 5 cores metric.distance.mpl(Network = x, probability=0.99, error=0.1, Cores=5) ## End(Not run)
## Not run: ##Default function x <- net.erdos.renyi.gnp(1000,0.01) metric.distance.mpl(x) ##Population MPL metric.distance.mpl(x, full=TRUE) ##Sampling at 99% level with an error of 10% using 5 cores metric.distance.mpl(Network = x, probability=0.99, error=0.1, Cores=5) ## End(Not run)
Calculate the mean eigenvalue centrality of a graph.
metric.eigen.mean(g)
metric.eigen.mean(g)
g |
The input network. |
metric.eigen.mean
calculates the mean eigenvalue centrality score of graph g.
A real constant.
Xu Dong, Nazrul Shaikh.
Bonacich, Phillip, and Paulette Lloyd. "Eigenvector-like measures of centrality for asymmetric relations." Social networks 23, no. 3 (2001): 191-201.
Borgatti, Stephen P. "Centrality and network flow." Social networks 27, no. 1 (2005): 55-71.
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) metric.eigen.mean(x) ## End(Not run)
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) metric.eigen.mean(x) ## End(Not run)
Calculate the median eigenvalue centrality of a graph.
metric.eigen.median(g)
metric.eigen.median(g)
g |
The input network. |
metric.eigen.median
calculates the median eigenvalue centrality score of graph g.
A real constant.
Xu Dong, Nazrul Shaikh.
Bonacich, Phillip, and Paulette Lloyd. "Eigenvector-like measures of centrality for asymmetric relations." Social networks 23, no. 3 (2001): 191-201.
Borgatti, Stephen P. "Centrality and network flow." Social networks 27, no. 1 (2005): 55-71.
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) metric.eigen.median(x) ## End(Not run)
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) metric.eigen.median(x) ## End(Not run)
Calculate the eigenvalue centrality score of a graph.
metric.eigen.value(g)
metric.eigen.value(g)
g |
The input network. |
metric.eigen.value
calculates the eigenvalue centrality score of graph g.
A real constant.
Xu Dong, Nazrul Shaikh.
Bonacich, Phillip, and Paulette Lloyd. "Eigenvector-like measures of centrality for asymmetric relations." Social networks 23, no. 3 (2001): 191-201.
Borgatti, Stephen P. "Centrality and network flow." Social networks 27, no. 1 (2005): 55-71.
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) metric.eigen.value(x) ## End(Not run)
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) metric.eigen.value(x) ## End(Not run)
Calculate the density of a graph.
metric.graph.density(g)
metric.graph.density(g)
g |
The input network. |
Computes the ratio of the number of edges and the number of possible edges.
A real constant.
Xu Dong, Nazrul Shaikh.
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) metric.graph.density(x) ## End(Not run)
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) metric.graph.density(x) ## End(Not run)
Present all neighbors of a give agent in a network.
neighbors(net, node)
neighbors(net, node)
net |
The input network. |
node |
The input node. |
Neighbors of a node are nodes that directly connects to this node.
A vector.
Xu Dong, Nazrul Shaikh.
## Not run: x <- net.ring.lattice(12,4) neighbors(x,2) ## End(Not run)
## Not run: x <- net.ring.lattice(12,4) neighbors(x,2) ## End(Not run)
Simulate a scale-free network using a preferential attachment mechanism (Barabasi and Albert, 1999)
net.barabasi.albert(n, m, ncores = detectCores(), d = FALSE)
net.barabasi.albert(n, m, ncores = detectCores(), d = FALSE)
n |
Number of nodes of the network. |
m |
Number of nodes to which a new node connects at each iteration. |
ncores |
Number of cores, by default |
d |
A logical value determining whether the generated network is a directed or undirected (default) network. |
Starting with m nodes, the preferential attachment mechaism adds one node and m edges in each step. The edges will be placed with one end on the newly-added node and the other end on the existing nodes, according to probabilities that associate with their current degrees.
A list containing the nodes of the network and their respective neighbors.
Luis Castro, Xu Dong, Nazrul Shaikh.
Barabasi, A.- L. and Albert R. 1999. Emergence of scaling in random networks. Science, 286 509-512.
## Not run: x <- net.barabasi.albert(1000, 20) # using default ncores ## End(Not run)
## Not run: x <- net.barabasi.albert(1000, 20) # using default ncores ## End(Not run)
Simulate a (connected) caveman network of m cliques of size k.
net.caveman(m, k, ncores = detectCores())
net.caveman(m, k, ncores = detectCores())
m |
Number of cliques (or caves) in the network. |
k |
Number of nodes per clique. |
ncores |
Number of cores, by default |
The (connected) caveman network is formed by connecting a set of isolated k - cliques
(or "caves"), neighbor by neighbor and head to toe, using one edge that removed from each
clique such that all m cliques form a single circle (Watts 1999). The total number of nodes, i.e. n, in this network is given by .
A list containing the nodes of the network and their respective neighbors.
Xu Dong, Nazrul Shaikh.
Watts, D. J. Networks, Dynamics, and the Small-World Phenomenon. Amer. J. Soc. 105, 493-527, 1999.
## Not run: x <- net.caveman(50, 20) #using ncores by default ## End(Not run)
## Not run: x <- net.caveman(50, 20) #using ncores by default ## End(Not run)
Simulate a complete (or full) network.
net.complete(n, ncores = detectCores())
net.complete(n, ncores = detectCores())
n |
Number of nodes of the network. |
ncores |
Number of cores, by default |
The n nodes in the network are fully connected.
Note that the input n should not excess 10000, for the sake of memory overflow.
A list containing the nodes of the network and their respective neighbors.
Xu Dong, Nazrul Shaikh.
## Not run: x <- net.complete(1000) #using ncores by default ## End(Not run)
## Not run: x <- net.complete(1000) #using ncores by default ## End(Not run)
network using a fix edge size.Simulate a random network with n nodes and m edges, according to Erdos and Renyi (1959).
net.erdos.renyi.gnm(n, m, ncores = detectCores(), d = TRUE)
net.erdos.renyi.gnm(n, m, ncores = detectCores(), d = TRUE)
n |
Number of nodes of the network. |
m |
Number of edges of the network. |
ncores |
Number of cores, by default |
d |
A logical value determining whether is a network directed (default) or indirected. |
In this (simplest) random network, m edges are formed at random among n nodes.
When d = TRUE
is a directed network.
A list containing the nodes of the network and their respective neighbors.
Xu Dong, Nazrul Shaikh.
Erdos, P. and Renyi, A., On random graphs, Publicationes Mathematicae 6, 290-297 (1959).
## Not run: x <- net.erdos.renyi.gnm(1000, 100) ## End(Not run)
## Not run: x <- net.erdos.renyi.gnm(1000, 100) ## End(Not run)
networkSimulate a random network with n nodes and a link connecting probability of p, according to Edos and Renyi (1959).
net.erdos.renyi.gnp(n, p, ncores = detectCores(), d = TRUE)
net.erdos.renyi.gnp(n, p, ncores = detectCores(), d = TRUE)
n |
Number of nodes of the network. |
p |
Connecting probability. |
ncores |
Number of cores, by default |
d |
A logical value determining whether is a network directed (default) or indirected. |
In this (simplest) random network, each edge is formed at random with a constant probability.
When d = TRUE
is a directed network.
A list containing the nodes of the network and their respective neighbors.
Luis Castro, Xu Dong, Nazrul Shaikh.
Erdos, P. and Renyi, A., On random graphs, Publicationes Mathematicae 6, 290-297 (1959).
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) ## End(Not run)
## Not run: x <- net.erdos.renyi.gnp(1000, 0.01) ## End(Not run)
Simulate a scale-free network with relatively high clustering, comparing to B-A networks (Holme and Kim, 1999).
net.holme.kim(n, m, pt)
net.holme.kim(n, m, pt)
n |
Number of nodes of the network. |
m |
Number of nodes to which a new node connects at each iteration. |
pt |
Triad formation probability after each preferential attachment mechanism. |
The Holme-Kim network model is a simple extension of B-A model. It adds an additional step, called "Triad formation", with the probability pt that compensates the low clustering in B-A networks.
A list containing the nodes of the network and their respective neighbors.
Xu Dong, Nazrul Shaikh
Holme, Petter, and Beom Jun Kim. "Growing scale-free networks with tunable clustering."Physical review E65, no. 2 (2002): 026107.
## Not run: x <- net.holme.kim (1000, 20, 0.1) ## End(Not run)
## Not run: x <- net.holme.kim (1000, 20, 0.1) ## End(Not run)
Simulate a random network with a power-law degree distribution that has an exponential cutoff, according to Newman et al. (2001).
net.random.plc(n, cutoff, exponent)
net.random.plc(n, cutoff, exponent)
n |
The number of the nodes in the network. |
cutoff |
Exponential cutoff of the degree distribution of the network. |
exponent |
Exponent of the degree distribution of the network. |
The generated random network has a power-law degree distribution with an exponential degree cutoff.
A list containing the nodes of the network and their respective neighbors.
Xu Dong, Nazrul Shaikh
Newman, Mark EJ, Steven H. Strogatz, and Duncan J. Watts. "Random graphs with arbitrary degree distributions and their applications." Physical review E 64, no. 2 (2001): 026118.
## Not run: x <- net.random.plc(1000, 10, 2) ## End(Not run)
## Not run: x <- net.random.plc(1000, 10, 2) ## End(Not run)
Simulate a rewired caveman network of m cliques of size k, and with a link rewiring probability p.
net.rewired.caveman(nc, m, p)
net.rewired.caveman(nc, m, p)
nc |
Number of cliques (or caves) in the network. |
m |
Number of nodes per clique. |
p |
Link rewiring probability. |
The rewired caveman network is built on the corresponding regular caveman network with m cliques of size k. Then the links in this caveman network are rewired with probability p.
A list containing the nodes of the network and their respective neighbors.
Xu Dong, Nazrul Shaikh
Watts, D. J. Networks, Dynamics, and the Small-World Phenomenon. Amer. J. Soc. 105, 493-527, 1999.
## Not run: x <- net.rewired.caveman(50, 20, 0.0005) ## End(Not run)
## Not run: x <- net.rewired.caveman(50, 20, 0.0005) ## End(Not run)
Simulate a network with a k -regular ring lattice structure.
net.ring.lattice(n, k)
net.ring.lattice(n, k)
n |
Number of nodes in the network. |
k |
Number of edges per node. |
The n nodes are placed on a circle and each node is connected to the nearest k neighbors.
A list containing the nodes of the network and their respective neighbors.
Xu Dong, Nazrul Shaikh
Duncan J Watts and Steven H Strogatz: Collective dynamics of 'small world' networks, Nature 393, 440-442, 1998.
## Not run: x <- net.ring.lattice(1000, 10) ## End(Not run)
## Not run: x <- net.ring.lattice(1000, 10) ## End(Not run)
Simulate a small-world network according to the model of Watts and Strogatz (1998).
net.watts.strogatz(n, k, re)
net.watts.strogatz(n, k, re)
n |
The number of the nodes in the network (or lattice). |
k |
Number of edges per node. |
re |
Rewiring probability. |
The formation of Watts-Strogatz network starts with a ring lattice with n nodes and k edges per node, then each edge is rewired at random with probability re.
A list containing the nodes of the network and their respective neighbors.
Xu Dong, Nazrul Shaikh
Duncan J. Watts and Steven H. Strogatz: Collective dynamics of 'small world' networks, Nature 393, 440-442, 1998.
## Not run: x <- net.watts.strogatz(1000, 10, 0.05) ## End(Not run)
## Not run: x <- net.watts.strogatz(1000, 10, 0.05) ## End(Not run)
Present the first 10 degrees of a network.
preview.deg(g)
preview.deg(g)
g |
The input network. |
Present the first 10 degrees of a network.
A vector.
Xu Dong, Nazrul Shaikh.
## Not run: x <- net.ring.lattice(12,4) preview.deg(x) ## End(Not run)
## Not run: x <- net.ring.lattice(12,4) preview.deg(x) ## End(Not run)
Present the first 10 ego-centric lists of a network.
preview.net(net)
preview.net(net)
net |
The input network. |
the connection condition of the first 10 nodes in a network.
A list.
Xu Dong, Nazrul Shaikh.
## Not run: x <- net.ring.lattice(12,4) preview.net(x) ## End(Not run)
## Not run: x <- net.ring.lattice(12,4) preview.net(x) ## End(Not run)