|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": null, |
| 6 | + "metadata": {}, |
| 7 | + "outputs": [], |
| 8 | + "source": [ |
| 9 | + "#default_exp labelling.levels" |
| 10 | + ] |
| 11 | + }, |
| 12 | + { |
| 13 | + "cell_type": "markdown", |
| 14 | + "metadata": {}, |
| 15 | + "source": [ |
| 16 | + "# Topological levels\n", |
| 17 | + "> Defining topological levels, and describing their characteristics" |
| 18 | + ] |
| 19 | + }, |
| 20 | + { |
| 21 | + "cell_type": "markdown", |
| 22 | + "metadata": {}, |
| 23 | + "source": [ |
| 24 | + "### Definition of forward and backward topological levels" |
| 25 | + ] |
| 26 | + }, |
| 27 | + { |
| 28 | + "cell_type": "markdown", |
| 29 | + "metadata": {}, |
| 30 | + "source": [ |
| 31 | + "The **backward topological level** of a vertex $v$ (denoted as $l_v$) can be defined as its depth:\n", |
| 32 | + "- if $v$ has no immediate predecessors (has no outgoing edges, i.e. its out-degree is zero - it is a **_sink_**), \n", |
| 33 | + " then $l_v = 0$,\n", |
| 34 | + "- otherwise it is maximum of levels of its immediate predecessors plus one: \n", |
| 35 | + " $l_v = \\max\\limits_{u\\colon (v,u)\\in E}(l_u)+1$.\n", |
| 36 | + "\n", |
| 37 | + "In other words it is the maximum length of any path starting from vertex $v$.\n", |
| 38 | + "\n", |
| 39 | + "The backward topological level increases at least by one when going in the opposite direction to edges (going backwards).\n", |
| 40 | + "\n", |
| 41 | + "> Note: This reachability label is _immutable_ with respect to the graph growth by adding nodes." |
| 42 | + ] |
| 43 | + }, |
| 44 | + { |
| 45 | + "cell_type": "markdown", |
| 46 | + "metadata": {}, |
| 47 | + "source": [ |
| 48 | + "----" |
| 49 | + ] |
| 50 | + }, |
| 51 | + { |
| 52 | + "cell_type": "markdown", |
| 53 | + "metadata": {}, |
| 54 | + "source": [ |
| 55 | + "The **forward topological level** of a vertex $v$ (denoted as $L_v$) is defined in the following way:\n", |
| 56 | + "- if $v$ has no immediate parents / successors (it has no in-going edges, i.e. its in-degree is zero -- it is a **_source_**), \n", |
| 57 | + " then $L_v = 0$,\n", |
| 58 | + "- otherwise it is maximum of forward levels of its immediate successors plus one, \n", |
| 59 | + " that is $L_v = \\max\\limits_{u\\colon (u,v)\\in E}(L_u + 1)$\n", |
| 60 | + "\n", |
| 61 | + "In other words it is maximum length of any path ending at vertex $v$.\n", |
| 62 | + "\n", |
| 63 | + "The forward topological level increases by at least one when going in the direction of edge (going forwards)." |
| 64 | + ] |
| 65 | + }, |
| 66 | + { |
| 67 | + "cell_type": "markdown", |
| 68 | + "metadata": {}, |
| 69 | + "source": [ |
| 70 | + "The image below shows an example directed graph (DAG), marked with forward and backward topological levels (forward marked in green and backward marked in blue). This example is taken from the Figure 2 in the PReaCH paper.\n", |
| 71 | + "\n", |
| 72 | + "" |
| 73 | + ] |
| 74 | + } |
| 75 | + ], |
| 76 | + "metadata": { |
| 77 | + "kernelspec": { |
| 78 | + "display_name": "Python 3", |
| 79 | + "language": "python", |
| 80 | + "name": "python3" |
| 81 | + } |
| 82 | + }, |
| 83 | + "nbformat": 4, |
| 84 | + "nbformat_minor": 4 |
| 85 | +} |
0 commit comments