# Create the connected graph matrix:
x <- matrix(
data = c(
0, 1, 0, 0, 1, 0,
1, 0, 1, 0, 1, 0,
0, 1, 0, 1, 0, 0,
0, 0, 1, 0, 1, 1,
1, 1, 0, 1, 0, 0,
0, 0, 0, 1, 0, 0
),
ncol = 6,
byrow = TRUE
)
# Check graph is connected:
is_graph_connected(adjacency_matrix = x)
Run the code above in your browser using DataLab