MathGroup Archive 2009

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

Search the Archive

Re: FromAdjacencyMatrix / FromAdjacencyLists - broken?

  • To: mathgroup at
  • Subject: [mg104379] Re: [mg104192] FromAdjacencyMatrix / FromAdjacencyLists - broken?
  • From: David Bevan <david.bevan at>
  • Date: Thu, 29 Oct 2009 02:59:49 -0500 (EST)

I see the problem (on 32-bit Windows).

Looking at the Combinatorica code, the problem seems to be in the call to
SetGraphOptions[g, EdgeDirection -> True] which apparently normalises the edge list by sorting if the source graph is undirected before making the result directed:

In[]:= g1=Cycle[3,Type->Directed];
In[]:= List@@g1
Out[]= {{{{1,2}},{{2,3}},{{3,1}}},{{{-0.5,0.866025}},{{-0.5,-0.866025}},{{1.,0}}},EdgeDirection->True}

In[]:= g2=SetGraphOptions[g1, EdgeDirection -> False];
In[]:= List@@g2
Out[]= {{{{1,2}},{{2,3}},{{3,1}}},{{{-0.5,0.866025}},{{-0.5,-0.866025}},{{1.,0}}},EdgeDirection->False}

In[]:= g3=SetGraphOptions[g2, EdgeDirection -> False];
In[]:= List@@g3
Out[]= {{{{1,2}},{{2,3}},{{1,3}}},{{{-0.5,0.866025}},{{-0.5,-0.866025}},{{1.,0}}},EdgeDirection->False}

Note that g3 is normalised, but g2 isn't.

FromAdjacencyMatrix should really create a directed graph directly.

I can't see why different endian-ness should affect this though.

David %^>

  • Prev by Date: Re: Re: old vs new(V7) BarChart3D
  • Next by Date: Re: problem of syntax.
  • Previous by thread: Re: ToExpression[..,TexForm] does not seem to work on some Latex commands?
  • Next by thread: Re: Version 7 Virtual Book