make_ring: Create a ring graph

Description Usage Arguments Value See Also Examples

View source: R/make.R

Description

A ring is a one-dimensional lattice and this function is a special case of make_lattice.

Usage

1
2
3
make_ring(n, directed = FALSE, mutual = FALSE, circular = TRUE)

ring(...)

Arguments

n

Number of vertices.

directed

Whether the graph is directed.

mutual

Whether directed edges are mutual. It is ignored in undirected graphs.

circular

Whether to create a circular ring. A non-circular ring is essentially a “line”: a tree where every non-leaf vertex has one child.

...

Passed to make_ring.

Value

An igraph graph.

See Also

Other determimistic constructors: graph_from_atlas(), graph_from_edgelist(), graph_from_literal(), make_chordal_ring(), make_empty_graph(), make_full_citation_graph(), make_full_graph(), make_graph(), make_lattice(), make_star(), make_tree()

Examples

1
2
print_all(make_ring(10))
print_all(make_ring(10, directed = TRUE, mutual = TRUE))

Example output

Attaching package: 'igraph'

The following objects are masked from 'package:stats':

    decompose, spectrum

The following object is masked from 'package:base':

    union

IGRAPH f058c10 U--- 10 10 -- Ring graph
+ attr: name (g/c), mutual (g/l), circular (g/l)
+ edges from f058c10:
 [1] 1-- 2 2-- 3 3-- 4 4-- 5 5-- 6 6-- 7 7-- 8 8-- 9 9--10 1--10
IGRAPH f0b4420 D--- 10 20 -- Ring graph
+ attr: name (g/c), mutual (g/l), circular (g/l)
+ edges from f0b4420:
 [1]  1-> 2  1->10  2-> 3  2-> 1  3-> 4  3-> 2  4-> 5  4-> 3  5-> 6  5-> 4
[11]  6-> 7  6-> 5  7-> 8  7-> 6  8-> 9  8-> 7  9->10  9-> 8 10-> 1 10-> 9

igraph documentation built on March 19, 2020, 5:13 p.m.

Related to make_ring in igraph...