# LineGraph Labels

I have a graph with labels on the edges:

ilGrafo=Graph[{1 <-> 2, 1 <-> 3,
2 <-> 3, 3 <-> 4, 4 <-> 5,
4 <-> 6, 4 <-> 7,
6 <-> 7},
EdgeLabels -> {1 <-> 2 -> "A",
1 <-> 3 -> "B", 2 <-> 3 -> "C",
3 <-> 4 -> "E", 4 <-> 5 -> "E",
4 <-> 6 -> "E", 4 <-> 7 -> "G",
6 <-> 7 -> "H"}]


I would like to obtain the LineGraph[ilGrafo] with the corresponding edge name on the vertices, but I am not able to find the way.

-
LineGraph[#, EdgeLabels -> PropertyValue[#, EdgeLabels]] &[ilGrafo] – Öskå Aug 29 '13 at 14:36

I guess that somone has to answer it.

ilGrafo=Graph[
{1 <-> 2, 1 <-> 3, 2 <-> 3, 3 <-> 4, 4 <-> 5, 4 <-> 6, 4 <-> 7, 6 <-> 7},
EdgeLabels -> {1 <-> 2 -> "A", 1 <-> 3 -> "B", 2 <-> 3 -> "C", 3 <-> 4 -> "E",
4 <-> 5 -> "E", 4 <-> 6 -> "E", 4 <-> 7 -> "G", 6 <-> 7 -> "H"}]


giving

In order to keep the EdgeLabels while applying LineGraph you can use:

LineGraph[#, EdgeLabels -> PropertyValue[#, EdgeLabels]] &[ilGrafo]


giving

-
Thanks for the answer, however the ilGrafo edge labels do not correspond to the LineGraph vertex labels. – Roberto D'Autilia Sep 1 '13 at 7:18

I think the function should be like this:

LabeledLineGraph[graph_] :=
Module[{m = IncidenceMatrix[graph], length = EdgeCount[graph]},

The result of LabeledLineGraph[ilGrafo] is as follows: