graph :: Digraph :: predecessors
u
.If u
does not exist, then it returns null.
var g = new HashDigraph[Int]
g.add_arc(0, 1)
g.add_arc(1, 2)
g.add_arc(0, 2)
assert g.predecessors(2).has(0)
assert g.predecessors(2).has(1)
assert not g.predecessors(2).has(2)
# Returns the predecessors of `u`.
#
# If `u` does not exist, then it returns null.
#
# ~~~
# var g = new HashDigraph[Int]
# g.add_arc(0, 1)
# g.add_arc(1, 2)
# g.add_arc(0, 2)
# assert g.predecessors(2).has(0)
# assert g.predecessors(2).has(1)
# assert not g.predecessors(2).has(2)
# ~~~
fun predecessors(u: V): Collection[V] is abstract
lib/graph/digraph.nit:200,2--213,50
redef fun predecessors(u): Array[V]
do
if incoming_vertices_map.keys.has(u) then
return incoming_vertices_map[u].clone
else
return new Array[V]
end
end
lib/graph/digraph.nit:1003,2--1010,4
# Returns the predecessors 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.predecessors(2).has(1)
# assert g.predecessors(2).has(2)
# ~~~
redef fun predecessors(u)
do
var super_predecessors = super
if incoming_vertices_map.has_key(u) then super_predecessors.add(u)
return super_predecessors
end
lib/graph/digraph.nit:1116,2--1133,4