These functions implement logical tests for various network properties.
All is_*() functions return a logical scalar (TRUE or FALSE).
is_twomode() marks networks TRUE if they contain two sets of nodes.
is_multilevel() marks networks TRUE if they contain two or more levels
of nodes that are tied both within and between levels.
is_hypergraph() marks networks TRUE if they hold hyperedges,
which are ties among any number of nodes.
is_labelled() marks networks TRUE if there is a 'names' attribute
for the nodes.
is_attributed() marks networks TRUE if there are other nodal attributes
than 'names' or 'type'.
is_spatial() marks networks TRUE if the nodes have positions,
that is a pair of numeric nodal attributes called 'x' and 'y',
or 'lat' and 'lon' ('long', 'lng'), or 'latitude' and 'longitude'.
A position may also have a height,
called 'z', 'elevation', 'altitude', or 'alt',
though it takes no height to be spatial.
Note that this is all a network records of a position,
so a network read with the positions of a layout,
such as one exported from Gephi, is marked spatial too.
is_egolist() marks TRUE a list of networks, one for each node of a
network, as to_egos() returns. Unlike the other marks here, it marks a
list and not a network, so a single network is always FALSE.
is_twomode(.data)
is_multilevel(.data)
is_hypergraph(.data)
is_labelled(.data)
is_attributed(.data)
is_spatial(.data)
is_egolist(.data)An object of a {manynet}-consistent class:
adjacency or incidence matrix from {base} R
edgelist data.frame from {base} R or tbl/tbl_df from {tibble}
stocnet stocnet, from the {manynet} package
igraph igraph, from the {igraph} package
network network, from the {network} package
tidygraph tbl_graph, from the {tidygraph} package
Not all functions have methods available for all object classes. Below are the currently implemented S3 methods for these functions:
data.frame default igraph list matrix network numeric stocnet
is_attributed *
is_egolist *
is_labelled * * * * * * *
is_multilevel * * * *
is_spatial *
is_twomode * * * * * * * *
tbl_graph
is_attributed
is_egolist
is_labelled *
is_multilevel *
is_spatial
is_twomode *If a method is not available for a particular class, but a default method is, the default method will attempt to coerce the object to a class for which a method is defined, and then coerce the output back to the original class. If no method is available for any class, an error will be thrown.
A multilevel network is one in which the nodes belong to two or more
levels, or nodesets, that are tied not only to each other but also among
themselves. fict_marvel, for instance, interlocks a one-mode layer of
ties among its characters with a two-mode layer of affiliations between
those characters and their teams. Such networks are distinguished from
plain two-mode networks, such as ison_southern_women, in which ties
run only between the two nodesets and never within them.
Other marks:
mark_format_change,
mark_format_cognitive,
mark_format_tie
is_twomode(create_filled(c(2,2)))
#> [1] TRUE
is_multilevel(fict_marvel)
#> [1] TRUE
is_multilevel(ison_southern_women)
#> [1] FALSE
is_hypergraph(create_empty(3))
#> [1] FALSE
is_labelled(create_empty(3))
#> [1] FALSE
is_attributed(ison_algebra)
#> [1] FALSE
is_spatial(ison_algebra)
#> [1] FALSE
is_spatial(mutate_nodes(create_ring(4), x = c(0, 1, 1, 0), y = c(0, 0, 1, 1)))
#> [1] TRUE
is_egolist(to_egos(ison_adolescents))
#> [1] TRUE