Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
    
LineGraph[#, EdgeLabels -> PropertyValue[#, EdgeLabels]] &[ilGrafo] –  Öskå Aug 29 '13 at 14:36
add comment

1 Answer

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

ilGrafo

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

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

giving

enter image description here

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.