next | previous | forward | backward | up | index | toc

lineGraph -- Returns the line graph of an undirected graph

Synopsis

• Usage:
L = lineGraph G
• Inputs:
• G, ,
• Outputs:
• L, , The line graph of G

Description

The line graph L of an undirected graph G is the graph whose vertex set is the edge set of the original graph G and in which two vertices are adjacent if their corresponding edges share a common endpoint in G.

 i1 : G = graph({{1,2},{2,3},{3,4},{4,1},{1,3},{4,2}},EntryMode=>"edges") o1 = Graph{1 => {2, 3, 4}} 2 => {1, 3, 4} 3 => {1, 2, 4} 4 => {1, 2, 3} o1 : Graph i2 : lineGraph G o2 = Graph{set {1, 2} => {set {1, 3}, set {1, 4}, set {2, 3}, set {2, 4}}} set {1, 3} => {set {1, 2}, set {1, 4}, set {2, 3}, set {3, 4}} set {1, 4} => {set {1, 2}, set {1, 3}, set {2, 4}, set {3, 4}} set {2, 3} => {set {1, 2}, set {1, 3}, set {2, 4}, set {3, 4}} set {2, 4} => {set {1, 2}, set {1, 4}, set {2, 3}, set {3, 4}} set {3, 4} => {set {1, 3}, set {1, 4}, set {2, 3}, set {2, 4}} o2 : Graph

Ways to use lineGraph :

• "lineGraph(Graph)"

For the programmer

The object lineGraph is .