New in Wolfram
Mathematica
8: Graph & Network Analysis
◄
previous
|
next
►
Application Areas
Center, Periphery, and Distance Functions
Mathematica
8 provides functions related to minimum and maximum vertex eccentricities.
In[1]:=
X
g = \!\(\* GraphicsBox[ NamespaceBox["NetworkGraphics", DynamicModuleBox[{Typeset`graph = HoldComplete[ Graph[{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, {{{1, 3}, {1, 8}, {2, 4}, {2, 7}, {3, 10}, {4, 6}, {5, 7}, {6, 13}, {7, 14}, {8, 9}, {10, 11}, {13, 14}, {14, 8}, { 6, 1}, {9, 2}, {5, 3}, {11, 4}, {12, 5}, {10, 9}, {12, 11}, {13, 12}}, Null}, { EdgeShapeFunction -> {"Arrow"}, EdgeStyle -> { Directive[ Thickness[Large], Arrowheads[Medium]]}, VertexSize -> {Medium}, VertexCoordinates -> {{0.7818314824680297, 0.6234898018587336}, { 0.9749279121818236, -0.22252093395631434`}, { 0.43388373911755823`, -0.900968867902419}, \ {-0.433883739117558, -0.9009688679024191}, {-0.9749279121818235, \ -0.2225209339563146}, {-0.7818314824680299, 0.6234898018587334}, {-2.4492935982947064`*^-16, 1.}, { 1.5636629649360594`, 1.2469796037174672`}, { 1.9498558243636472`, -0.4450418679126287}, { 0.8677674782351165, -1.801937735804838}, \ {-0.867767478235116, -1.8019377358048383`}, {-1.949855824363647, \ -0.4450418679126292}, {-1.5636629649360598`, 1.2469796037174667`}, {-4.898587196589413*^-16, 2.}}}]], Typeset`boxes = GraphicsGroupBox[{{ Directive[ Hue[0.6, 0.2, 0.8], EdgeForm[ Directive[ GrayLevel[0], Opacity[0.7]]]], TagBox[ DiskBox[{0.7818314824680297, 0.6234898018587336}, 0.08677674782351162], "DynamicName", BoxID -> "VertexID$1"], TagBox[ DiskBox[{0.9749279121818236, -0.22252093395631434`}, 0.08677674782351162], "DynamicName", BoxID -> "VertexID$2"], TagBox[ DiskBox[{0.43388373911755823`, -0.900968867902419}, 0.08677674782351162], "DynamicName", BoxID -> "VertexID$3"], TagBox[ DiskBox[{-0.433883739117558, -0.9009688679024191}, 0.08677674782351162], "DynamicName", BoxID -> "VertexID$4"], TagBox[ DiskBox[{-0.9749279121818235, -0.2225209339563146}, 0.08677674782351162], "DynamicName", BoxID -> "VertexID$5"], TagBox[ DiskBox[{-0.7818314824680299, 0.6234898018587334}, 0.08677674782351162], "DynamicName", BoxID -> "VertexID$6"], TagBox[ DiskBox[{-2.4492935982947064`*^-16, 1.}, 0.08677674782351162], "DynamicName", BoxID -> "VertexID$7"], TagBox[ DiskBox[{1.5636629649360594`, 1.2469796037174672`}, 0.08677674782351162], "DynamicName", BoxID -> "VertexID$8"], TagBox[ DiskBox[{1.9498558243636472`, -0.4450418679126287}, 0.08677674782351162], "DynamicName", BoxID -> "VertexID$9"], TagBox[ DiskBox[{0.8677674782351165, -1.801937735804838}, 0.08677674782351162], "DynamicName", BoxID -> "VertexID$10"], TagBox[ DiskBox[{-0.867767478235116, -1.8019377358048383`}, 0.08677674782351162], "DynamicName", BoxID -> "VertexID$11"], TagBox[ DiskBox[{-1.949855824363647, -0.4450418679126292}, 0.08677674782351162], "DynamicName", BoxID -> "VertexID$12"], TagBox[ DiskBox[{-1.5636629649360598`, 1.2469796037174667`}, 0.08677674782351162], "DynamicName", BoxID -> "VertexID$13"], TagBox[ DiskBox[{-4.898587196589413*^-16, 2.}, 0.08677674782351162], "DynamicName", BoxID -> "VertexID$14"]}, { Directive[ Opacity[0.7], Hue[0.6, 0.7, 0.5]], Directive[ Thickness[Large], Arrowheads[Medium]], StyleBox[{ ArrowBox[{ DynamicLocation["VertexID$1", Automatic, Center], DynamicLocation["VertexID$3", Automatic, Center]}]}, Directive[ Thickness[Large], Arrowheads[Medium]], StripOnInput -> False], StyleBox[{ ArrowBox[{ DynamicLocation["VertexID$1", Automatic, Center], DynamicLocation["VertexID$8", Automatic, Center]}]}, Directive[ Thickness[Large], Arrowheads[Medium]], StripOnInput -> False], StyleBox[{ ArrowBox[{ DynamicLocation["VertexID$2", Automatic, Center], DynamicLocation["VertexID$4", Automatic, Center]}]}, Directive[ Thickness[Large], Arrowheads[Medium]], StripOnInput -> False], StyleBox[{ ArrowBox[{ DynamicLocation["VertexID$2", Automatic, Center], DynamicLocation["VertexID$7", Automatic, Center]}]}, Directive[ Thickness[Large], Arrowheads[Medium]], StripOnInput -> False], StyleBox[{ ArrowBox[{ DynamicLocation["VertexID$3", Automatic, Center], DynamicLocation["VertexID$10", Automatic, Center]}]}, Directive[ Thickness[Large], Arrowheads[Medium]], StripOnInput -> False], StyleBox[{ ArrowBox[{ DynamicLocation["VertexID$4", Automatic, Center], DynamicLocation["VertexID$6", Automatic, Center]}]}, Directive[ Thickness[Large], Arrowheads[Medium]], StripOnInput -> False], StyleBox[{ ArrowBox[{ DynamicLocation["VertexID$5", Automatic, Center], DynamicLocation["VertexID$7", Automatic, Center]}]}, Directive[ Thickness[Large], Arrowheads[Medium]], StripOnInput -> False], StyleBox[{ ArrowBox[{ DynamicLocation["VertexID$5", Automatic, Center], DynamicLocation["VertexID$3", Automatic, Center]}]}, Directive[ Thickness[Large], Arrowheads[Medium]], StripOnInput -> False], StyleBox[{ ArrowBox[{ DynamicLocation["VertexID$6", Automatic, Center], DynamicLocation["VertexID$13", Automatic, Center]}]}, Directive[ Thickness[Large], Arrowheads[Medium]], StripOnInput -> False], StyleBox[{ ArrowBox[{ DynamicLocation["VertexID$6", Automatic, Center], DynamicLocation["VertexID$1", Automatic, Center]}]}, Directive[ Thickness[Large], Arrowheads[Medium]], StripOnInput -> False], StyleBox[{ ArrowBox[{ DynamicLocation["VertexID$7", Automatic, Center], DynamicLocation["VertexID$14", Automatic, Center]}]}, Directive[ Thickness[Large], Arrowheads[Medium]], StripOnInput -> False], StyleBox[{ ArrowBox[{ DynamicLocation["VertexID$8", Automatic, Center], DynamicLocation["VertexID$9", Automatic, Center]}]}, Directive[ Thickness[Large], Arrowheads[Medium]], StripOnInput -> False], StyleBox[{ ArrowBox[{ DynamicLocation["VertexID$9", Automatic, Center], DynamicLocation["VertexID$2", Automatic, Center]}]}, Directive[ Thickness[Large], Arrowheads[Medium]], StripOnInput -> False], StyleBox[{ ArrowBox[{ DynamicLocation["VertexID$10", Automatic, Center], DynamicLocation["VertexID$11", Automatic, Center]}]}, Directive[ Thickness[Large], Arrowheads[Medium]], StripOnInput -> False], StyleBox[{ ArrowBox[{ DynamicLocation["VertexID$10", Automatic, Center], DynamicLocation["VertexID$9", Automatic, Center]}]}, Directive[ Thickness[Large], Arrowheads[Medium]], StripOnInput -> False], StyleBox[{ ArrowBox[{ DynamicLocation["VertexID$11", Automatic, Center], DynamicLocation["VertexID$4", Automatic, Center]}]}, Directive[ Thickness[Large], Arrowheads[Medium]], StripOnInput -> False], StyleBox[{ ArrowBox[{ DynamicLocation["VertexID$12", Automatic, Center], DynamicLocation["VertexID$5", Automatic, Center]}]}, Directive[ Thickness[Large], Arrowheads[Medium]], StripOnInput -> False], StyleBox[{ ArrowBox[{ DynamicLocation["VertexID$12", Automatic, Center], DynamicLocation["VertexID$11", Automatic, Center]}]}, Directive[ Thickness[Large], Arrowheads[Medium]], StripOnInput -> False], StyleBox[{ ArrowBox[{ DynamicLocation["VertexID$13", Automatic, Center], DynamicLocation["VertexID$14", Automatic, Center]}]}, Directive[ Thickness[Large], Arrowheads[Medium]], StripOnInput -> False], StyleBox[{ ArrowBox[{ DynamicLocation["VertexID$13", Automatic, Center], DynamicLocation["VertexID$12", Automatic, Center]}]}, Directive[ Thickness[Large], Arrowheads[Medium]], StripOnInput -> False], StyleBox[{ ArrowBox[{ DynamicLocation["VertexID$14", Automatic, Center], DynamicLocation["VertexID$8", Automatic, Center]}]}, Directive[ Thickness[Large], Arrowheads[Medium]], StripOnInput -> False]}}]}, DynamicBox[GraphComputation`NetworkGraphicsBox[ 1, Typeset`graph, Typeset`boxes], { CachedValue :> Typeset`boxes, SingleEvaluation -> True, SynchronousUpdating -> False, TrackedSymbols :> {}}, ImageSizeCache->{{2.140000000000006, 154.86}, {-76.98560000000003, 72.11654463499247}}]]], DefaultBaseStyle->{ "NetworkGraphics", FrontEnd`GraphicsHighlightColor -> Hue[0.8, 1., 0.6]}, FrameTicks->None, ImageSize->{158., Automatic}]\);
In[2]:=
X
text[s_] := Style[s, 12, FontFamily -> "Verdana"]
In[3]:=
X
Row[{g, Grid[{ {text["Vertex count: "], ToString[VertexCount[g]]}, {text["Edge count: "], ToString[EdgeCount[g]]}, {text["Weighted: "], ToString[WeightedGraphQ[g]]}, {text["Strongly connected: "], ToString[ConnectedGraphQ[g]]}, {text["Radius: "], ToString[GraphRadius[g]]}, {text["Diameter: "], ToString[GraphDiameter[g]]}, {text["Center: "], ToString[First @ GraphCenter[g]]}, {text["Periphery: "], ToString[First @ GraphPeriphery[g]]}}, Alignment -> Left]}, Spacer[20]]
Out[3]=