isReachable -- checks if a vertex u is reachable from a vertex v
Synopsis
Usage:
r = isReachable(D, u, v)
Inputs:
D, an object of class Digraph (missing documentation)
u, a thing, this is the vertex that we are attempting to reach
v, a thing, this is the vertex that we are starting from
Outputs:
r, a Boolean value, whether or not us is reachable from v
Description
In a Digraph D, a vertex u of D is reachable from another vertex v of D if u is a descendant of v. Alternatively, u is reachable from v if there is some set of vertices u0, ... , un such that un = u and u0 = v and (ui, ui+1) is and edge of D for all i from 0 to n-1.
i1 : D = digraph({a,b,c,d,e},{{a,b},{b,c},{b,d},{e,b}});
i2 : isReachable(D, e, a)
o2 = false
i3 : isReachable(D, d, e)
o3 = true
See also
descendants -- returns the descendants of a digraph
forefathers -- returns the forefathers of a digrah