make_star: Create a star graph, a tree with n vertices and n - 1 leaves

Description Usage Arguments Value See Also Examples

View source: R/make.R

Description

star creates a star graph, in this every single vertex is connected to the center vertex and nobody else.

Usage

1
2
3
make_star(n, mode = c("in", "out", "mutual", "undirected"), center = 1)

star(...)

Arguments

n

Number of vertices.

mode

It defines the direction of the edges, in: the edges point to the center, out: the edges point from the center, mutual: a directed star is created with mutual edges, undirected: the edges are undirected.

center

ID of the center vertex.

...

Passed to make_star.

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_ring(), make_tree()

Examples

1
2
make_star(10, mode = "out")
make_star(5, mode = "undirected")

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 0b00000 D--- 10 9 -- Out-star
+ attr: name (g/c), mode (g/c), center (g/n)
+ edges from 0b00000:
[1] 1-> 2 1-> 3 1-> 4 1-> 5 1-> 6 1-> 7 1-> 8 1-> 9 1->10
IGRAPH 0600000 U--- 5 4 -- Star
+ attr: name (g/c), mode (g/c), center (g/n)
+ edges from 0600000:
[1] 1--2 1--3 1--4 1--5

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

Related to make_star in igraph...