MathGroup Archive 2006

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

Search the Archive

Re: tab-delimited file to graph

  • To: mathgroup at
  • Subject: [mg69472] Re: tab-delimited file to graph
  • From: "David Reiss" <dbreiss at>
  • Date: Wed, 13 Sep 2006 04:03:08 -0400 (EDT)
  • References: <ee64q5$7s4$>

In[1]:= list={{v1 ,   v2 },{v2,    v3 },{v3,    v1 },{v1 ,   v4 }}

Out[1]= {{v1,v2},{v2,v3},{v3,v1},{v1,v4}}

In[2]:= MapThread[Rule,Transpose[list]]

Out[2]= {v1->v2,v2->v3,v3->v1,v1->v4}


aitor69gonzalez at wrote:
> Hello,
> I have a directed graph "mygraph" in a tab delimited file that looks
> like this:
> v1    v2
> v2    v3
> v3    v1
> v1    v4
> I would like to import this graph into mathematica, so that I can take
> advantage of the -DiscreteMath`Combinatorica`- functions. So far, I was
> only able to import it with Import["mygraph","TSV"] into a list of
> two-item lists. Now, I am stuck there. Can somebody help me to convert
> this list of two-item lists into a matrix or adjacency list of a
> directed graph?
> Thank you in advance,
> Aitor

  • Prev by Date: Re: extract homogenous solution from DSolve?
  • Next by Date: question on changing 'type' of numbers
  • Previous by thread: tab-delimited file to graph
  • Next by thread: Re: tab-delimited file to graph