Skip to contents

Create a full graph

Usage

make_full_graph(n, directed = FALSE, loops = FALSE)

full_graph(n, directed = FALSE, loops = FALSE)

Arguments

n

Number of vertices.

directed

Whether to create a directed graph.

loops

Whether to add self-loops to the graph.

Value

An igraph graph

full()

Examples

make_full_graph(5)
#> ── <igraph> Full graph ────────────────────────────────────────────── a167541 ──
#>  undirected
#>  5 vertices · 10 edges
#> 
#> ── Attributes ──────────────────────────────────────────────────────────────────
#> → graph:  name <chr>, loops <lgl>
#> 
#> ── Edges ───────────────────────────────────────────────────────────────────────
#>  [1] 1 ─ 2  1 ─ 3  1 ─ 4  1 ─ 5  2 ─ 3  2 ─ 4  2 ─ 5  3 ─ 4  3 ─ 5  4 ─ 5 
print_all(make_full_graph(4, directed = TRUE))
#> ── <igraph> Full graph ────────────────────────────────────────────── 682a5fb ──
#>  directed
#>  4 vertices · 12 edges
#> 
#> ── Attributes ──────────────────────────────────────────────────────────────────
#> → graph:  name <chr>, loops <lgl>
#> 
#> ── Graph attributes ────────────────────────────────────────────────────────────
#> name:
#>   [1] "Full graph"
#> loops:
#>   [1] FALSE
#> 
#> ── Edges ───────────────────────────────────────────────────────────────────────
#>  [1] 1 → 2  1 → 3  1 → 4  2 → 1  2 → 3  2 → 4  3 → 1  3 → 2  3 → 4  4 → 1 
#> [11] 4 → 2  4 → 3