Table of Contents

Enum EdgeType

Namespace
Graphity
Assembly
Graphity.Core.dll

The type of an edge in a DFS (depth-first search), as EdgeTypes classifies the edges of a graph.

public enum EdgeType : byte

Fields

Tree = 0

An edge by which the search reaches its target for the first time: an edge of the forest.

Back = 1

An edge to an ancestor of its source in the DFS forest, or to the source itself. A graph has a cycle exactly when it has a back edge.

Forward = 2

An edge to a descendant of its source in the DFS forest, other than a tree edge.

Cross = 3

An edge between two nodes of which neither is an ancestor of the other in the DFS forest: the search had finished the target before it reached the source.

Remarks

A depth-first search through all nodes reaches each node once, either by a tree edge or as the root of a new search tree; the tree edges form the DFS forest. Every other edge gets its type from where its target lies relative to its source in that forest, so each edge has exactly one type. Of(EdgeTypes, EdgeType) collects the edges of one type.

The underlying type is byte, with the values 0 to 3 in the order of the members, so that EdgeTypes keeps one byte per edge.