# sources -- returns the sources of a digraph

## Synopsis

• Usage:
L = sources D
• Inputs:
• D, an instance of the type Digraph, digraph whose sources we are searching for
• Outputs:
• L, a list, list of all the sources (if there are any)

## Description

A source of a Digraph D is a vertex of D that has no parents. That is, v is a source of D if and only if there are only edges pointing from v; none can be pointing into v (there is no edge of the form (v,u)).

 i1 : D = digraph({a,b,c,d,e},{{a,b},{b,c},{b,d},{e,b}}); i2 : sources D o2 = {a, e} o2 : List

• sinks -- returns the sinks of a digraph
• isSource -- determines if a vertex of a digraph is a source or not

## Ways to use sources :

• "sources(Digraph)"

## For the programmer

The object sources is .