Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: subgraph error (errata)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125916] Re: subgraph error (errata)
  • From: David Bailey <dave at removedbailey.co.uk>
  • Date: Sat, 7 Apr 2012 05:54:35 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jlh0l6$t5s$1@smc.vnet.net>

On 04/04/2012 09:27, dan jack wrote:
> I write an errata for the previous message:
>
> I obtain the error in this case:
>
> gg = Graph[{11 ->  2, 11 ->  3, 4 ->  11, 5->  11, 11 ->  11}]
> Subgraph[gg, 1 ->_ ]
>
> Join::headsd: Expression {11,2} at position 1 is expected to have head
> List for all subexpressions through level 11.
> DeleteDuplicates::list: List expected at position 1 in
> DeleteDuplicates[Join[{11,2},{11,3},11]].
>
> but not in this case:
> gg = Graph[{1 ->  2, 1 ->  3, 4 ->  1, 5->  1, 1->  1}]
>
> so it seems that the only difference is the vertex number: 1 works but
> 11 do not works ...very strange.
>
> Obviously the arrows are the correct Directed Edges  (ESC de ESC)...
>
> any help or solidarity comment is appreciated :-)
>

I think when you specify a subgraph using a pattern, you have to specify 
edges using the DirectedEdge construct. This actually prints rather like 
-> but there is a little blob at the left end (confusing eh?)

Thus the correct syntax is:

gr = Graph[{1 -> 2, 1 -> 3, 4 -> 1, 5 -> 1, 1 -> 1}]

Subgraph[gr, DirectedEdge[1, _]]

David Bailey
http://www.dbaileyconsultancy.co.uk




  • Prev by Date: Re: evaluate to True?
  • Next by Date: Re: numerical integration
  • Previous by thread: Re: subgraph error (errata)
  • Next by thread: Re: how to make formatted output with Grid and Print?