@@ -1287,42 +1287,26 @@ layout_with_dh <- function(
12871287 weight.edge.crossings = 1.0 - sqrt(edge_density(graph )),
12881288 weight.node.edge.dist = 0.2 * (1 - edge_density(graph ))
12891289) {
1290- # Argument checks
1291- ensure_igraph(graph )
1292- if (! is.null(coords )) {
1293- coords [] <- as.numeric(coords )
1294- use.seed <- TRUE
1295- } else {
1290+ if (is.null(coords )) {
12961291 coords <- matrix (NA_real_ , ncol = 2 , nrow = 0 )
12971292 use.seed <- FALSE
1293+ } else {
1294+ use.seed <- TRUE
12981295 }
1299- maxiter <- as.numeric(maxiter )
1300- fineiter <- as.numeric(fineiter )
1301- cool.fact <- as.numeric(cool.fact )
1302- weight.node.dist <- as.numeric(weight.node.dist )
1303- weight.border <- as.numeric(weight.border )
1304- weight.edge.lengths <- as.numeric(weight.edge.lengths )
1305- weight.edge.crossings <- as.numeric(weight.edge.crossings )
1306- weight.node.edge.dist <- as.numeric(weight.node.edge.dist )
13071296
1308- on.exit(.Call(R_igraph_finalizer ))
1309- # Function call
1310- res <- .Call(
1311- R_igraph_layout_davidson_harel ,
1312- graph ,
1313- coords ,
1314- use.seed ,
1315- maxiter ,
1316- fineiter ,
1317- cool.fact ,
1318- weight.node.dist ,
1319- weight.border ,
1320- weight.edge.lengths ,
1321- weight.edge.crossings ,
1322- weight.node.edge.dist
1297+ layout_davidson_harel_impl(
1298+ graph = graph ,
1299+ res = coords ,
1300+ use_seed = use.seed ,
1301+ maxiter = maxiter ,
1302+ fineiter = fineiter ,
1303+ cool_fact = cool.fact ,
1304+ weight_node_dist = weight.node.dist ,
1305+ weight_border = weight.border ,
1306+ weight_edge_lengths = weight.edge.lengths ,
1307+ weight_edge_crossings = weight.edge.crossings ,
1308+ weight_node_edge_dist = weight.node.edge.dist
13231309 )
1324-
1325- res
13261310}
13271311
13281312
@@ -1596,35 +1580,22 @@ layout_with_gem <- function(
15961580 temp.min = 1 / 10 ,
15971581 temp.init = sqrt(max(vcount(graph ), 1 ))
15981582) {
1599- # Argument checks
1600- ensure_igraph(graph )
1601- if (! is.null(coords )) {
1602- coords [] <- as.numeric(coords )
1603- use.seed <- TRUE
1604- } else {
1583+ if (is.null(coords )) {
16051584 coords <- matrix (NA_real_ , ncol = 2 , nrow = 0 )
16061585 use.seed <- FALSE
1586+ } else {
1587+ use.seed <- TRUE
16071588 }
16081589
1609- maxiter <- as.numeric(maxiter )
1610- temp.max <- as.numeric(temp.max )
1611- temp.min <- as.numeric(temp.min )
1612- temp.init <- as.numeric(temp.init )
1613-
1614- on.exit(.Call(R_igraph_finalizer ))
1615- # Function call
1616- res <- .Call(
1617- R_igraph_layout_gem ,
1618- graph ,
1619- coords ,
1620- use.seed ,
1621- maxiter ,
1622- temp.max ,
1623- temp.min ,
1624- temp.init
1590+ layout_gem_impl(
1591+ graph = graph ,
1592+ res = coords ,
1593+ use_seed = use.seed ,
1594+ maxiter = maxiter ,
1595+ temp_max = temp.max ,
1596+ temp_min = temp.min ,
1597+ temp_init = temp.init
16251598 )
1626-
1627- res
16281599}
16291600
16301601
@@ -2304,34 +2275,15 @@ layout_with_sugiyama <- function(
23042275 weights = NULL ,
23052276 attributes = c(" default" , " all" , " none" )
23062277) {
2307- # Argument checks
2308- ensure_igraph(graph )
2309- if (! is.null(layers )) {
2310- layers <- as.numeric(layers ) - 1
2311- }
2312- hgap <- as.numeric(hgap )
2313- vgap <- as.numeric(vgap )
2314- maxiter <- as.numeric(maxiter )
2315- if (is.null(weights ) && " weight" %in% edge_attr_names(graph )) {
2316- weights <- E(graph )$ weight
2317- }
2318- if (! is.null(weights ) && any(! is.na(weights ))) {
2319- weights <- as.numeric(weights )
2320- } else {
2321- weights <- NULL
2322- }
23232278 attributes <- igraph_match_arg(attributes )
23242279
2325- on.exit(.Call(R_igraph_finalizer ))
2326- # Function call
2327- res <- .Call(
2328- R_igraph_layout_sugiyama ,
2329- graph ,
2330- layers ,
2331- hgap ,
2332- vgap ,
2333- maxiter ,
2334- weights
2280+ res <- layout_sugiyama_impl(
2281+ graph = graph ,
2282+ layers = layers ,
2283+ hgap = hgap ,
2284+ vgap = vgap ,
2285+ maxiter = maxiter ,
2286+ weights = weights
23352287 )
23362288
23372289 # Flip the y coordinates, more natural this way
0 commit comments