isdag - Determine if graph is acyclic - MATLAB (original) (raw)

Main Content

Determine if graph is acyclic

Syntax

Description

Examples

collapse all

Create and plot a directed graph, and then test the graph to determine if it is acyclic.

s = [1 1 2 2 3 3 4 4 4 5]; t = [2 3 4 5 6 7 8 9 10 4]; G = digraph(s,t)

G = digraph with properties:

Edges: [10×1 table]
Nodes: [10×0 table]

Figure contains an axes object. The axes object contains an object of type graphplot.

Input Arguments

More About

collapse all

A directed graph is acyclic if it contains no cycles. That is, starting at any node in the graph, no sequence of edges exists that can be followed to loop back to that starting node. As a result, directed acyclic graphs do not contain any self-loops.

Version History

Introduced in R2015b