graph :: Digraph :: successors
u
.If u
does not exist, then an empty collection is returned.
var g = new HashDigraph[Int]
g.add_arc(0, 1)
g.add_arc(1, 2)
g.add_arc(0, 2)
assert not g.successors(0).has(0)
assert g.successors(0).has(1)
assert g.successors(0).has(2)
# Returns the successors of `u`.
#
# If `u` does not exist, then an empty collection is returned.
#
# ~~~
# var g = new HashDigraph[Int]
# g.add_arc(0, 1)
# g.add_arc(1, 2)
# g.add_arc(0, 2)
# assert not g.successors(0).has(0)
# assert g.successors(0).has(1)
# assert g.successors(0).has(2)
# ~~~
fun successors(u: V): Collection[V] is abstract
lib/graph/digraph.nit:215,2--228,48
redef fun successors(u): Array[V]
do
if outgoing_vertices_map.keys.has(u) then
return outgoing_vertices_map[u].clone
else
return new Array[V]
end
end
lib/graph/digraph.nit:1012,2--1019,4
# Returns the successors of `u`.
#
# `u` is include in the returned collection
#
# ~~~
# var g = new ReflexiveHashDigraph[Int]
# g.add_arc(1, 2)
# g.add_arc(2, 3)
# g.add_arc(3, 1)
# assert g.successors(2).has(3)
# assert g.successors(2).has(2)
# ~~~
redef fun successors(u: V)
do
var super_successors = super
if outgoing_vertices_map.has_key(u) then super_successors.add(u)
return super_successors
end
lib/graph/digraph.nit:1135,2--1152,4