next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Graphs :: digraph

digraph -- Constructs a digraph

Synopsis

Description

A digraph is a set of vertices connected by directed edges. Unlike the case with simple graphs, {u,v} being an edge does not imply that {v,u} is also an edge. Notably, this allows for non-symmetric adjacency matrices.

i1 : G = digraph ({{1,2},{2,1},{3,1}}, EntryMode => "edges")

o1 = Digraph{1 => {2}}
             2 => {1}
             3 => {1}

o1 : Digraph
i2 : G = digraph hashTable{1 => {2}, 3 => {4}, 5 => {6}}

o2 = Digraph{1 => {2}}
             2 => {}
             3 => {4}
             4 => {}
             5 => {6}
             6 => {}

o2 : Digraph
i3 : G = digraph ({{a,{b,c,d,e}}, {b,{d,e}}, {e,{a}}}, EntryMode => "neighbors")

o3 = Digraph{a => {e, b, c, d}}
             b => {e, d}
             c => {}
             d => {}
             e => {a}

o3 : Digraph
i4 : G = digraph ({x,y,z}, matrix {{0,1,1},{0,0,1},{0,1,0}})

o4 = Digraph{x => {y, z}}
             y => {z}
             z => {y}

o4 : Digraph
i5 : G = digraph matrix {{0,1,1},{0,0,1},{0,1,0}}

o5 = Digraph{0 => {1, 2}}
             1 => {2}
             2 => {1}

o5 : Digraph

See also

Ways to use digraph :

For the programmer

The object digraph is a method function with options.