Skip to main content
deleted 65 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Graph[myEdgesGraph[ myEdges, 
  VertexLabels ->
   {vv_ : Alternatives @@> sourcesWith[{vid :>= Placed[myVertexNames[[v]]VertexInDegree[myEdges, Beforev]}, 
       Placed[myVertexNames[[v]], vid Framed[#,/. Background{0 -> RedBefore, FrameStyle_ -> None] &]After},
    v : Alternatives 
 @@ sinks :> Placed[myVertexNames[[v]], AfterFramed[#, 
   Background -> (vid /. {0 -> Framed[#Red, Background_ -> Yellow}), FrameStyle -> None] &]&]]}, 
  VertexShapeFunction -> None, VertexSize -> 0,
  GraphLayout -> {"LayeredDigraphEmbedding", "Orientation" -> Left}] 
Graph[myEdges, VertexLabels ->
   {v : Alternatives @@ sources :> Placed[myVertexNames[[v]], Before, 
         Framed[#, Background -> Red, FrameStyle -> None] &],
    v : Alternatives @@ sinks :> Placed[myVertexNames[[v]], After, 
         Framed[#, Background -> Yellow, FrameStyle -> None] &]}, 
  VertexShapeFunction -> None, VertexSize -> 0,
  GraphLayout -> {"LayeredDigraphEmbedding", "Orientation" -> Left}] 
Graph[ myEdges, 
  VertexLabels -> {v_ :> With[{vid = VertexInDegree[myEdges, v]}, 
    Placed[myVertexNames[[v]], vid /. {0 -> Before, _ -> After},  
     Framed[#, Background -> (vid /. {0 -> Red, _ -> Yellow}), FrameStyle -> None] &]]},
  VertexShapeFunction -> None, VertexSize -> 0,
  GraphLayout -> {"LayeredDigraphEmbedding", "Orientation" -> Left}] 
added 46 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Graph[myEdges, 
  VertexLabels ->
   {v : Alternatives @@ sources :> Placed[myVertexNames[[v]], Before, 
      Placed[myVertexNames[[v]], Before, Panel[# Framed[#, Background -> Red]Red, FrameStyle -> None] &],
    v : Alternatives @@ sinks :> Placed[myVertexNames[[v]], After, 
      Placed[myVertexNames[[v]], After, Panel[# Framed[#, Background -> Yellow]Yellow, FrameStyle -> None] &]}, 
  VertexShapeFunction -> None, VertexSize -> 0,
  GraphLayout -> {"LayeredDigraphEmbedding", "Orientation" -> Left}] 

enter image description hereenter image description here

Graph[myEdges, 
  VertexLabels -> {v : Alternatives @@ sources :> 
      Placed[myVertexNames[[v]], Before, Panel[#, Background -> Red] &],
    v : Alternatives @@ sinks :> 
      Placed[myVertexNames[[v]], After, Panel[#, Background -> Yellow] &]}, 
  VertexShapeFunction -> None, VertexSize -> 0,
  GraphLayout -> {"LayeredDigraphEmbedding", "Orientation" -> Left}] 

enter image description here

Graph[myEdges, VertexLabels ->
   {v : Alternatives @@ sources :> Placed[myVertexNames[[v]], Before, 
         Framed[#, Background -> Red, FrameStyle -> None] &],
    v : Alternatives @@ sinks :> Placed[myVertexNames[[v]], After, 
         Framed[#, Background -> Yellow, FrameStyle -> None] &]}, 
  VertexShapeFunction -> None, VertexSize -> 0,
  GraphLayout -> {"LayeredDigraphEmbedding", "Orientation" -> Left}] 

enter image description here

added 493 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

Update 3: Yet another alternative:

Graph[myEdges, 
  VertexLabels -> {v : Alternatives @@ sources :> 
      Placed[myVertexNames[[v]], Before, Panel[#, Background -> Red] &],
    v : Alternatives @@ sinks :> 
      Placed[myVertexNames[[v]], After, Panel[#, Background -> Yellow] &]}, 
  VertexShapeFunction -> None, VertexSize -> 0,
  GraphLayout -> {"LayeredDigraphEmbedding", "Orientation" -> Left}] 

enter image description here

Update 2: An alternative VertexShapeFunction

Update 2: An alternative VertexShapeFunction

Update 3: Yet another alternative:

Graph[myEdges, 
  VertexLabels -> {v : Alternatives @@ sources :> 
      Placed[myVertexNames[[v]], Before, Panel[#, Background -> Red] &],
    v : Alternatives @@ sinks :> 
      Placed[myVertexNames[[v]], After, Panel[#, Background -> Yellow] &]}, 
  VertexShapeFunction -> None, VertexSize -> 0,
  GraphLayout -> {"LayeredDigraphEmbedding", "Orientation" -> Left}] 

enter image description here

Update 2: An alternative VertexShapeFunction

deleted 258 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
added 515 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
added 682 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
added 681 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
added 542 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading