Products
  • Wolfram|One

    The definitive Wolfram Language and notebook experience

  • Mathematica

    The original technical computing environment

  • System Modeler

    Multidomain modeling and simulation of complex systems

  • Compute ServicesUse with Mathematica and Wolfram|One
  • AI AccessUse with Mathematica and Wolfram|One
  • Finance Platform
  • Wolfram|Alpha Notebook Edition
  • Application Server
  • Enterprise Private Cloud
  • Wolfram Engine
  • Wolfram Player
  • Wolfram Cloud App
  • Wolfram Player App

More mobile apps

Wolfram|Alpha

  • Wolfram|Alpha Website
  • Wolfram|Alpha APIs

AI Products

  • Wolfram AI Ecosystem
  • Wolfram Foundation Tool
  • Wolfram Cloud MCP
  • Wolfram Local MCP
  • Agent One API
  • CAG Component APIs

Core Technologies of Wolfram Products

  • Wolfram Language
  • Computable Data
  • Wolfram Notebooks
  • Linguistic Understanding

Additional Deployment Options

  • Wolfram Cloud
  • Wolfram Web Engine
  • wolframscript
  • WSTPServer
  • Group & Organizational Licensing
  • All Products
Consulting & Solutions

We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

Wolfram Consulting

Data Science, Finance & Business

  • Artificial Intelligence
  • Data Science
  • Healthcare
  • Real Estate

Engineering

  • Civil Engineering
  • Automotive Engineering
  • Sustainable Energy

Science & Technology

  • AgTech
  • Biosciences
  • Environmental Science
  • Food Science
  • Quantum Computation
  • Social and Behavioral Sciences

More Wolfram Solutions

Technology for Education

  • Research Universities
  • Colleges & Teaching Universities
  • High Schools
  • Resources for Students

Education Initiatives

  • Next-Gen EdTech
  • Computer-Based Math

More Solutions for Education

  • Contact Us
Learning & Support

Get Started

  • Wolfram Language Introduction
  • Fast Intro for Programmers
  • Fast Intro for Math Students
  • Wolfram Language Documentation

More Learning

  • Highlighted Core Areas
  • Demonstrations
  • YouTube
  • Daily Study Groups
  • Wolfram Schools and Programs
  • Books

Grow Your Skills

  • Wolfram U

    Courses in computing, science, life and more

  • Community

    Learn, solve problems and share ideas.

  • Blog

    News, views and insights from Wolfram

  • Resources for

    Software Developers

Tech Support

  • Contact Us
  • Support FAQs
  • Support FAQs
  • Contact Us
Company
  • About Wolfram
  • Career Center
  • All Sites & Resources
  • Connect & Follow
  • Contact Us

Work with Us

  • Student Ambassador Initiative
  • Wolfram for Startups
  • Student Opportunities
  • Jobs Using Wolfram Language

Educational Programs for Adults

  • Summer School
  • Winter School

Educational Programs for Youth

  • Middle School Camp
  • High School Research Program
  • Computational Adventures

Read

  • Stephen Wolfram's Writings
  • Wolfram Blog
  • Wolfram Tech | Books
  • Wolfram Media
  • Complex Systems

Educational Resources

  • Wolfram MathWorld
  • Wolfram in STEM
  • Wolfram Challenges
  • Wolfram Problem Generator

Wolfram Initiatives

  • Wolfram Science
  • Wolfram Foundation
  • History of Mathematics Project

Events

  • Stephen Wolfram Livestreams
  • Online & In-Person Events
  • Contact Us
  • Connect & Follow
For AIs
  • Your Account
  • User Portal
  • Wolfram Cloud
  • Products
    • Wolfram|One
    • Mathematica
    • System Modeler
    • Compute ServicesUse with Mathematica and Wolfram|One
    • AI AccessUse with Mathematica and Wolfram|One
    • Finance Platform
    • Wolfram|Alpha Notebook Edition
    • Application Server
    • Enterprise Private Cloud
    • Wolfram Engine
    • Wolfram Player
    • Wolfram Cloud App
    • Wolfram Player App

    More mobile apps

    • Wolfram|Alpha
      • Wolfram|Alpha Website
      • Wolfram|Alpha APIs
    • AI Products
      • Wolfram AI Ecosystem
      • Wolfram Foundation Tool
      • Wolfram Cloud MCP
      • Wolfram Local MCP
      • Agent One API
      • CAG Component APIs
    • Core Technologies
      • Wolfram Language
      • Computable Data
      • Wolfram Notebooks
      • Linguistic Understanding
    • Additional Deployment Options
      • Wolfram Cloud
      • Wolfram Web Engine
      • wolframscript
      • WSTPServer
    • Group & Organizational Licensing
    • All Products
  • Consulting & Solutions
    • Wolfram Consulting

    Data Science, Finance & Business

    • Artificial Intelligence
    • Data Science
    • Healthcare
    • Real Estate

    Engineering

    • Civil Engineering
    • Automotive Engineering
    • Sustainable Energy

    Science & Technology

    • AgTech
    • Biosciences
    • Environmental Science
    • Food Science
    • Quantum Computation
    • Social and Behavioral Sciences

    More Wolfram Solutions

    Technology for Education

    • Research Universities
    • Colleges & Teaching Universities
    • High Schools
    • Resources for Students

    Education Initiatives

    • Next-Gen EdTech
    • Computer-Based Math

    More Solutions for Education

    • Contact Us
  • Learning & Support

    Get Started

    • Wolfram Language Introduction
    • Fast Intro for Programmers
    • Fast Intro for Math Students
    • Wolfram Language Documentation

    Grow Your Skills

    • Wolfram U

      Courses in computing, science, life and more

    • Community

      Learn, solve problems and share ideas.

    • Blog

      News, views and insights from Wolfram

    • Resources for

      Software Developers
    • Tech Support
      • Contact Us
      • Support FAQs
    • More Learning
      • Highlighted Core Areas
      • Demonstrations
      • YouTube
      • Daily Study Groups
      • Wolfram Schools and Programs
      • Books
    • Support FAQs
    • Contact Us
  • Company
    • About Wolfram
    • Career Center
    • All Sites & Resources
    • Connect & Follow
    • Contact Us

    Work with Us

    • Student Ambassador Initiative
    • Wolfram for Startups
    • Student Opportunities
    • Jobs Using Wolfram Language

    Educational Programs for Adults

    • Summer School
    • Winter School

    Educational Programs for Youth

    • Middle School Camp
    • High School Research Program
    • Computational Adventures

    Read

    • Stephen Wolfram's Writings
    • Wolfram Blog
    • Wolfram Tech | Books
    • Wolfram Media
    • Complex Systems
    • Educational Resources
      • Wolfram MathWorld
      • Wolfram in STEM
      • Wolfram Challenges
      • Wolfram Problem Generator
    • Wolfram Initiatives
      • Wolfram Science
      • Wolfram Foundation
      • History of Mathematics Project
    • Events
      • Stephen Wolfram Livestreams
      • Online & In-Person Events
    • Contact Us
    • Connect & Follow
  • For AIs
  • Wolfram Cloud
  • Your Account
  • User Portal
Wolfram Language & System Documentation Center
CompleteGraph
  • See Also
    • Graph
    • GraphData
    • GraphComplement
    • CompleteGraphQ
  • Related Guides
    • Graph Construction & Representation
    • Graphs & Networks
    • See Also
      • Graph
      • GraphData
      • GraphComplement
      • CompleteGraphQ
    • Related Guides
      • Graph Construction & Representation
      • Graphs & Networks

CompleteGraph[n]

gives the complete graph with n vertices .

CompleteGraph[{n1,n2,…,nk}]

gives the complete k-partite graph with n1+n2+⋯+nk vertices .

Details and Options
Details and Options Details and Options
Examples  
Basic Examples  
Options  
AnnotationRules  
DirectedEdges  
EdgeLabels  
Show More Show More
EdgeShapeFunction  
EdgeStyle  
EdgeWeight  
GraphHighlight  
GraphHighlightStyle  
GraphLayout  
PlotTheme  
Base Themes  
Feature Themes  
VertexCoordinates  
VertexLabels  
VertexShape  
VertexShapeFunction  
VertexSize  
VertexStyle  
VertexWeight  
Applications  
Properties & Relations  
Neat Examples  
See Also
Related Guides
Related Links
History
Cite this Page
BUILT-IN SYMBOL
  • See Also
    • Graph
    • GraphData
    • GraphComplement
    • CompleteGraphQ
  • Related Guides
    • Graph Construction & Representation
    • Graphs & Networks
    • See Also
      • Graph
      • GraphData
      • GraphComplement
      • CompleteGraphQ
    • Related Guides
      • Graph Construction & Representation
      • Graphs & Networks

CompleteGraph

CompleteGraph[n]

gives the complete graph with n vertices .

CompleteGraph[{n1,n2,…,nk}]

gives the complete k-partite graph with n1+n2+⋯+nk vertices .

Details and Options

  • CompleteGraph is also known as universal graph or full graph.
  • CompleteGraph generates a Graph object.
  • CompleteGraph[n] gives a graph with n vertices and an edge between every pair of vertices.
  • CompleteGraph[{n1,n2,…,nk}] gives a graph with n1+⋯+nk vertices partitioned into disjoint sets Vi with ni vertices each and edges between all vertices in different sets Vi and Vj, but no edges between vertices in the same set Vi.
  • CompleteGraph[…,DirectedEdges->True] gives a directed complete graph.
  • CompleteGraph takes the same options as Graph.
  • List of all options

    • AlignmentPointCenterthe default point in the graphic to align with
      AnnotationRules {}annotations for graph, edges and vertices
      AspectRatioAutomaticratio of height to width
      AxesFalsewhether to draw axes
      AxesLabelNoneaxes labels
      AxesOriginAutomaticwhere axes should cross
      AxesStyle{}style specifications for the axes
      BackgroundNonebackground color for the plot
      BaselinePositionAutomatichow to align with a surrounding text baseline
      BaseStyle{}base style specifications for the graphic
      ContentSelectableAutomaticwhether to allow contents to be selected
      CoordinatesToolOptionsAutomaticdetailed behavior of the coordinates tool
      DirectedEdges Automaticwhether to interpret Rule as DirectedEdge
      EdgeLabels Nonelabels and label placements for edges
      EdgeLabelStyleAutomaticstyle to use for edge labels
      EdgeShapeFunction Automaticgenerate graphic shapes for edges
      EdgeStyle Automaticstyle used for edges
      EdgeWeight Automaticweights for edges
      Epilog{}primitives rendered after the main plot
      FormatTypeTraditionalFormthe default format type for text
      FrameFalsewhether to put a frame around the plot
      FrameLabelNoneframe labels
      FrameStyle{}style specifications for the frame
      FrameTicksAutomaticframe ticks
      FrameTicksStyle{}style specifications for frame ticks
      GraphHighlight {}graph elements to highlight
      GraphHighlightStyle Automaticstyle for highlight
      GraphLayout Automatichow to lay out vertices and edges
      GridLinesNonegrid lines to draw
      GridLinesStyle{}style specifications for grid lines
      ImageMargins0.the margins to leave around the graphic
      ImagePaddingAllwhat extra padding to allow for labels etc.
      ImageSizeAutomaticthe absolute size at which to render the graphic
      LabelStyle{}style specifications for labels
      MethodAutomaticdetails of graphics methods to use
      PerformanceGoalAutomaticaspects of performance to try to optimize
      PlotLabelNonean overall label for the plot
      PlotRangeAllrange of values to include
      PlotRangeClippingFalsewhether to clip at the plot range
      PlotRangePaddingAutomatichow much to pad the range of values
      PlotRegionAutomaticthe final display region to be filled
      PlotTheme $PlotThemeoverall theme for the graph
      PreserveImageOptionsAutomaticwhether to preserve image options when displaying new versions of the same graphic
      Prolog{}primitives rendered before the main plot
      RotateLabelTruewhether to rotate y labels on the frame
      TicksAutomaticaxes ticks
      TicksStyle{}style specifications for axes ticks
      VertexCoordinates Automaticcoordinates for vertices
      VertexLabels Nonelabels and placements for vertices
      VertexLabelStyleAutomaticstyle to use for vertex labels
      VertexShape Automaticgraphic shape for vertices
      VertexShapeFunction Automaticgenerate graphic shapes for vertices
      VertexSize Mediumsize of vertices
      VertexStyle Automaticstyles for vertices
      VertexWeight Automaticweights for vertices

Examples

open all close all

Basic Examples  (4)

The first few complete graphs :

Wolfram Language code: Table[CompleteGraph[i, PlotLabel -> Subscript[K, ``i``]], {i, 3, 6}]

Bipartite graphs :

Wolfram Language code: Table[CompleteGraph[{i, i}, PlotLabel -> Subscript[K, i, i]], {i, 2, 4}]

Directed complete graphs use two directional edges for each undirected edge:

Wolfram Language code: Table[CompleteGraph[n, DirectedEdges -> True, PlotLabel -> Subscript[K, n]], {n, 3, 5}]

Directed complete -partite graphs use directed edges from one group to another:

Wolfram Language code: Table[CompleteGraph[{i, i, i}, DirectedEdges -> True, PlotLabel -> Subscript[K, i, i, i]], {i, 2, 4}]

Options  (81)

AnnotationRules  (2)

Specify an annotation for vertices:

Wolfram Language code: CompleteGraph[4, AnnotationRules -> {1 -> {VertexLabels -> "hello"}}]

Edges:

Wolfram Language code: CompleteGraph[4, AnnotationRules -> {12 -> {EdgeLabels -> "hello"}}]

DirectedEdges  (2)

By default, an undirected graph is generated:

Wolfram Language code: CompleteGraph[4]

Use DirectedEdges->True to generate a directed graph:

Wolfram Language code: CompleteGraph[4, DirectedEdges -> True]

Generate directed -partite graphs:

Wolfram Language code: Row[Table[CompleteGraph[Range[n], DirectedEdges -> True], {n, 2, 4}]]

EdgeLabels  (7)

Label the edge 12:

Wolfram Language code: CompleteGraph[4, EdgeLabels -> {12 -> "Hello"}]

Label all edges individually:

Wolfram Language code: el = EdgeList[CompleteGraph[4]]
Wolfram Language code: CompleteGraph[4, EdgeLabels -> Table[el[[i]] -> Subscript["e", i], {i, Length[el]}]]

Use any expression as a label:

Wolfram Language code: CompleteGraph[4, EdgeLabels -> {24 -> [image], 34 -> [image], 13 -> [image]}]

Use Placed with symbolic locations to control label placement along an edge:

Wolfram Language code: Table[CompleteGraph[4, EdgeLabels -> {34 -> Placed["■■■", p]}, PlotLabel -> p], {p, {"Start", "Middle", "End"}}]

Use explicit coordinates to place labels:

Wolfram Language code: Table[CompleteGraph[4, EdgeLabels -> {23 -> Placed["■■■", p]}, PlotLabel -> p, BaselinePosition -> Bottom], {p, {0, 1 / 4, 1 / 3}}]

Vary positions within the label:

Wolfram Language code: Table[CompleteGraph[4, EdgeLabels -> {23 -> Placed["■■■", {1 / 2, p}]}, PlotLabel -> p, BaselinePosition -> Bottom], {p, {{0, 0}, {1 / 2, 1 / 2}, {1, 1}}}]

Place multiple labels:

Wolfram Language code: CompleteGraph[5, EdgeLabels -> {31 -> Placed[{"lbl1", "lbl2"}, {"Start", "End"}]}]
Wolfram Language code: CompleteGraph[5, EdgeLabels -> {31 -> Placed[{"lbl1", "lbl2", "lbl3"}, {"Start", "Middle", "End"}]}]

Use automatic labeling by values through Tooltip and StatusArea:

Wolfram Language code: CompleteGraph[5, EdgeLabels -> Placed["Name", Tooltip]]
Wolfram Language code: CompleteGraph[5, EdgeLabels -> Placed["Name", StatusArea]]

EdgeShapeFunction  (6)

Get a list of built-in settings for EdgeShapeFunction:

Wolfram Language code: ResourceData["EdgeShapeFunction"]

Undirected edges including the basic line:

Wolfram Language code: CompleteGraph[4, EdgeShapeFunction -> "Line"]

Lines with different glyphs on the edges:

Wolfram Language code: Table[CompleteGraph[4, EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> ef], {ef, {"BoxLine", "DiamondLine", "DotLine"}}]

Directed edges including solid arrows:

Wolfram Language code: Table[CompleteGraph[4, EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> ef], {ef, ResourceData["EdgeShapeFunction", "FilledArrow"]}]

Line arrows:

Wolfram Language code: Table[CompleteGraph[4, EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> ef], {ef, ResourceData["EdgeShapeFunction", "UnfilledArrow"]}]

Open arrows:

Wolfram Language code: Table[CompleteGraph[4, EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> ef], {ef, ResourceData["EdgeShapeFunction", "CarvedArrow"]}]

Specify an edge function for an individual edge:

Wolfram Language code: CompleteGraph[4, EdgeShapeFunction -> {12 -> "DotLine"}]

Combine with a different default edge function:

Wolfram Language code: CompleteGraph[5, EdgeShapeFunction -> {12 -> "BoxLine", "DotLine"}]

Draw edges by running a program:

Wolfram Language code: ef[pts_List, e_] := Block[{s = 0.015, g = [image]}, {Arrowheads[{{s, 0.33, g}, {s, 0.67, g}}], Arrow[pts]}]
Wolfram Language code: CompleteGraph[4, EdgeShapeFunction -> ef]

EdgeShapeFunction can be combined with EdgeStyle:

Wolfram Language code: CompleteGraph[4, EdgeStyle -> Blue, EdgeShapeFunction -> (Line[#1]&)]

EdgeShapeFunction has higher priority than EdgeStyle:

Wolfram Language code: CompleteGraph[4, EdgeStyle -> Blue, EdgeShapeFunction -> ({Red, Line[#1]}&)]

EdgeStyle  (2)

Style all edges:

Wolfram Language code: Table[CompleteGraph[4, EdgeStyle -> style, PlotLabel -> style], {style, {Gray, Dashed, Thick}}]

Style individual edges:

Wolfram Language code: CompleteGraph[4, EdgeStyle -> {12 -> Blue, 13 -> Dashed}]

EdgeWeight  (2)

Specify a weight for all edges:

Wolfram Language code: CompleteGraph[4, EdgeWeight -> RandomInteger[5, 6]]
Wolfram Language code: WeightedAdjacencyMatrix[%]//MatrixForm

Use any numeric expression as a weight:

Wolfram Language code: CompleteGraph[4, EdgeWeight -> {a, b, c, d, e, f}]
Wolfram Language code: WeightedAdjacencyMatrix[%]//MatrixForm

GraphHighlight  (3)

Highlight the vertex 1:

Wolfram Language code: CompleteGraph[4, VertexSize -> Tiny, GraphHighlight -> {1}]

Highlight the edge 23:

Wolfram Language code: CompleteGraph[4, VertexSize -> Tiny, GraphHighlight -> {23}]

Highlight the vertices and edges:

Wolfram Language code: CompleteGraph[4, VertexSize -> Tiny, GraphHighlight -> {1, 2, 13, 23}]

GraphHighlightStyle  (2)

Get a list of built-in settings for GraphHighlightStyle:

Wolfram Language code: ResourceData["GraphHighlightStyle"]

Use built-in settings for GraphHighlightStyle:

Wolfram Language code: CompleteGraph[3, GraphHighlight -> {1, 23}, VertexSize -> Small, GraphHighlightStyle -> #, PlotLabel -> #]& /@ Select[ResourceData["GraphHighlightStyle"], # =!= Automatic&]

GraphLayout  (5)

By default, the layout is chosen automatically:

Wolfram Language code: CompleteGraph[5, GraphLayout -> Automatic]

Specify layouts on special curves:

Wolfram Language code: Table[CompleteGraph[20, GraphLayout -> l, PlotLabel -> l], {l, {"CircularEmbedding", "SpiralEmbedding"}}]

Specify layouts that satisfy optimality criteria:

Wolfram Language code: Table[CompleteGraph[20, GraphLayout -> l, PlotLabel -> l], {l, {"SpringEmbedding", "SpringElectricalEmbedding", "HighDimensionalEmbedding"}}]

VertexCoordinates overrides GraphLayout coordinates:

Wolfram Language code: {CompleteGraph[5, GraphLayout -> "SpringElectricalEmbedding"], CompleteGraph[5, GraphLayout -> "SpringElectricalEmbedding", VertexCoordinates -> Table[{i, i}, {i, 0, 4}]]}

Use AbsoluteOptions to extract VertexCoordinates computed using a layout algorithm:

Wolfram Language code: CompleteGraph[5]
Wolfram Language code: AbsoluteOptions[%, VertexCoordinates]

PlotTheme  (4)

Base Themes  (2)

Use a common base theme:

Wolfram Language code: CompleteGraph[4, PlotTheme -> "Business"]

Use a monochrome theme:

Wolfram Language code: CompleteGraph[4, PlotTheme -> "Monochrome"]

Feature Themes  (2)

Use a large graph theme:

Wolfram Language code: CompleteGraph[4, PlotTheme -> "LargeGraph"]

Use a classic diagram theme:

Wolfram Language code: CompleteGraph[4, VertexStyle -> LightDarkSwitched[RGBColor[1, 1, 0.85], GrayLevel[0.5]], PlotTheme -> "ClassicDiagram"]

VertexCoordinates  (3)

By default, any vertex coordinates are computed automatically:

Wolfram Language code: CompleteGraph[4]

Extract the resulting vertex coordinates using AbsoluteOptions:

Wolfram Language code: AbsoluteOptions[%, VertexCoordinates]

Specify a layout function along an ellipse:

Wolfram Language code: ellipseLayout[n_, {a_, b_}] := Table[{a Cos[2Pi / n u], b Sin[2Pi / n u]}, {u, 1, n}]
Wolfram Language code: Graphics[Point[ellipseLayout[10, {2, 1}]]]

Use it to generate vertex coordinates for a graph:

Wolfram Language code: CompleteGraph[10, VertexCoordinates -> ellipseLayout[10, {2, 1}]]

VertexCoordinates has higher priority than GraphLayout:

Wolfram Language code: CompleteGraph[4, VertexCoordinates -> Table[{i, i}, {i, 4}], GraphLayout -> "CircularEmbedding"]

VertexLabels  (13)

Use vertex names as labels:

Wolfram Language code: CompleteGraph[3, VertexLabels -> "Name"]

Label individual vertices:

Wolfram Language code: CompleteGraph[3, VertexLabels -> {1 -> "one"}]

Label all vertices:

Wolfram Language code: CompleteGraph[3, VertexLabels -> Table[i -> Subscript[v, i], {i, 3}]]

Use any expression as a label:

Wolfram Language code: CompleteGraph[3, VertexLabels -> {1 -> [image], 2 -> [image], 3 -> [image]}, ImagePadding -> 20]

Use Placed with symbolic locations to control label placement, including outside positions:

Wolfram Language code: Table[CompleteGraph[3, VertexSize -> 0.1, VertexShapeFunction -> "Square", VertexLabels -> Table[i -> Placed["■■■", p], {i, 3}], PlotLabel -> p, ImagePadding -> 20], {p, {Before, After, Below, Above}}]

Symbolic outside corner positions:

Wolfram Language code: pl = {{Before, Below}, {After, Below}, {Before, Above}, {After, Above}};
Wolfram Language code: Table[CompleteGraph[3, VertexSize -> 0.1, VertexShapeFunction -> "Square", ImagePadding -> 20, VertexLabels -> Table[i -> Placed["■■■", p], {i, 3}], PlotLabel -> p], {p, pl}]

Symbolic inside positions:

Wolfram Language code: Table[CompleteGraph[3, VertexSize -> 0.25, VertexLabels -> Table[i -> Placed["■■■", p], {i, 3}], VertexShapeFunction -> "Square", PlotLabel -> p], {p, {Left, Top, Right, Bottom}}]

Symbolic inside corner positions:

Wolfram Language code: pl = {{Left, Bottom}, {Right, Bottom}, {Left, Top}, {Right, Top}};
Wolfram Language code: Table[CompleteGraph[3, VertexSize -> 0.25, VertexShapeFunction -> "Square", VertexLabels -> Table[i -> Placed["■■■", p], {i, 3}], PlotLabel -> p], {p, pl}]

Use explicit coordinates to place the center of labels:

Wolfram Language code: Table[CompleteGraph[3, VertexSize -> 0.25, VertexShapeFunction -> "Square", VertexLabels -> Table[i -> Placed[[image], p], {i, 3}], PlotLabel -> p, BaselinePosition -> Bottom], {p, {{0, 0}, {1 / 2, 1 / 2}, {1, 1}}}]

Place all labels at the upper-right corner of the vertex and vary the coordinates within the label:

Wolfram Language code: Table[CompleteGraph[3, VertexSize -> 0.35, VertexShapeFunction -> "Square", VertexLabels -> Table[i -> Placed[[image], {{1, 1}, p}], {i, 3}], PlotLabel -> p, BaselinePosition -> Bottom], {p, {{0, 0}, {1 / 2, 1 / 2}, {1, 1}}}]

Place multiple labels:

Wolfram Language code: CompleteGraph[3, VertexLabels -> {1 -> Placed[{"lbl1", "lbl2"}, {Above, Below}]}]

Any number of labels can be used:

Wolfram Language code: CompleteGraph[3, VertexLabels -> {1 -> Placed[{"lbl1", "lbl2", "lbl3", "lbl4"}, {Above, After, Below, Before}]}]

Use the argument to Placed to control formatting including Tooltip:

Wolfram Language code: CompleteGraph[3, VertexLabels -> Placed["Name", Tooltip]]

Or StatusArea:

Wolfram Language code: CompleteGraph[3, VertexLabels -> Placed["Name", StatusArea]]

Use more elaborate formatting functions:

Wolfram Language code: rotateLabel[lab_] := Rotate[lab, 45Degree]
Wolfram Language code: CompleteGraph[3, VertexLabels -> Table[i -> Placed["xxx", Below, rotateLabel], {i, 3}]]
Wolfram Language code: panelLabel[lab_] := Panel[lab, FrameMargins -> 0, Background -> StandardBlue]
Wolfram Language code: CompleteGraph[3, VertexLabels -> Table[i -> Placed["xxx", Center, panelLabel], {i, 3}]]
Wolfram Language code: hyperlinkLabel[lab_] := Hyperlink[lab, "http://www.wolfram.com"]
Wolfram Language code: CompleteGraph[3, VertexLabels -> Table[i -> Placed["xxx", Center, hyperlinkLabel], {i, 3}]]

VertexShape  (5)

Use any Graphics, Image, or Graphics3D as a vertex shape:

Wolfram Language code: Table[CompleteGraph[5, VertexShape -> s, VertexSize -> Medium], {s, {[image], [image], [image]}}]

Specify vertex shapes for individual vertices:

Wolfram Language code: CompleteGraph[5, VertexShape -> {2 -> [image]}, VertexSize -> Medium]

VertexShape can be combined with VertexSize:

Wolfram Language code: Table[CompleteGraph[5, VertexSize -> s, VertexShape -> [image], PlotLabel -> s], {s, {Small, Large}}]

VertexShape is not affected by VertexStyle:

Wolfram Language code: CompleteGraph[5, VertexSize -> 0.2, VertexShape -> [image], VertexStyle -> Blue]

VertexShapeFunction has higher priority than VertexShape:

Wolfram Language code: CompleteGraph[5, VertexSize -> 0.1, VertexShapeFunction -> "Square", VertexShape -> [image]]

VertexShapeFunction  (10)

Get a list of built-in collections for VertexShapeFunction:

Wolfram Language code: ResourceData["VertexShapeFunction"]

Use built-in settings for VertexShapeFunction in the "Basic" collection:

Wolfram Language code: ResourceData["VertexShapeFunction", "Basic"]

Simple basic shapes:

Wolfram Language code: Table[CompleteGraph[4, VertexShapeFunction -> vf, VertexSize -> 0.2, PlotLabel -> vf], {vf, {"Triangle", "Square", "Rectangle", "Pentagon", "Hexagon", "Octagon"}}]

Common basic shapes:

Wolfram Language code: Table[CompleteGraph[4, VertexShapeFunction -> vf, VertexSize -> 0.2, PlotLabel -> vf], {vf, {"DownTrapezoid", "UpTrapezoid", "Parallelogram", "FiveDown", "Circle", "Diamond", "Star", "Capsule"}}]

Use built-in settings for VertexShapeFunction in the "Rounded" collection:

Wolfram Language code: ResourceData["VertexShapeFunction", "Rounded"]
Wolfram Language code: Table[CompleteGraph[4, VertexShapeFunction -> vf, VertexSize -> 0.2, PlotLabel -> vf], {vf, ResourceData["VertexShapeFunction", "Rounded"]}]

Use built-in settings for VertexShapeFunction in the "Concave" collection:

Wolfram Language code: ResourceData["VertexShapeFunction", "Concave"]
Wolfram Language code: Table[CompleteGraph[4, VertexShapeFunction -> vf, VertexSize -> 0.2, PlotLabel -> vf], {vf, ResourceData["VertexShapeFunction", "Concave"]}]

Draw individual vertices:

Wolfram Language code: CompleteGraph[4, VertexShapeFunction -> { 1 -> "Square"}, VertexSize -> 0.2]

Combine with a default vertex function:

Wolfram Language code: CompleteGraph[4, VertexShapeFunction -> { 1 -> "Square", "Triangle"}, VertexSize -> 0.2]

Draw vertices using a predefined graphic:

Wolfram Language code: CompleteGraph[4, VertexShapeFunction -> (Inset[[image], #]&)]

Draw vertices by running a program:

Wolfram Language code: vf[{xc_, yc_}, name_, {w_, h_}] := Block[{xmin = xc - w, xmax = xc + w, ymin = yc - h, ymax = yc + h}, Polygon[{{xmin, ymin}, {xmax, ymax}, {xmin, ymax}, {xmax, ymin}}] ];
Wolfram Language code: CompleteGraph[4, VertexShapeFunction -> vf, VertexSize -> 0.2]

VertexShapeFunction can be combined with VertexStyle:

Wolfram Language code: vf1[{xc_, yc_}, name_, {w_, h_}] := Rectangle[{xc - w, yc - h}, {xc + w, yc + h}]
Wolfram Language code: CompleteGraph[4, VertexSize -> 0.2, VertexStyle -> Blue, VertexShapeFunction -> vf1]

VertexShapeFunction has higher priority than VertexStyle:

Wolfram Language code: vf2[{xc_, yc_}, name_, {w_, h_}] := {Red, Rectangle[{xc - w, yc - h}, {xc + w, yc + h}]}
Wolfram Language code: CompleteGraph[4, VertexSize -> 0.2, VertexStyle -> Blue, VertexShapeFunction -> vf2]

VertexShapeFunction can be combined with VertexSize:

Wolfram Language code: CompleteGraph[4, VertexShapeFunction -> "Star", VertexSize -> {1 -> Small, Medium}]

VertexShapeFunction has higher priority than VertexShape:

Wolfram Language code: CompleteGraph[4, VertexSize -> 0.3, VertexShapeFunction -> "Star", VertexShape -> [image]]

VertexSize  (8)

By default, the size of vertices is computed automatically:

Wolfram Language code: CompleteGraph[5, VertexSize -> Automatic]

Specify the size of all vertices using symbolic vertex size:

Wolfram Language code: Table[CompleteGraph[5, VertexSize -> s, PlotLabel -> s], {s, {Tiny, Small, Medium, Large}}]

Use a fraction of the minimum distance between vertex coordinates:

Wolfram Language code: Table[CompleteGraph[5, VertexSize -> s, PlotLabel -> s], {s, 0.1, 1, 0.3}]

Use a fraction of the overall diagonal for all vertex coordinates:

Wolfram Language code: Table[CompleteGraph[5, VertexSize -> {"Scaled", s}, PlotLabel -> {"Scaled", s}], {s, 0.1, 1, 0.3}]

Specify size in both the and directions:

Wolfram Language code: Table[CompleteGraph[5, VertexSize -> s, PlotLabel -> s], {s, {{0.1, 0.2}, {0.2, 0.1}}}]

Specify the size for individual vertices:

Wolfram Language code: CompleteGraph[4, VertexSize -> {1 -> 0.2, 2 -> 0.3}]

VertexSize can be combined with VertexShapeFunction:

Wolfram Language code: Table[CompleteGraph[5, VertexSize -> s, VertexShapeFunction -> "Square", PlotLabel -> s], {s, {0.05, 0.1, 0.2}}]

VertexSize can be combined with VertexShape:

Wolfram Language code: Table[CompleteGraph[5, VertexSize -> s, VertexShape -> [image], PlotLabel -> s], {s, {0.1, 0.2, 0.4}}]

VertexStyle  (5)

Style all vertices:

Wolfram Language code: Table[CompleteGraph[4, VertexStyle -> style, VertexSize -> 0.3, PlotLabel -> style], {style, {Yellow, EdgeForm[Dashed]}}]

Style individual vertices:

Wolfram Language code: CompleteGraph[4, VertexStyle -> {1 -> Blue, 2 -> Red}, VertexSize -> 0.2]

VertexShapeFunction can be combined with VertexStyle:

Wolfram Language code: vf1[{xc_, yc_}, name_, {w_, h_}] := Rectangle[{xc - w, yc - h}, {xc + w, yc + h}]
Wolfram Language code: CompleteGraph[4, VertexSize -> 0.2, VertexStyle -> Blue, VertexShapeFunction -> vf1]

VertexShapeFunction has higher priority than VertexStyle:

Wolfram Language code: vf2[{xc_, yc_}, name_, {w_, h_}] := {Red, Rectangle[{xc - w, yc - h}, {xc + w, yc + h}]}
Wolfram Language code: CompleteGraph[4, VertexSize -> 0.2, VertexStyle -> Blue, VertexShapeFunction -> vf2]

VertexStyle can be combined with BaseStyle:

Wolfram Language code: CompleteGraph[4, VertexStyle -> LightBlue, BaseStyle -> EdgeForm[Dotted], VertexSize -> 0.2]

VertexStyle has higher priority than BaseStyle:

Wolfram Language code: CompleteGraph[4, VertexStyle -> LightBlue, BaseStyle -> Gray, VertexSize -> 0.2]

VertexShape is not affected by VertexStyle:

Wolfram Language code: CompleteGraph[5, VertexSize -> 0.2, VertexShape -> [image], VertexStyle -> Blue]

VertexWeight  (2)

Set the weight for all vertices:

Wolfram Language code: CompleteGraph[3, VertexWeight -> {2, 3, 4}]
Wolfram Language code: AnnotationValue[{%, 1}, VertexWeight]

Use any numeric expression as a weight:

Wolfram Language code: CompleteGraph[3, VertexWeight -> {a, b, c}]
Wolfram Language code: AnnotationValue[{%, 1}, VertexWeight]

Applications  (7)

The GraphCenter of a complete graph includes all its vertices:

Wolfram Language code: Table[HighlightGraph[#, GraphCenter[#]]&[CompleteGraph[i, VertexSize -> Small]], {i, 3, 6}]

The GraphPeriphery includes all vertices:

Wolfram Language code: Table[HighlightGraph[#, GraphPeriphery[#]]&[CompleteGraph[i, VertexSize -> Small]], {i, 3, 6}]

The VertexEccentricity for all vertices is 1:

Wolfram Language code: VertexEccentricity[CompleteGraph[5], #]& /@ VertexList[CompleteGraph[5]]

Highlight the vertex eccentricity path:

Wolfram Language code: FindVertexEccentricityPath[g_ ? UndirectedGraphQ, u_] /; MemberQ[VertexList[g], u] := Module[{d = GraphDistanceMatrix[g], posu, posv, vl = VertexList[g]}, posu = VertexIndex[g, u]; posv = First@First@Position[d[[posu]], Max[d[[posu]]]]; PathGraph[FindShortestPath[g, u, vl[[posv]]]]]
Wolfram Language code: Table[HighlightGraph[g = CompleteGraph[4], FindVertexEccentricityPath[g, u]], {u, Range[4]}]

The GraphRadius is 1:

Wolfram Language code: Table[GraphRadius[CompleteGraph[i]], {i, 3, 6}]

Highlight the radius path:

Wolfram Language code: FindRadiusPath[g_ ? UndirectedGraphQ] := Module[{c = First@GraphCenter[g], d, v, pos}, d = Table[GraphDistance[g, c, u], {u, VertexList[g]}]; pos = First@Position[d, Max[d]]; v = First@Part[VertexList[g], pos]; PathGraph[FindShortestPath[g, c, v]]]
Wolfram Language code: Table[HighlightGraph[#, FindRadiusPath[#]]&[CompleteGraph[i, VertexSize -> Small]], {i, 3, 6}]

The GraphDiameter is 1:

Wolfram Language code: Table[GraphDiameter[CompleteGraph[i]], {i, 3, 6}]

Highlight the diameter path:

Wolfram Language code: FindDiameterPath[g_ ? UndirectedGraphQ] := Module[{d = GraphDistanceMatrix[g], u, v, pos}, pos = First@Position[d, Max[d]]; {u, v} = Part[VertexList[g], pos]; PathGraph[FindShortestPath[g, u, v]]]
Wolfram Language code: Table[HighlightGraph[#, FindDiameterPath[#]]&[CompleteGraph[i, VertexSize -> Small]], {i, 3, 6}]

Vertex connectivity from to is the number of vertex-independent paths from to :

Wolfram Language code: g = CompleteGraph[4, VertexLabels -> "Name"]

There are 3 vertex-independent paths between any pair of vertices:

Wolfram Language code: {HighlightGraph[g, 12], HighlightGraph[g, PathGraph[{1, 3, 2}]], HighlightGraph[g, PathGraph[{1, 4, 2}]]}

The vertex connectivity for CompleteGraph[n] is :

Wolfram Language code: g = CompleteGraph[5, VertexLabels -> "Name"];
Wolfram Language code: {HighlightGraph[g, PathGraph[{1, 2}]], HighlightGraph[g, PathGraph[{1, 3, 2}]], HighlightGraph[g, PathGraph[{1, 4, 2}]], HighlightGraph[g, PathGraph[{1, 5, 2}]] }

Highlight the vertex degree for CompleteGraph:

Wolfram Language code: HighlightCentrality[g_, cc_] := HighlightGraph[g, Table[Style[VertexList[g][[i]], ColorData["TemperatureMap"][cc[[i]] / Max[cc]]], {i, VertexCount[g]}]];
Wolfram Language code: g = CompleteGraph[8, VertexSize -> Large];
Wolfram Language code: HighlightCentrality[g, VertexDegree[g]]

Highlight the closeness centrality:

Wolfram Language code: HighlightCentrality[g, ClosenessCentrality[g]]

Highlight the eigenvector centrality:

Wolfram Language code: HighlightCentrality[g, EigenvectorCentrality[g]]

Properties & Relations  (12)

Number of vertices of CompleteGraph[n]:

Wolfram Language code: VertexCount[CompleteGraph[n]]

Number of edges of CompleteGraph[n]:

Wolfram Language code: EdgeCount[CompleteGraph[n]]

A complete graph is an -regular graph:

Wolfram Language code: CompleteGraph[6]
Wolfram Language code: VertexDegree[%]

The subgraph of a complete graph is a complete graph:

Wolfram Language code: g = CompleteGraph[8]
Wolfram Language code: HighlightGraph[g, h = Subgraph[g, Range[5]]]
Wolfram Language code: CompleteGraphQ[h]

The neighborhood of a vertex in a complete graph is the graph itself:

Wolfram Language code: CompleteGraph[8, VertexSize -> {1 -> 0.2}]
Wolfram Language code: HighlightGraph[%, NeighborhoodGraph[%, 1]]

Complete graphs are their own cliques:

Wolfram Language code: CompleteGraph[5]
Wolfram Language code: Subgraph[%, First[FindClique[%]]]

The GraphComplement of a complete graph with no edges:

Wolfram Language code: GraphComplement[CompleteGraph[5]]

For a complete graph, all entries outside the diagonal are 1s in the AdjacencyMatrix:

Wolfram Language code: AdjacencyMatrix[CompleteGraph[25]]//MatrixPlot

For a complete -partite graph, all entries outside the block diagonal are 1s:

Wolfram Language code: AdjacencyMatrix[CompleteGraph[{1, 2, 3, 4, 5}]]//MatrixPlot

The complete graph is the cycle graph :

Wolfram Language code: {CompleteGraph[3], CycleGraph[3]}

The complete graph is the wheel graph :

Wolfram Language code: {CompleteGraph[4], WheelGraph[4]}

The complete graph is the line graph of the star graph :

Wolfram Language code: {CompleteGraph[6], LineGraph[StarGraph[7]]}

Neat Examples  (2)

Random collage of complete graphs:

Wolfram Language code: Graphics[Table[Inset[CompleteGraph[RandomInteger[{4, 8}]], RandomReal[{0, 10}, 2], Automatic, 1], {75}]]

Coloring cycle decompositions in complete graphs on a prime number of vertices:

Wolfram Language code: ColoringCycles[n_] := Block[{i, e}, e = Table[Mod[#, n, 1]Mod[# + i, n, 1]& /@ Range[n], {i, (n - 1) / 2}]; HighlightGraph[CompleteGraph[n], Table[Style[e[[i]], ColorData[1][i]], {i, Length[e]}]] ]
Wolfram Language code: Table[ColoringCycles[i], {i, {3, 5, 7, 9, 11, 13}}]

See Also

Graph  GraphData  GraphComplement  CompleteGraphQ

Related Guides

    ▪
  • Graph Construction & Representation
  • ▪
  • Graphs & Networks

Related Links

  • An Elementary Introduction to the Wolfram Language : Graphs and Networks

History

Introduced in 2010 (8.0) | Updated in 2020 (12.2)

Wolfram Research (2010), CompleteGraph, Wolfram Language function, https://reference.wolfram.com/language/ref/CompleteGraph.html (updated 2020).

Text

Wolfram Research (2010), CompleteGraph, Wolfram Language function, https://reference.wolfram.com/language/ref/CompleteGraph.html (updated 2020).

CMS

Wolfram Language. 2010. "CompleteGraph." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/CompleteGraph.html.

APA

Wolfram Language. (2010). CompleteGraph. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CompleteGraph.html

BibTeX

@misc{reference.wolfram_2026_completegraph, author="Wolfram Research", title="{CompleteGraph}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/CompleteGraph.html}", note=[Accessed: 01-September-2026]}

BibLaTeX

@online{reference.wolfram_2026_completegraph, organization={Wolfram Research}, title={CompleteGraph}, year={2020}, url={https://reference.wolfram.com/language/ref/CompleteGraph.html}, note=[Accessed: 01-September-2026]}

Top
Introduction for Programmers
Introductory Book
Wolfram Function Repository | Wolfram Data Repository | Wolfram Data Drop | Wolfram Language Products
Top
  • Products
  • Wolfram|One
  • Mathematica
  • AI Access
  • Compute Services
  • System Modeler

  • Wolfram|Alpha Notebook Edition
  • Wolfram|Alpha Pro
  • Mobile Apps

  • Wolfram Engine
  • Wolfram Player

  • Volume & Site Licensing
  • Server Deployment Options
  • Consulting
  • Wolfram Consulting
  • Repositories
  • Data Repository
  • Function Repository
  • Community Paclet Repository
  • Neural Net Repository
  • Prompt Repository

  • Wolfram Language Example Repository
  • Notebook Archive
  • Wolfram GitHub
  • Learning
  • Wolfram U
  • Wolfram Language Documentation
  • Webinars & Training
  • Educational Programs

  • Wolfram Language Introduction
  • Fast Introduction for Programmers
  • Fast Introduction for Math Students
  • Books

  • Wolfram Community
  • Wolfram Blog
  • Public Resources
  • Wolfram|Alpha
  • Wolfram Problem Generator
  • Wolfram Challenges

  • Computer-Based Math
  • Computational Thinking
  • Computational Adventures

  • Demonstrations Project
  • Wolfram Data Drop
  • MathWorld
  • Wolfram Science
  • Wolfram Media Publishing
  • Customer Resources
  • Store
  • Product Downloads
  • User Portal
  • Your Account
  • Organization Access

  • Support FAQ
  • Contact Support
  • Company
  • About Wolfram
  • Careers
  • Contact
  • Events
Wolfram Community Wolfram Blog
Legal & Privacy Policy
WolframAlpha.com | WolframCloud.com
© 2026 Wolfram
© 2026 Wolfram | Legal & Privacy Policy |
English