GraphTheory
Calling Sequence
Description
List of GraphTheory Subpackages
List of GraphTheory Package Commands
Accessing the GraphTheory Package Commands
Examples
GraphTheory:-command(arguments)
command(arguments)
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.
The GeometricGraphs package has routines for generating graphs from geometric data.
The RandomGraphs package has routines for randomly generating graphs.
The SpecialGraphs package contains a library of predefined graphs.
The following is a list of the commands in the main GraphTheory package.
Constructing Graphs
CanonicalGraph
CartesianProduct
CompleteGraph
Condensation
ConormalProduct
ContractSubgraph
CopyGraph
CycleGraph
Digraph
DisjointUnion
FundamentalCycle
Graph
GraphComplement
GraphIntersection
GraphJoin
GraphPower
GraphUnion
IdentifyGraph
InducedSubgraph
IntervalGraph
IsomorphicCopy
LeafPower
LexicographicProduct
LineGraph
MakeDirected
MakeWeighted
ModularProduct
MoralGraph
Multigraph
Mycielski
Newick
NonIsomorphicGraphs
PathGraph
PermuteVertices
PlaneDual
RelabelVertices
RelationGraph
ReverseGraph
SeidelSwitch
SequenceGraph
StrongProduct
Subgraph
TensorProduct
Trail
TransitiveClosure
TransitiveReduction
UnderlyingGraph
Modifying Graphs
AddArc
AddEdge
AddVertex
Contract
DeleteArc
DeleteEdge
DeleteVertex
DiscardEdgeAttribute
DiscardGraphAttribute
DiscardVertexAttribute
GetEdgeAttribute
GetGraphAttribute
GetVertexAttribute
ListEdgeAttributes
ListGraphAttributes
ListVertexAttributes
SetEdgeAttribute
SetEdgeWeight
SetGraphAttribute
SetVertexAttribute
Subdivide
Properties of Graphs
AcyclicPolynomial
AdjacencyMatrix
AllPairsDistance
Arrivals
ArticulationPoints
AutomorphismGroup
BetweennessCentrality
BiconnectedComponents
BipartiteMatching
Blocks
Center
CharacteristicPolynomial
ChromaticIndex
ChromaticNumber
ChromaticPolynomial
CircularChromaticIndex
CircularChromaticNumber
CircularEdgeChromaticNumber
CliqueCover
CliqueCoverNumber
CliqueNumber
CliquePolynomial
ClosenessCentrality
ConnectedComponents
CycleBasis
Degree
DegreeCentrality
DegreeSequence
Departures
Diameter
Distance
DistancePolynomial
DrawAutomorphism
Eccentricity
EdgeChromaticNumber
EdgeConnectivity
Edges
EgoGraph
EigenvectorCentrality
FindAsteroidalTriple
FindClique
FindEulerianPath
FindHamiltonianPath
FindVertexCover
FlowPolynomial
GetEdgeWeight
Girth
GlobalClusteringCoefficient
GraphDensity
GraphEqual
GraphPolynomial
GraphRank
GraphSpectrum
HarmonicCentrality
HasArc
HasEdge
HasSelfLoop
HighlightedEdges
HighlightedVertices
IncidenceMatrix
IncidentEdges
InDegree
IndependenceNumber
IndependencePolynomial
InformationCentrality
IsAcyclic
IsAntiArborescence
IsArborescence
IsArchimedeanGraph
IsAsteroidalTripleFree
IsBiconnected
IsBipartite
IsBiregular
IsChordal
IsClique
IsComparabilityGraph
IsConnected
IsCutSet
IsDirected
IsDominatingSet
IsEdgeColorable
IsEulerian
IsForest
IsGraphicSequence
IsHamiltonian
IsIndependentSet
IsIntegerGraph
IsIntervalGraph
IsIsomorphic
IsMultigraph
IsNetwork
IsOriented
IsPerfectGraph
IsPlanar
IsRamanujanGraph
IsRegular
IsSimplicial
IsSplitGraph
IsStronglyConnected
IsStronglyRegular
IsSubgraphIsomorphic
IsTournament
IsTree
IsTriangleFree
IsTwoEdgeConnected
IsVertexColorable
IsWeighted
KatzCentrality
LaplacianMatrix
LocalClusteringCoefficient
MaxFlow
MaximumClique
MaximumDegree
MaximumIndependentSet
MaximumMatching
MinCut
MinimumDegree
MinimumVertexCover
Neighborhood
Neighbors
NumberOfEdges
NumberOfSpanningTrees
NumberOfVertices
OddGirth
OutDegree
PageRankCentrality
PathWeight
Periphery
PrueferCode
Radius
RankPolynomial
Reachable
ReliabilityPolynomial
RichClubCoefficients
SeidelSpectrum
SpanningPolynomial
StronglyConnectedComponents
TopologicSort
TreeHeight
TuttePolynomial
TwoEdgeConnectedComponents
VertexConnectivity
VertexCoverNumber
Vertices
WeightMatrix
WienerIndex
Importing and Exporting Graphs
ConvertGraph
ExportGraph
ImportGraph
Latex
Traversing Graphs
BellmanFordAlgorithm
DijkstrasAlgorithm
IsReachable
KruskalsAlgorithm
MinimalSpanningTree
PrimsAlgorithm
ShortestPath
SpanningTree
TravelingSalesman
Traverse
Visualizing Graphs
DrawGraph
DrawNetwork
DrawPlanar
GetVertexPositions
GraphDrawingOptions
HighlightEdges
HighlightSubgraph
HighlightTrail
HighlightVertex
SetVertexPositions
StyleEdge
StyleEdgesByProperty
StyleSubgraph
StyleVertex
StyleVerticesByProperty
Other Commands
AllGraphs
DelaunayTriangulation
GreedyClique
GreedyColor
GreedyIndependentSet
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.
The long form, GraphTheory:-command, is always available. The short form can be used after loading the package. For example, if G is a graph you can use either GraphTheory:-IsPlanar(G) or with(GraphTheory); then IsPlanar(G).
with⁡GraphTheory:
An undirected graph on 5 vertices labeled 1 to 5.
G≔Graph⁡1,2,1,3,2,3,4,5
G≔Graph 1: an undirected graph with 5 vertices and 4 edge(s)
DrawGraph⁡G
A directed graph on 4 vertices a, b, c, and d.
H≔Digraph⁡a,b,c,d,a,b,b,c,c,d,d,a
H≔Graph 2: a directed graph with 4 vertices and 4 arc(s)
DrawGraph⁡H
A weighted directed graph (a network) on 4 vertices 1, 2, 3, and 4.
N≔Digraph⁡1,2,3,1,3,3,2,4,4,3,4,4
N≔Graph 3: a directed weighted graph with 4 vertices and 4 arc(s)
WeightMatrix⁡N
0330000400040000
A example of a special graph, a dodecahedron, on 20 vertices.
with⁡SpecialGraphs:
G≔DodecahedronGraph⁡
G≔Graph 4: an undirected graph with 20 vertices and 30 edge(s)
See Also
GeometricGraphs
GraphTheory examples
RandomGraphs
SpecialGraphs
Download Help Document