Skip to content

Commit f96db77

Browse files
committed
Merge branch 'main' (early part) into next
2 parents 6cf9bc8 + d24ad4b commit f96db77

36 files changed

+296
-38
lines changed

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,7 @@ export(topo_sort)
874874
export(topological.sort)
875875
export(traits)
876876
export(traits_callaway)
877+
export(transitive_closure)
877878
export(transitivity)
878879
export(tree)
879880
export(triad.census)

R/aaa-auto.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6756,6 +6756,7 @@ read_graph_pajek_impl <- function(
67566756
instream
67576757
) {
67586758
# Argument checks
6759+
check_string(instream)
67596760

67606761

67616762
on.exit(.Call(R_igraph_finalizer))
@@ -6773,6 +6774,8 @@ read_graph_graphml_impl <- function(
67736774
index = 0
67746775
) {
67756776
# Argument checks
6777+
check_string(instream)
6778+
67766779
index <- as.numeric(index)
67776780

67786781
on.exit(.Call(R_igraph_finalizer))
@@ -6791,6 +6794,8 @@ read_graph_graphdb_impl <- function(
67916794
directed = FALSE
67926795
) {
67936796
# Argument checks
6797+
check_string(instream)
6798+
67946799
directed <- as.logical(directed)
67956800

67966801
on.exit(.Call(R_igraph_finalizer))
@@ -6808,6 +6813,7 @@ read_graph_gml_impl <- function(
68086813
instream
68096814
) {
68106815
# Argument checks
6816+
check_string(instream)
68116817

68126818

68136819
on.exit(.Call(R_igraph_finalizer))
@@ -6825,6 +6831,8 @@ read_graph_dl_impl <- function(
68256831
directed = TRUE
68266832
) {
68276833
# Argument checks
6834+
check_string(instream)
6835+
68286836
directed <- as.logical(directed)
68296837

68306838
on.exit(.Call(R_igraph_finalizer))

R/topology.R

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,3 +1355,47 @@ automorphism_group <- function(
13551355
details = details
13561356
)
13571357
}
1358+
1359+
#' Transitive closure of a graph
1360+
#'
1361+
#' @description
1362+
#' `r lifecycle::badge("experimental")`
1363+
#'
1364+
#' Computes the transitive closure of a graph.
1365+
#' The resulting graph will have an edge from vertex \eqn{i} to vertex \eqn{j}
1366+
#' if \eqn{j} is reachable from \eqn{i} in the original graph.
1367+
#'
1368+
#' The transitive closure of a graph is a new graph where there is an edge
1369+
#' between any two vertices if there is a path between them in the original
1370+
#' graph.
1371+
#' For directed graphs, an edge from \eqn{i} to \eqn{j} is added if there is
1372+
#' a directed path from \eqn{i} to \eqn{j}.
1373+
#' For undirected graphs, this is equivalent to connecting all vertices that
1374+
#' are in the same connected component.
1375+
#'
1376+
#' @param graph The input graph.
1377+
#' It can be directed or undirected.
1378+
#' @return A new graph object representing the transitive closure.
1379+
#' The returned graph will have the same directedness as the input.
1380+
#' @author Fabio Zanini \email{fabio.zanini@@unsw.edu.au}
1381+
#' @seealso [distances()], [are_adjacent()]
1382+
#' @keywords graphs
1383+
#' @examples
1384+
#'
1385+
#' # Directed graph
1386+
#' g <- make_graph(c(1, 2, 2, 3, 3, 4))
1387+
#' tc <- transitive_closure(g)
1388+
#' # The closure has edges 1->2, 1->3, 1->4, 2->3, 2->4, 3->4
1389+
#' print_all(tc)
1390+
#'
1391+
#' # Undirected graph - connects all vertices in same component
1392+
#' g2 <- make_graph(c(1, 2, 3, 4), directed = FALSE)
1393+
#' tc2 <- transitive_closure(g2)
1394+
#' # Full graph on vertices 1, 2 and full graph on vertices 3, 4
1395+
#' print_all(tc2)
1396+
#' @family functions for manipulating graph structure
1397+
#' @export
1398+
#' @cdocs igraph_transitive_closure
1399+
transitive_closure <- function(graph) {
1400+
transitive_closure_impl(graph = graph)
1401+
}

man/add_edges.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/add_vertices.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/complementer.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/compose.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/contract.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/delete_edges.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/delete_vertices.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)