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
LineGraph
  • See Also
    • IncidenceMatrix
    • AdjacencyMatrix
    • GraphComplement
  • Related Guides
    • Graph Operations and Modifications
    • See Also
      • IncidenceMatrix
      • AdjacencyMatrix
      • GraphComplement
    • Related Guides
      • Graph Operations and Modifications

LineGraph[g]

gives the line graph of the graph g.

LineGraph[{vw,…}]

uses rules vw to specify the graph g.

Details and Options
Details and Options Details and Options
Background & Context
Examples  
Basic Examples  
Scope  
Properties & Relations  
Neat Examples  
See Also
Related Guides
History
Cite this Page
BUILT-IN SYMBOL
  • See Also
    • IncidenceMatrix
    • AdjacencyMatrix
    • GraphComplement
  • Related Guides
    • Graph Operations and Modifications
    • See Also
      • IncidenceMatrix
      • AdjacencyMatrix
      • GraphComplement
    • Related Guides
      • Graph Operations and Modifications

LineGraph

LineGraph[g]

gives the line graph of the graph g.

LineGraph[{vw,…}]

uses rules vw to specify the graph g.

Details and Options

  • Each vertex in LineGraph[g] corresponds to an edge in g.
  • For an undirected graph g, two vertices in LineGraph[g] are adjacent if their corresponding edges share a common vertex.
  • For a directed graph g, two vertices in LineGraph[g] are adjacent if their corresponding edges are connected, i.e. the target of one edge is the source of the other edge.
  • The vertices in LineGraph[g] are taken to be successive integers starting at 1.
  • LineGraph works with undirected graphs, directed graphs, and multigraphs.

Background & Context

  • LineGraph returns the line graph of , which is the graph whose vertices are the edges of and whose vertex adjacencies correspond to the edge adjacencies of . More formally, given a graph with edges e1,…,em, has vertices e1,…,em. For undirected , is an edge in if and are incident to the same vertex in , while for directed , is an edge in if the head of is the tail of in . A line graph is also known as an adjoint graph, conjugate graph, covering graph, derivative graph, derived graph, edge graph, edge-to-vertex dual graph, interchange graph, representative graph, or -obrazom graph.
  • Line graphs are used to translate graph theoretical results about vertices to results about edges. For example, independent edge sets in are independent vertex sets in , the edge chromatic number of is equal to the chromatic number of , etc.
  • Line graphs are connected by a number of mathematical relations to their original graphs. The simplest of these is that the number of vertices of equals the number of edges of . In addition, if is a simple graph having edges and vertices with vertex degrees d1,…,dn, then the number of edges in is . Another relation that allows explicit construction of line graphs is that for the incidence matrix of a simple graph and an m×m identity matrix, the adjacency matrix for is given by .
  • Determining whether a graph is a line graph can be done in linear time. A graph is the line graph of a simple graph or multigraph if and only if there exists a family of cliques such that each vertex in is contained in exactly two of them, and each edge in is induced by one of them. is the line graph of a simple graph if this family of cliques can be formed so that no two vertices of lie in the same two cliques.
  • There is a set of nine forbidden graphs, each having at most six vertices, such that a simple graph is a line graph of some simple graph if and only if it contains no graph in this set as an induced subgraph. This set of forbidden graphs is given by GraphData["Beineke"] and includes the complete bipartite graph , so line graphs are claw-free. Only six of these forbidden graphs are needed to characterize which simple graphs having maximum degree at least 5 are line graphs (see GraphData["Metelsky"]).
  • Many important results in graph theory characterize the properties of line graphs. For example, Vizing's theorem implies that if is a triangle-free simple graph, then the chromatic number of is either equal to or one more than the size of a maximum clique in , while König's line coloring theorem implies that the line graph of a bipartite graph is perfect (i.e. the chromatic number of every induced subgraph of equals the size of the largest clique of that subgraph).

Examples

open all close all

Basic Examples  (1)

The line graph of a complete graph:

Wolfram Language code: LineGraph[[image]]

Scope  (5)

LineGraph works with undirected graphs:

Wolfram Language code: LineGraph[[image]]

Directed graphs:

Wolfram Language code: LineGraph[[image]]

Multigraphs:

Wolfram Language code: LineGraph[[image]]

Use rules to specify the graph:

Wolfram Language code: LineGraph[{1 -> 2, 1 -> 3, 2 -> 4, 3 -> 4, 3 -> 5, 4 -> 6, 5 -> 6}]

LineGraph works with large graphs:

Wolfram Language code: g = GridGraph[{10, 10, 10, 10}];
Wolfram Language code: LineGraph[g]//EdgeCount//Timing

Properties & Relations  (11)

The number of edges in a graph is equal to the number of vertices in its line graph:

Wolfram Language code: g = PetersenGraph[5, 2]
Wolfram Language code: EdgeCount[g]
Wolfram Language code: VertexCount[LineGraph[g]]

The line graph of a connected graph is connected:

Wolfram Language code: {g = GridGraph[{3, 4}], LineGraph[g]}
Wolfram Language code: ConnectedGraphQ /@ %

The adjacency matrix of a line graph can be computed by :

Wolfram Language code: g = GridGraph[{2, 3}]
Wolfram Language code: m = IncidenceMatrix[g];
Wolfram Language code: (Transpose[m].m - 2 IdentityMatrix[EdgeCount[g]])//MatrixPlot
Wolfram Language code: AdjacencyMatrix[LineGraph[g]]//MatrixPlot

A maximum independent set in a line graph of g corresponds to the maximum matching of g:

Wolfram Language code: g = GridGraph[{2, 3}]
Wolfram Language code: FindIndependentVertexSet[LineGraph[g]]
Wolfram Language code: FindIndependentEdgeSet[g]

A cycle graph is isomorphic to its line graph:

Wolfram Language code: {g = CycleGraph[6], LineGraph[g]}
Wolfram Language code: IsomorphicGraphQ@@%

The line graph of a claw is a triangle:

Wolfram Language code: {g = CompleteGraph[{1, 3}], LineGraph[g]}

The line graph of a path is isomorphic to :

Wolfram Language code: g = PathGraph[Range[20]]
Wolfram Language code: IsomorphicGraphQ[LineGraph[g], PathGraph[Range[19]]]

The line graph of a bipartite graph is perfect:

Wolfram Language code: g = CompleteGraph[{2, 3}]
Wolfram Language code: BipartiteGraphQ[g]
Wolfram Language code: LineGraph[g]

The line graph of a Hamiltonian graph is Hamiltonian:

Wolfram Language code: {g = CompleteGraph[4], LineGraph[g]}
Wolfram Language code: HamiltonianGraphQ /@ %

The line graph of an undirected Eulerian graph is Eulerian:

Wolfram Language code: g = CompleteGraph[{2, 4}]
Wolfram Language code: EulerianGraphQ[g]
Wolfram Language code: EulerianGraphQ[LineGraph[g]]

The line graph of an Eulerian graph is Hamiltonian:

Wolfram Language code: g = CompleteGraph[5]
Wolfram Language code: EulerianGraphQ[g]
Wolfram Language code: HamiltonianGraphQ[LineGraph[g]]

Neat Examples  (1)

Compute the line graph of complete -ary trees:

Wolfram Language code: Table[LineGraph[CompleteKaryTree[n, 3]], {n, 2, 5}]

See Also

IncidenceMatrix  AdjacencyMatrix  GraphComplement

Related Guides

    ▪
  • Graph Operations and Modifications

History

Introduced in 2010 (8.0) | Updated in 2014 (10.0) ▪ 2015 (10.3)

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

Text

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

CMS

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

APA

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

BibTeX

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

BibLaTeX

@online{reference.wolfram_2026_linegraph, organization={Wolfram Research}, title={LineGraph}, year={2015}, url={https://reference.wolfram.com/language/ref/LineGraph.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