Directed graph

A directed graph/digraph denoted by $\overrightarrow{G}$ is a structure that contains some vertexes $V(\overrightarrow{G})$ and edges $E(\overrightarrow{G})$. Each edge $(u, v)$ is an ordered pair ($(u,v)\neq (v, u)$) of vertices where a tail $u$ is joined with a head $v$.

Vertices $V(\overrightarrow{G})$ and edges $E(\overrightarrow{G})$

$$ E(\overrightarrow{G})=\{\langle v1, v2\rangle\, \langle v1, v4\rangle\,...,\langle v3, v6\rangle\} $$

$$ V(\overrightarrow{G})=\{v_1, v_2, ..., v_6\} $$

Untitled

In/Out degree theorem

$$ \Sigma_{v\in V(\overrightarrow{G})}\delta_{in}(v)=\Sigma_{v\in V(\overrightarrow{G})}\delta_{out}(v)=|E(\overrightarrow{G})| $$

Plain English The sum of the degrees of all vertexes with a head connected to them is equal to the sum of all vertexes with a tail connected to them which is equal to the number of edges in the digraph $\overrightarrow{G}$.


Data structs

Adjacency list

The adjacency list of digraph $\overrightarrow{G}$ consists of an array $Adj$ of $|V|$ lists. Each list corresponds to one $v\in V(\overrightarrow{G})$ where for each $v$ we have $Adj[v]$ containing all $u$ such that there is an edge $(v, u)\in E(\overrightarrow{G})$.

Untitled

properties

Given a digraph $\overrightarrow{G}$ with $n$ vertexes and $m$ edges. Array $Adj(\overrightarrow{G})$ has size $n$. With a total number of nodes $m$. Thus its overall space is $n+m$

Adjacency Matrix

Given $\overrightarrow{G}$ the the adjacency-matrix of $\overrightarrow{G}$ is a $|V|\times|V|$ matrix $A=(a_{ij})$ such that $a_{ij}$= number of edges from $v_i$ to vertex $v_j$.

Untitled

properties

Memory requirements for $\overrightarrow{G}$ with $n$ vertexes

$n^2$

Generally not symmetric (can be symmetric though)

$A_{\overrightarrow{G}}[u, v]\neq A_{\overrightarrow{G}}[v, u]$

A digraph is called strict if ...