networks(deprecated)/girth - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Home : Support : Online Help : networks(deprecated)/girth

networks

 girth
 finds shortest cycle in an undirected graph

 Calling Sequence girth(G) girth(G, shortcycle)

Parameters

 G - undirected multigraph shortcycle - name used to return edges of the shortest cycle

Description

 • Important: The networks package has been deprecated.  Use the superseding command GraphTheory[Girth] instead.
 • The girth of a graph is the length of the shortest cycle. This routine returns the girth (or infinity if the graph G has no cycle).
 • If a name such as shortcycle is specified, then this name is assigned the set of edges forming that shortest cycle.
 • This routine is normally loaded via the command with(networks) but may also be referenced using the full name networks[girth](...).

Examples

Important: The networks package has been deprecated.  Use the superseding command GraphTheory[Girth] instead.

 > $\mathrm{with}\left(\mathrm{networks}\right):$
 > $G≔\mathrm{cycle}\left(6\right):$
 > $\mathrm{girth}\left(G,\mathrm{scyc}\right)$
 ${6}$ (1)
 > $\mathrm{scyc}$
 ${\mathrm{e1}}{,}{\mathrm{e2}}{,}{\mathrm{e3}}{,}{\mathrm{e4}}{,}{\mathrm{e5}}{,}{\mathrm{e6}}$ (2)
 > $\mathrm{ends}\left(\left[\mathrm{scyc}\right],G\right)$
 $\left[\left\{{1}{,}{2}\right\}{,}\left\{{2}{,}{3}\right\}{,}\left\{{3}{,}{4}\right\}{,}\left\{{4}{,}{5}\right\}{,}\left\{{5}{,}{6}\right\}{,}\left\{{1}{,}{6}\right\}\right]$ (3)
 > $\mathrm{delete}\left(\mathrm{e1},G\right):$
 > $\mathrm{girth}\left(G\right)$
 ${\mathrm{\infty }}$ (4)
 > $\mathrm{addedge}\left(\left\{1\right\},G\right):$
 > $\mathrm{girth}\left(G,\mathrm{short}\right)$
 ${1}$ (5)
 > $\mathrm{ends}\left(\mathrm{short},G\right)$
 $\left\{{1}\right\}$ (6)