| rank | R Documentation |
calculate the rank of any subset of a matroid, or determine whether any subset is independent
rank( x, subs )
is_independent( x, subs )
x |
a matroid object, as returned from the constructor |
subs |
a list of integer vectors, representing subsets of the ground set of |
rank(x,subs) returns an integer vector with the same length
as the list subs.
The i'th value is the rank of the i'th set in subs.
If a set is not a subset of the ground set of x, the value is NA, and a warning message is printed.
is_independent(x,subs) returns a logical vector with the same length
as the list subs.
The i'th value is the independence of i'th set in x.
It is equal to TRUE iff the rank of the subset is equal to
the cardinality of the subset.
For both functions the names are copied from input to output.
Matroid - Wikipedia. https://en.wikipedia.org/w/index.php?title=Matroid&oldid=1086234057
matroid()
# make a matroid with rank 3
mat = matroid( classics.genlist[['RT']] )
# the ground set itself should have rank 3
rank( mat, getground(mat) )
## [1] 3
# single points should have rank 1 (there are no loops)
rank( mat, as.list(getground(mat)) )
## [1] 1 1 1 1 1 1
# all hyperplanes should have rank 2
rank( mat, gethyperplane(mat) )
## [1] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
# a point not in the ground set should have rank NA
# and the emtpy set should have rank 0
rank( mat, list(100L,integer(0)) )
## 1 of 1 subsets are not a subset of ground.
## [1] NA 0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.