Overview - Maple Help

GraphTheory

 Calling Sequence GraphTheory[command](arguments) command(arguments)

Description

 • The GraphTheory package is a collection of routines for creating graphs, drawing graphs, manipulating graphs, and testing graphs for properties. The graphs are sets of vertices (nodes) connected by edges. The package supports both directed and undirected graphs but not multigraphs. The edges in the graphs can be weighted or unweighted.
 • The main command for creating undirected graphs is the Graph command. The main command for creating directed graphs is the Digraph command.
 • To draw a graph in Maple use the DrawGraph command.  The output is a Maple plot.
 • To include a graph in a TeX or LaTeX document as a figure use the Latex command.
 • To test if a Maple object G is a graph use the test: type(G,Graph).
 • The ImportGraph and ExportGraph commands are for reading a graph from, and writing a graph to, a file in one of the supported data formats.
 • The following commands are essential for working with large graphs: HasEdge, HasArc, AddEdge, AddArc, DeleteEdge, DeleteArc.
 • The GraphTheory examples worksheet has a guided tour of the package.
 • For details on the implementation of the GraphTheory package and its graph data structure, consult GraphTheory[Details].

List of GraphTheory Subpackages

 • The RandomGraphs package has routines for randomly generating graphs.
 • The SpecialGraphs package contains a library of predefined graphs.
 • The GeometricGraphs package has routines for generating graphs from geometric data.

List of GraphTheory Package Commands

 • The following is a list of the commands in the main GraphTheory package.
 Constructing Graphs

 Modifying Graphs

 Properties of Graphs

 Importing and Exporting Graphs

 Traversing Graphs

 Visualizing Graphs

 Other Commands

Accessing the GraphTheory Package Commands

 • Each command in the GraphTheory package can be accessed by using either the long form or the short form of the command name in the command calling sequence.  For example, if G is a graph you can use either GraphTheory[IsPlanar](G) or with(GraphTheory); then IsPlanar(G).
 • Because the underlying implementation of the GraphTheory package is a module, it is possible to use the form GraphTheory:-command to access a command from the package. For more information, see Module Members.

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$

An undirected graph on 5 vertices labeled 1 to 5.

 > $G≔\mathrm{Graph}\left(\left\{\left\{1,2\right\},\left\{1,3\right\},\left\{2,3\right\},\left\{4,5\right\}\right\}\right)$
 ${G}{≔}{\mathrm{Graph 1: an undirected unweighted graph with 5 vertices and 4 edge\left(s\right)}}$ (1)
 > $\mathrm{DrawGraph}\left(G\right)$

A directed graph on 4 vertices a, b, c, and d.

 > $H≔\mathrm{Digraph}\left(\left[a,b,c,d\right],\left\{\left[a,b\right],\left[b,c\right],\left[c,d\right],\left[d,a\right]\right\}\right)$
 ${H}{≔}{\mathrm{Graph 2: a directed unweighted graph with 4 vertices and 4 arc\left(s\right)}}$ (2)
 > $\mathrm{DrawGraph}\left(H\right)$

A weighted directed graph (a network) on 4 vertices 1, 2, 3, and 4.

 > $N≔\mathrm{Digraph}\left(\left\{\left[\left[1,2\right],3\right],\left[\left[1,3\right],3\right],\left[\left[2,4\right],4\right],\left[\left[3,4\right],4\right]\right\}\right)$
 ${N}{≔}{\mathrm{Graph 3: a directed weighted graph with 4 vertices and 4 arc\left(s\right)}}$ (3)
 > $\mathrm{WeightMatrix}\left(N\right)$
 $\left[\begin{array}{cccc}{0}& {3}& {3}& {0}\\ {0}& {0}& {0}& {4}\\ {0}& {0}& {0}& {4}\\ {0}& {0}& {0}& {0}\end{array}\right]$ (4)

A example of a special graph, a dodecahedron, on 20 vertices.

 > $\mathrm{with}\left(\mathrm{SpecialGraphs}\right):$
 > $G≔\mathrm{DodecahedronGraph}\left(\right)$
 ${G}{≔}{\mathrm{Graph 4: an undirected unweighted graph with 20 vertices and 30 edge\left(s\right)}}$ (5)
 > $\mathrm{DrawGraph}\left(G\right)$
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 15, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.926895260810852, "perplexity": 1815.760347393372}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2022-33/segments/1659882573399.40/warc/CC-MAIN-20220818185216-20220818215216-00730.warc.gz"}