networks
ancestor
finds ancestors in a directed tree
Calling Sequence
Parameters
Description
Examples
ancestor(v, G)
ancestor(G)
G

graph or network
v
vertex or set of vertices
Important: The networks package has been deprecated. Use the superseding package GraphTheory instead.
Given a vertex v this routine reports the set of known ancestors of v in the graph G. Such relationships are not always present in a give graph but are explicitly established by routines such as spantree() and shortpathtree(). Routines such as path() rely on this information when looking for paths and will return FAIL if it is not present.
If only the graph is mentioned then the actual ancestor table indexed by vertices and specifying all known ancestors in G is returned. Modifications to this table affect the actual graph.
In the two argument case, the first argument v may also be a set of vertices in which case the result is the set of ancestors of the subgraph induced by v in G (ie. (the union of the ancestors of each vertex in v minus the vertices in v).
The implementation of ancestor and daughter is completely separate from that of directed edges.
This routine is normally loaded via the command with(networks) but may also be referenced using the full name networks[ancestor](...).
$\mathrm{with}\left(\mathrm{networks}\right)\:$
$G\u2254\mathrm{petersen}\left(\right)\:$
$\mathrm{ancestor}\left(1\,G\right)$
${\varnothing}$
$T\u2254\mathrm{shortpathtree}\left(G\,1\right)\:$
$\mathrm{ancestor}\left(8\,T\right)$
$\left\{{2}\right\}$
$\mathrm{daughter}\left(1\,T\right)$
$\left\{{2}{\,}{5}{\,}{6}\right\}$
$\mathrm{tbl}\u2254\mathrm{ancestor}\left(T\right)$
${\mathrm{tbl}}{\u2254}{table}{}\left(\left[{2}{=}\left\{{1}\right\}{\,}{3}{=}\left\{{2}\right\}{\,}{4}{=}\left\{{5}\right\}{\,}{5}{=}\left\{{1}\right\}{\,}{6}{=}\left\{{1}\right\}{\,}{7}{=}\left\{{6}\right\}{\,}{9}{=}\left\{{5}\right\}{\,}{8}{=}\left\{{2}\right\}{\,}{10}{=}\left\{{6}\right\}\right]\right)$
$\mathrm{path}\left(\left[9\,1\right]\,T\right)$
${\mathrm{FAIL}}$
See Also
GraphTheory
networks(deprecated)[daughter]
networks(deprecated)[path]
networks(deprecated)[shortpathtree]
with
Download Help Document
What kind of issue would you like to report? (Optional)