# Can not label a directed-undirected graph

Posted 8 years ago
5665 Views
|
2 Replies
|
2 Total Likes
|
 Here is a directed-undirected graph (* illustration of a solution: {{1,3,4,8,9},{10,11,13,17,18},{21,23,25}} *) Clear[vL, vC] vL = Flatten[{{1, 3, 4, 8, 9}, {10, 11, 13, 17, 18}, {21, 23, 25}} ]; vC = Rule[#, ToString[#]] & /@ vL; Graph[{1 <-> 3, 1 <-> 4, 1 <-> 7, 1 <-> 9, 3 <-> 4, 3 <-> 7, 3 <-> 9, 4 <-> 7, 4 <-> 9, 7 <-> 9, 9 \[DirectedEdge] 10, 10 <-> 11, 10 <-> 13, 10 <-> 17, 10 <-> 18, 11 <-> 13, 11 <-> 17, 11 <-> 18, 13 <-> 17, 13 <-> 18, 17 <-> 18, 18 \[DirectedEdge] 21, 21 <-> 23, 21 <-> 25, 23 <-> 25}, (* VertexLabels\[Rule]vC,*) VertexSize -> Large] it displays the graphif the VertexLabels are included, In[36]:= Graph[{1 <-> 3, 1 <-> 4, 1 <-> 7, 1 <-> 9, 3 <-> 4, 3 <-> 7, 3 <-> 9, 4 <-> 7, 4 <-> 9, 7 <-> 9, 9 \[DirectedEdge] 10, 10 <-> 11, 10 <-> 13, 10 <-> 17, 10 <-> 18, 11 <-> 13, 11 <-> 17, 11 <-> 18, 13 <-> 17, 13 <-> 18, 17 <-> 18, 18 \[DirectedEdge] 21, 21 <-> 23, 21 <-> 25, 23 <-> 25}, VertexLabels -> vC, VertexSize -> Large] (* no graph graphics *) Out[36]= Graph[{1 <-> 3, 1 <-> 4, 1 <-> 7, 1 <-> 9, 3 <-> 4, 3 <-> 7, 3 <-> 9, 4 <-> 7, 4 <-> 9, 7 <-> 9, 9 \[DirectedEdge] 10, 10 <-> 11, 10 <-> 13, 10 <-> 17, 10 <-> 18, 11 <-> 13, 11 <-> 17, 11 <-> 18, 13 <-> 17, 13 <-> 18, 17 <-> 18, 18 \[DirectedEdge] 21, 21 <-> 23, 21 <-> 25, 23 <-> 25}, VertexLabels -> {1 -> "1", 3 -> "3", 4 -> "4", 8 -> "8", 9 -> "9", 10 -> "10", 11 -> "11", 13 -> "13", 17 -> "17", 18 -> "18", 21 -> "21", 23 -> "23", 25 -> "25"}, VertexSize -> Large] no graph shows up anymore. A work-around is welcomned. Thanks in advance. P.S.: A simple[r] example works Graph[{1 <-> 2, 2 <-> 3, 3 <-> 1, 3 \[DirectedEdge] 4, 4 <-> 5, 5 <-> 6, 6 <-> 4}, VertexLabels -> {1 -> "1", 2 -> "2", 3 -> "3", 4 -> "4", 5 -> "5", 6 -> "6"}]  Mathematica 10.1.0, Windows 7 64 Bit Home Premium.
2 Replies
Sort By:
Posted 7 years ago
 Behaviour once more persistent under Mathematica 10.4.1, Windows 10 Professional 64 Bit.
Posted 8 years ago
 Behaviour persistent under Mathematica 10.2.0, Windows 7 64 Bit Home Premium.