 GraphTheory - Maple Programming Help

Home : Support : Online Help : Mathematics : Discrete Mathematics : Graph Theory : GraphTheory Package : GraphTheory/Neighbors

GraphTheory

 Arrivals
 Departures
 Neighbors

 Calling Sequence Arrivals(G, v) Departures(G,v) Neighbors(G, v)

Parameters

 G - graph v - (optional) vertex of the graph

Description

 • Neighbors returns a list of lists if the input is just a graph. The ith list is the list of neighbors of the ith vertex of the graph. Neighbors(G, v) returns the list of neighbors of vertex v in the graph G.
 • Arrivals returns a list of the lists of vertices which are at the tail of arcs directed into vertex i. Undirected edges are treated as if they were bidirectional. If a vertex v is specified, the output is only the list of vertices which are at the tail of arcs directed into vertex v.
 • Departures is similar to Arrivals, but returns a list of the lists of vertices which are at the head of edges directed out of vertex i. If a vertex v is specified, the output is only the list of vertices which are at the head of edge directed out of vertex v.

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $G≔\mathrm{Digraph}\left(\mathrm{Trail}\left(1,2,3,4,5,6,4,7,8,2\right)\right)$
 ${G}{≔}{\mathrm{Graph 1: a directed unweighted graph with 8 vertices and 9 arc\left(s\right)}}$ (1)
 > $\mathrm{DrawGraph}\left(G\right)$ > $\mathrm{Neighbors}\left(G,4\right)$
 $\left[{3}{,}{5}{,}{6}{,}{7}\right]$ (2)
 > $\mathrm{Arrivals}\left(G,4\right)$
 $\left[{3}{,}{6}\right]$ (3)
 > $\mathrm{Departures}\left(G,4\right)$
 $\left[{5}{,}{7}\right]$ (4)
 > $\mathrm{Neighbors}\left(G\right)$
 $\left[\left[{2}\right]{,}\left[{1}{,}{3}{,}{8}\right]{,}\left[{2}{,}{4}\right]{,}\left[{3}{,}{5}{,}{6}{,}{7}\right]{,}\left[{4}{,}{6}\right]{,}\left[{4}{,}{5}\right]{,}\left[{4}{,}{8}\right]{,}\left[{2}{,}{7}\right]\right]$ (5)
 > $\mathrm{Arrivals}\left(G\right)$
 $\left[\left[\right]{,}\left[{1}{,}{8}\right]{,}\left[{2}\right]{,}\left[{3}{,}{6}\right]{,}\left[{4}\right]{,}\left[{5}\right]{,}\left[{4}\right]{,}\left[{7}\right]\right]$ (6)
 > $\mathrm{Departures}\left(G\right)$
 $\left[\left[{2}\right]{,}\left[{3}\right]{,}\left[{4}\right]{,}\left[{5}{,}{7}\right]{,}\left[{6}\right]{,}\left[{4}\right]{,}\left[{8}\right]{,}\left[{2}\right]\right]$ (7)