lexicographical.topological.sort: Lexicographical topological sorting

View source: R/graph.utility.R

lexicographical.topological.sortR Documentation

Lexicographical topological sorting

Description

Nodes of a graph are sorted according to a lexicographical topological ordering.

Usage

lexicographical.topological.sort(g)

Arguments

g

an object of class graphNEL.

Details

A topological sorting is a linear ordering of the nodes such that given an edge from u to v, the node u comes before node v in the ordering. Topological sorting is not possible if the graph g contains self-loop. To implement the topological sorting algorithm we applied the Kahn’s algorithm.

Value

A vector in which the nodes of the graph g are sorted according to a lexicographical topological order.

Examples

data(graph);
T <- lexicographical.topological.sort(g);

AnacletoLAB/HEMDAG documentation built on Oct. 14, 2022, 9:18 p.m.