Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

is.connected

Is a Given Graph Connected?


Description

Returns TRUE iff the specified graphs are connected.

Usage

is.connected(g, connected = "strong", comp.dist.precomp = NULL)

Arguments

g

one or more input graphs.

connected

definition of connectedness to use; must be one of "strong", "weak", "unilateral", or "recursive".

comp.dist.precomp

a component.dist object precomputed for the graph to be analyzed (optional).

Details

is.connected determines whether the elements of g are connected under the definition specified in connected. (See component.dist for details.) Since is.connected is really just a wrapper for component.dist, an object created with the latter can be supplied (via comp.dist.precomp) to speed computation.

Value

TRUE iff g is connected, otherwise FALSE

Author(s)

Carter T. Butts buttsc@uci.edu

References

West, D.B. (1996). Introduction to Graph Theory. Upper Saddle River, N.J.: Prentice Hall.

See Also

Examples

#Generate two graphs:
g1<-rgraph(10,tp=0.1)
g2<-rgraph(10)

#Check for connectedness
is.connected(g1)  #Probably not
is.connected(g2)  #Probably so

sna

Tools for Social Network Analysis

v2.6
GPL (>= 2)
Authors
Carter T. Butts [aut, cre, cph]
Initial release
2020-10-5

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.