GraphTheory - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Packages : GraphTheory

GraphTheory

 

Calling Sequence

Description

List of GraphTheory Package Commands

Accessing the GraphTheory Package Commands

Examples

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 SpecialGraphs package contains a library of pre-defined graphs and the RandomGraphs package has routines for randomly generating graphs.

• 

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 Package Commands

• 

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

  

Constructing Graphs

CartesianProduct

CompleteGraph

CopyGraph

CycleGraph

Digraph

DisjointUnion

FundamentalCycle

Graph

GraphComplement

GraphJoin

GraphPower

GraphUnion

InducedSubgraph

IntervalGraph

IsomorphicCopy

LineGraph

MakeDirected

MakeWeighted

Mycielski

PathGraph

PermuteVertices

PlaneDual

RelabelVertices

ReverseGraph

SeidelSwitch

SequenceGraph

Subgraph

TensorProduct

Trail

TransitiveClosure

UnderlyingGraph

 

  

Modifying Graphs

AddArc

AddEdge

AddVertex

Contract

DeleteArc

DeleteEdge

DeleteVertex

DiscardEdgeAttribute

DiscardGraphAttribute

DiscardVertexAttribute

GetEdgeAttribute

GetGraphAttribute

GetVertexAttribute

GreedyColor

ListEdgeAttributes

ListGraphAttributes

ListVertexAttributes

SeidelSwitch

SetEdgeAttribute

SetEdgeWeight

SetGraphAttribute

SetVertexAttribute

Subdivide

 

  

Properties of Graphs

AdjacencyMatrix

AllPairsDistance

Arrivals

ArticulationPoints

BiconnectedComponents

BipartiteMatching

Blocks

CharacteristicPolynomial

ChromaticIndex

ChromaticNumber

CircularChromaticIndex

CircularChromaticNumber

CircularEdgeChromaticNumber

CliqueCover

CliqueCoverNumber

CliqueNumber

ConnectedComponents

CycleBasis

Degree

DegreeSequence

Departures

Diameter

Distance

EdgeChromaticNumber

EdgeConnectivity

Edges

GetEdgeWeight

Girth

GlobalClusteringCoefficient

GraphEqual

GraphPolynomial

GraphRank

GraphSpectrum

HasArc

HasEdge

IncidenceMatrix

IncidentEdges

InDegree

IndependenceNumber

IsAcyclic

IsArborescence

IsBiconnected

IsBipartite

IsClique

IsConnected

IsCutSet

IsDirected

IsEdgeColorable

IsEulerian

IsForest

IsGraphicSequence

IsHamiltonian

IsIntegerGraph

IsNetwork

IsPlanar

IsRegular

IsStronglyConnected

IsTournament

IsTree

IsTwoEdgeConnected

IsVertexColorable

IsWeighted

LaplacianMatrix

LocalClusteringCoefficient

MaxFlow

MaximumClique

MaximumDegree

MaximumIndependentSet

MaximumMatching

MinimumDegree

Neighborhood

Neighbors

NumberOfEdges

NumberOfSpanningTrees

NumberOfVertices

OddGirth

OptimalEdgeColoring

OptimalVertexColoring

OutDegree

SeidelSpectrum

SpanningPolynomial

StronglyConnectedComponents

TopologicSort

TreeHeight

TwoEdgeConnectedComponents

VertexConnectivity

Vertices

WeightMatrix

  

Importing and Exporting Graphs

ExportGraph

ImportGraph

 

 

  

Traversing Graphs

BFS

DijkstrasAlgorithm

KruskalsAlgorithm

MinimalSpanningTree

PrimsAlgorithm

ShortestPath

SpanningTree

TravelingSalesman

  

Visualizing Graphs

DrawGraph

DrawNetwork

DrawPlanar

GetVertexPositions

HighlightEdges

HighlightSubgraph

HighlightTrail

HighlightVertex

SetVertexPositions

 

 

 

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

withGraphTheory:

An undirected graph on 5 vertices labeled 1 to 5.

GGraph1,2,2,3,3,1,4,5

GGraph 1: an undirected unweighted graph with 5 vertices and 4 edge(s)

(1)

DrawGraphG

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

HDigrapha,b,c,d,a,b,b,c,c,d,d,a

HGraph 2: a directed unweighted graph with 4 vertices and 4 arc(s)

(2)

DrawGraphH

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

NDigraph1,2,3,1,3,3,2,4,4,3,4,4

NGraph 3: a directed weighted graph with 4 vertices and 4 arc(s)

(3)

WeightMatrixN

0330000400040000

(4)

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

withSpecialGraphs:

GDodecahedronGraph

GGraph 4: an undirected unweighted graph with 20 vertices and 30 edge(s)

(5)

DrawGraphG

See Also

GraphTheory examples

RandomGraphs

SpecialGraphs