g  =  RandomTree[10]

ShowGraph[g]

Testing Vertex Options

The option VertexStyle can take on values of the form
			Shape[Size]
where Shape can be Disk or Box and Size can be Normal, Large, or Small. In addition, Size can be any real number and that will be treated as the diameter of the shape.
The default for VertexStyle is Disk[Normal].

ShowGraph[g,  VertexColor -> Blue,  
      VertexStyle -> Box[Normal]]

?VertexColor

?VertexStyle

?Box

?Disk

?Normal

ShowGraph[g,  VertexColor -> Blue,  
      VertexStyle -> Box[0.05]]

The option VertexLabel can be anything. The value "Off" is used to represent no label and this is the default. Any other value is treated as a label and will be displayed. VertexLabelPosition can take on values LowerLeft, LowerRight, UpperLeft, UpperRight, and Center. In addition, VertexLabelPosition can take on a value {x, y}, where {x, y} is treated as the offset of the label from the vertex.

ShowGraph[g,  VertexColor -> Blue,  
      VertexStyle -> Box[0.05],  VertexLabel -> "A",  
      VertexLabelColor -> White,  
      VertexLabelPosition -> Center]

?VertexLabel

?VertexLabelColor

?VertexLabelPosition

?Center

ShowGraph[g,  VertexColor -> Blue,  
      VertexStyle -> Box[0.05],  VertexLabel -> "A",  
      VertexLabelColor -> Red, 
      VertexLabelPosition -> LowerLeft]

?LowerLeft

?LowerRight

?UpperLeft

?UpperRight

ShowGraph[g,  VertexColor -> Blue,  
      VertexStyle -> Box[0.05],  VertexLabel -> "A",  
      VertexLabelColor -> Red, VertexLabelPosition -> LowerLeft,  
      VertexNumber -> On,  VertexNumberPosition -> Center,  
      VertexNumberColor -> Yellow]

?On

?Off

The example below shows all 8 vertex options.

ShowGraph[g,  VertexColor -> Blue,  
      VertexStyle -> Box[0.05],  VertexLabel -> "A",  
      VertexLabelColor -> Red, VertexLabelPosition -> LowerLeft,  
      VertexNumber -> On,  
      VertexNumberPosition -> {0.05,  0.05},  
      VertexNumberColor -> Purple]

?VertexNumber

?VertexNumberPosition

?VertexNumberColor

ShowGraph[g,  VertexColor -> Blue,  
      VertexStyle -> Box[0.05],  VertexLabel -> "A",  
      VertexLabelColor -> Red, 
      VertexLabelPosition -> {-0.04,  -0.04},  
      VertexNumber -> On,  
      VertexNumberPosition -> {0.04,  0.04},  
      VertexNumberColor -> Purple]

Here options are also set locally. Vertices 1, 2, and 3 are colored Green, 4, 5,and 6 are colored Red, etc.

ShowGraph[
      g, {{1,  2,  3,  VertexColor -> Green},  {4,  5,  6,  
          VertexColor -> Red}},  VertexColor -> Blue,  
      VertexStyle -> Box[0.05],  VertexLabel -> "A",  
      VertexLabelColor -> Red, 
      VertexLabelPosition -> {-0.04,  -0.04},  
      VertexNumber -> On,  
      VertexNumberPosition -> {0.04,  0.04},  
      VertexNumberColor -> Purple]

ShowGraph[
      g, {{1,  2,  3,  VertexColor -> Green},  {4,  5,  6,  
          VertexColor -> Red},  {7,  8,  9,  10,  
          VertexColor -> Brown}},  
      VertexNumber -> On ]

Label "v3" is missing below because it falls outside plot range.

ShowGraph[
      g, {{1,  VertexLabel -> "v1"},  {2,  
          VertexLabel -> "v2"},  {VertexLabel -> "v3"}},  
      VertexNumber -> On ]

\(ShowGraph[
      g, {{1, \ VertexLabel -> "v1"}, \ {2, \ 
          VertexLabel -> "v2"}, \ {VertexLabel -> "v3"}}]\)

Testing Edge Options

ShowGraph[g,  VertexColor -> Blue,  EdgeColor -> Red, 
      VertexStyle -> Box[0.05]]

?EdgeColor

ShowGraph[g,  VertexColor -> Blue,  EdgeColor -> Red,  
      EdgeStyle -> Thick, VertexStyle -> Box[0.05]]

?EdgeStyle

The option EdgeStyle can take on the values Thick, Normal, Thin, ThickDashed, NormalDashed, and ThinDashed.

ShowGraph[g,  VertexColor -> Blue,  EdgeColor -> Red,  
      EdgeStyle -> ThickDashed, 
      VertexStyle -> Box[0.05]]

?Thick

?Thin

?ThickDashed

?ThinDashed

ShowGraph[g,  {{{1,  9},  {4,  9},  EdgeColor -> Black}}, 
      VertexColor -> Blue,  EdgeColor -> Red,  
      EdgeStyle -> ThickDashed, 
      VertexStyle -> Box[0.05]]

ShowGraph[g,  VertexColor -> Blue,  EdgeColor -> Red,  
      VertexStyle -> Box[0.05],  EdgeLabel -> "B"]

?EdgeLabel

?EdgeLabelPosition

?EdgeLabelColor

The option EdgeLabel is like the option VertexLabel. The option EdgeLabelPosition takes on the same values as the option VertexLabelPosition. The edge label is positioned ralative to the midpoint of the edge. The dafault for EdgeLabelPosition is LowerLeft.

ShowGraph[g,  VertexColor -> Blue,  EdgeColor -> Red,  
      VertexStyle -> Box[0.05],  EdgeLabel -> "B",  
      EdgeLabelColor  ->  Green,  
      EdgeLabelPosition -> Center]

Self-loops are shown as circles passing through vertices. This example, shows that the bad positioning of edge labels of self-loops. This might be fixed in the future. This example also shows that multiple self-loops through the same vertex are handled reasonably. The option LoopPosition can take the values LowerRight, LowerLeft, UpperRight, and UpperLeft.

ShowGraph[
      AddEdges[g,  {{1,  1}, {1,  1},  {2,  2},  {2,  2}}],  
      VertexColor -> Blue,  
      EdgeColor -> Red,   EdgeLabel -> "B",  
      EdgeLabelPosition -> Center,  
      LoopPosition -> LowerRight]

?LoopPosition

Even though edge direction is typically set inside the graph data structure, it can be set in ShowGraph via the option EdgeDirection. The loops do not need arrows and so no arrows appear there.

ShowGraph[
      AddEdges[g,  {{1,  1}, {1,  1},  {2,  2},  {2,  2}}],  
      VertexColor -> Blue,  
      EdgeColor -> Red,   EdgeLabel -> "B",  
      EdgeLabelPosition -> Center,  LoopPosition -> LowerRight,  
      EdgeDirection -> On]

Other Options

All options that can be used in Plot can be used in ShowGraph as well. Similarly, all options that can be used for Arrows can be used in ShowGraph.

ShowGraph[g,  VertexColor -> Blue,  
      EdgeColor -> Red,   LoopPosition -> LowerRight,  
      Background -> Yellow]

When PlotRange takes on a real value a, a is used as the factor by which the default plot range is expanded. If the default plot range is r, it becomes r(1+a). The default value of PlotRange is Normal and this corresponds to calculating a range in which all the vertices can fit.

ShowGraph[g,  VertexColor -> Blue,  
      EdgeColor -> Red,   LoopPosition -> LowerRight,  
      Background -> Gray,  PlotRange -> 0.5]

ShowGraph[g,  VertexColor -> Blue,  
      EdgeColor -> Red,   LoopPosition -> LowerRight,  
      Background -> Gray,  PlotRange -> Zoom[{1,  2}],  
      VertexNumber -> On]

?Zoom

?GraphOptions