components {relations} | R Documentation |
Connected components
Description
Computes (strongly or weakly) connected components of an endorelation.
Usage
relation_connected_components(x, type = c("strongly", "weakly"))
relation_condensation(x)
relation_component_representation(x)
Arguments
x |
an R object inheriting from class |
type |
character string indicating the kind of components sought. |
Details
Let be the graph of an endorelation
.
A weakly connected component of some node in
is
the set of all nodes reachable from
. A strongly
connected component of some node
is the set of all nodes
reachable from
, from which
can be reached. Each
component is represented by some element, the leader.
The component representation graph of a cyclic endorelation
is composed of directed cycles, one for each strongly
connected component of
containing more than one element,
linking all corresponding elements.
The condensation of is the graph of all leaders of
.
Value
For relation_connected_components()
, an object of class
relation_classes_of_objects
, i.e., a list of sets giving the
elements of the corresponding connected components, named by the
leaders' character representation. The list of leaders is added as a
leaders
attribute.
For relation_condensation()
, an (acyclic) endorelation.
For relation_component_representation()
, an endorelation with
same domain as x
.
References
S. Warshall (1962), A theorem on Boolean matrices. Journal of the ACM, 9/1, 11–12. doi:10.1145/321105.321107.
J. A. La Poutré and J. van Leeuwen (1988), Maintenance of Transitive Closures and Transitive Reductions of Graphs. Proceedings of the International Workshop of Graph-Theoretic Concepts in Computer Science, Springer, London, 106–120.
See Also
plot.relation()
,
transitive_reduction()
Examples
## example from La Poutre and van Leeuwen:
require("sets") # set(), pair() etc.
G <- set(pair(1L, 2L), pair(2L, 1L), pair(1L, 3L), pair(3L, 1L),
pair(3L, 7L), pair(2L, 5L), pair(2L, 6L), pair(6L, 5L),
pair(5L, 7L), pair(4L, 6L), pair(5L, 4L), pair(4L, 7L))
R <- endorelation(graph = G)
relation_connected_components(R)
relation_graph(relation_condensation(R))
relation_graph(relation_component_representation(R))