New in Wolfram
Mathematica
8: Graph & Network Modeling
◄
previous
|
next
►
Application Areas
Pack Disconnected Components
Specify how disconnected components of a graph should be packed together.
In[1]:=
X
packing = {"ClosestPacking", "ClosestPackingCenter", "Layered", "LayeredLeft", "LayeredTop", "NestedGrid"};
In[2]:=
X
edges = Union[ Flatten[Table[ Table[j \[UndirectedEdge] FromDigits[Insert[IntegerDigits[j, 2], 1, i], 2], {i, Length[IntegerDigits[j, 2]] + 1}], {j, 1, 80}]]];
In[3]:=
X
Grid[Flatten[{Style[#, 11, FontFamily -> "Verdana"] & /@ #, Table[Graph[edges, GraphLayout -> {"PackingLayout" -> pm}, BaselinePosition -> Top], {pm, #}]} & /@ Partition[packing, {3}], 1], Frame -> {All, {True, False, True, False}}, FrameStyle -> LightGray, Spacings -> {.5, {{2, 1}}}]
Out[3]=