Re: Kernel crash?

*To*: mathgroup at smc.vnet.net*Subject*: [mg47644] Re: [mg47632] Kernel crash?*From*: "J. McKenzie Alexander" <jalex at lse.ac.uk>*Date*: Tue, 20 Apr 2004 03:18:48 -0400 (EDT)*References*: <NDBBJGNHKLMPLILOIPPOMEGDEAAA.djmp@earthlink.net>*Sender*: owner-wri-mathgroup at wolfram.com

> But why are you using All? Aren't the edge options principally for > specifying the plot rendering? Principally, but not always. Edge options can also include EdgeWeight and EdgeDirection, both of which typically have meaning beyond plot rendering. > Are you actually going to plot a graph with 39,600 edges? Not if I can help it! But I'm using the Combinatorica graph creation functions as part of a Mathematica package for local interaction models of evolutionary games. The graphs specifying the local interaction structure are first created in Combinatorica, then shovelled into a Java object via JLink to "wire up" the local interaction structure. When edges contain information like a weight or a direction, that has a intended interpretation which needs to be handled correctly. I was originally relying on Combinatorica calls like Edges[g, All] and MakeDirected[g, All] to make sure I got all necessary information. More importantly, though, there's no reason why MakeDirected[g,All] should fail with a GridGraph[100,100]. The directed graph structure - if you produce it "by hand" - only takes up around 3110000 bytes of memory. > I'm guessing that when you specify edge or vertex options, > Combinatorica goes to much less efficient internal storage. But the odd thing is that the final *output* for the the call which crashes the kernel doesn't take any more storage than the output returned by the call which doesn't. I.e., In[13]:= MakeDirected[GridGraph[10,10]]==MakeDirected[GridGraph[10,10],All] Out[13]= True And the reason for this is that there *are no* edge or vertex options originally specified for a grid graph. So the reason for the kernel crash must solely depend on differences in how MakeDirected[_] and MakeDirected[_,All] are implemented. A query to ?MakeDirected states that "Calling the function with the tag All, as MakeDirected[g, All], ensures that local options associated with each edge are inherited by both corresponding directed edges." Given this spec, the following is functionally equivalent to MakeDirected[g,All]: In[24]:= WorkingMakeDirectedAll[g_]:=Module[{edges,v,opts,newList}, edges=g[[1]]; newList=Reap[ Scan[ Function[x, Sow[x]; v=First[x]; opts=Rest[x]; Sow[Join[{Reverse[v]},opts]]; ], edges ] ]; Return[Graph[newList[[2,1]],g[[2]]]]; ] More importantly, it works: In[25]:= GridGraph[100,100] Out[25]= â??Graph:< 19800, 10000, Undirected>â?? In[26]:= WorkingMakeDirectedAll[ GridGraph[100,100] ] Out[26]= â??Graph:<39600, 10000, Undirected>â?? So there is a bug somewhere, but where? Cheers, Jason -- Dr J. McKenzie Alexander Department of Philosophy, Logic and Scientific Method London School of Economics and Political Science Houghton Street, London WC2A 2AE