Re: Include unconnected nodes in graph plot -- how?
- To: mathgroup at smc.vnet.net
- Subject: [mg112423] Re: Include unconnected nodes in graph plot -- how?
- From: István Zachar <zac at freemail.hu>
- Date: Wed, 15 Sep 2010 04:38:03 -0400 (EDT)
- References: <i6neen$gac$1@smc.vnet.net>
Hi Szabolcs, I've just dealt with a similar problem, here is my solution, which involves the definition of a new structure, Graph, which of course can be easily omitted. Remove[Graph, NodeLabels]; graph = Graph[{{0, 1, 0, 0, 0}, {0, 0, 1, 0, 0}, {0, 0, 1, 0, 1}, {0, 0, 0, 0, 0}, {0, 0, 1, 0, 0}}, NodeLabels -> {"A", "B", "C", "D", "E"}] LayeredGraphPlot[First@graph, VertexLabeling -> True, VertexRenderingFunction :> (Inset[ Framed[Part[NodeLabels /. Rest[List @@ graph], #2], Rule[Background, RGBColor[1, 1, 0.8]], Rule[FrameStyle, RGBColor[0.94, 0.85, 0.36]]], #1] &), SelfLoopStyle -> True, MultiedgeStyle -> True, PackingMethod -> "ClosestPacking", Frame -> True, AspectRatio -> 1 ]