4
$\begingroup$

I try to name edges according to the nodes emerging from them and entering them. Each edge takes a specific name $e_{ij}$.

The following example illustrates what is required

Graph[{1 <-> 2, 2 <-> 4, 1 <-> 3, 3 <-> 4}, EdgeStyle -> Black, 
 VertexStyle -> Black, BaseStyle -> Gray, 
 VertexLabels -> Placed[Automatic, Center], 
 VertexLabelStyle -> Directive[White, Bold, 12], VertexSize -> .2]

enter image description here

I would like the edges to be named as in the figure below:

enter image description here

If it is possible to develop the above figure to be as in the figure below:

enter image description here

Please help, thank you.

$\endgroup$

1 Answer 1

6
$\begingroup$
Graph[{1 <-> 2, 2 <-> 4, 1 <-> 3, 3 <-> 4}, 
 EdgeStyle -> Black, 
 VertexStyle -> Black, 
 BaseStyle -> Gray, 
 VertexLabels -> Placed[Automatic, Center], 
 EdgeLabels -> {e_ :> 
   Placed[Framed[Style[Subscript["e", Row[List @@ e]], 16, Italic, Bold, White],
     Background -> Black, FrameStyle -> Black], "Middle"]}, 
 VertexLabelStyle -> Directive[White, Bold, 12], 
 VertexSize -> .2]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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