addEdges: Add edges to graph.

Description Usage Arguments Value References See Also Examples

Description

This method allows to add edges to a grapherator graph. The method can be applied multiple times with different parameterizations. E.g., add edges in clusters first and add edges between clusters in a second step.

Usage

1
2
addEdges(graph, generator, type = "all", k = NULL, cluster.ids = NULL,
  ...)

Arguments

graph

[grapherator]
Graph.

generator

[function(graph, ...)]
Method applied to graph in order to determine which edges to add.

type

[character(1)]
Value “all” applies generator to all nodes. Value “intracluster” instead applies the method for each cluster seperately. Value “intercluster” selects each k nodes from each cluster and applies generator to the union. Lastly, value “intercenter” selects the cluster centers exclusively. Default is “all”.

k

[integer | NULL]
Integer vector specifying the number of nodes selected randomly from each cluster to be selected for edge construction. May be a scalar value or a vector of length graph$n.clusters. NAs are allowed and indicate clusters to be ignored.

cluster.ids

[integer | NULL]
Ignored unless type is not set to “intracluster”. Integer vector of cluster IDs. If NULL the generator is applied within each cluster.

...

[any]
Further arguments passed down to edge generator generator.

Value

[grapherator] Graph.

References

Erdos, P., and A. Renyi. 1959. "On random graphs, I." Publicationes Mathematicae (Debrecen) 6: 290-97.

Waxman, B. M. 1988. "Routing of Multipoint Connections."" IEEE Journal on Selected Areas in Communications 6 (9): 1617-22. doi:10.1109/49.12889.

Knowles, J. D., and D. W. Corne. 2001. "Benchmark Problem Generators and Results for the Multiobjective Degree-Constrained Minimum Spanning Tree Problem." In Proceedings of the 3rd Annual Conference on Genetic and Evolutionary Computation, 424-31. GECCO'01. San Francisco, CA, USA: Morgan Kaufmann Publishers Inc.

See Also

Other graph generators: addNodes, addWeights, graph

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
g = graph(0, 1000)
g = addNodes(g, n = 5, generator = addNodesLHS)
g = addNodes(g, n = c(3, 10, 20, 10, 40), by.centers = TRUE, generator = addNodesUniform,
  lower = c(0, 0), upper = c(30, 30))
# user different edge generators for clusters
g = addEdges(g, generator = addEdgesDelauney, type = "intracluster", cluster.ids = 1:3)
g = addEdges(g, generator = addEdgesSpanningTree, type = "intracluster", cluster.ids = 4:5)
# link cluster centers
g = addEdges(g, generator = addEdgesSpanningTree, runs = 2, type = "intercenter")
# additional random links between each 2 nodes from each cluster
g = addEdges(g, generator = addEdgesGilbert, p = 0.4, type = "intercluster", k = 2)

grapherator documentation built on May 1, 2019, 8:19 p.m.