anSets | R Documentation |
Find ancestral sets of a graph.
anSets(graph, topOrder, sort = 1)
anSets2(graph, topOrder, maxbarren, same_dist = FALSE, sort = 1)
graph |
object of class |
topOrder |
optional topological order of vertices |
sort |
integer:1 for unique but unsorted, 2 for sorted. |
maxbarren |
maximum size of barren subsets |
same_dist |
logical, should barren vertices be in the same district? |
Algorithm:
Find a topological order of nodes.
Base case: is ancestral
Induction: (i) Assume we have a list L of all ancestral sets involving Xi-1 in the order. (ii) If an ancestral set S in L contains all parents of Xi, Xi + S is also ancestral.
The function anSets2
proceeds by adding a new barren vertex to the
set, which is not a descendant of any existing vertices. It consequently
provides the option maxbarren
to cap this at a fixed value.
anSets2()
: Uses different algorithm
Ilya Shpitser
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.