check_contiguity | R Documentation |
Given a zero-indexed adjacency list and an array of group identifiers, this
returns a tibble which identifies the connected components. The three columns
are group
for the inputted group, group_number
which uniquely identifies each
group as a positive integer, and component
which identifies the connected
component number for each corresponding entry of adjacency and group. If everything
is connected within the group, then each element of component
will be 1
.
Otherwise, the largest component is given the value 1
, the next largest 2
,
and so on.
check_contiguity(adj, group)
cct(adj, group)
ccm(adj, group)
adj |
adjacency list |
group |
array of group identifiers. Typically district numbers or county names. Defaults to 1 if no input is provided, checking that the adjacency list itself is one connected component. |
If nothing is provided to group, it will default to a vector of ones, checking if the adjacency graph is connected.
cct()
is shorthand for creating a table of the component values. If everything
is connected within each group, it returns a value of 1. In general, it returns
a frequency table of components.
ccm()
is shorthand for getting the maximum component value. It returns the
maximum number of components that a group is broken into.
This returns 1 if each group is connected. #'
tibble with a column for each of inputted group, created group number, and the identified connected component number
data(checkerboard)
adj <- adjacency(checkerboard)
# These each indicate the graph is connected.
check_contiguity(adj)
cct(adj)
ccm(adj)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.