

hi
  thanks for your suggestion and reply. let me try it out.

With Warm Wishes and Regards
                                              ____
A. Abdul Rasheed, M.C.A., M.E., Ph.D.,
Assistant Professor,
Department of Computer Applications,
Valliammai Engineering College,
SRM Nagar, Kattankulathur - 603 203.
Kancheepuram District. Tamil Nadu. INDIA.
Contact: 91 - 44 - 27454784 Ext: 451 (O) / 996 23 000 55





Date: Sun, 12 Dec 2010 05:06:21 -0800
From: ml-node+3084270-787879815-204682@n4.nabble.com
To: profaar@live.com
Subject: Re: help requested



	On Sat, Dec 11, 2010 at 05:11:37AM -0800, profaar wrote:

> hi

>   thanks for your reply. there are around 20000 nodes in my dataset. will it work for conversion from edge list format to node list format? I am using R under Windows XP.

> 


Under Linux, with 20'000 nodes and 10 random edges from each of them, this

took abuot 108 sec (CPU 2.4 GHz). The advantage of this solution is that

there may be further functions in the package graph (see also class?graphNEL),

which could be used in your application. If not, then the conversion itself

may be done more efficiently, for example


  edges <- read.table(file=stdin())

1 2

1 3

1 4

1 5

2 3

2 4

3 2

4 1

4 3

4 5

5 2

5 4


  out1 <- split(edges$V2, edges$V1)

  out1


  $`1`

  [1] 2 3 4 5

  

  $`2`

  [1] 3 4

  

  $`3`

  [1] 2

  

  $`4`

  [1] 1 3 5

  

  $`5`

  [1] 2 4


For the example with 20'000 nodes and 10 random edges from each, this 

took about 0.2 sec.


The output out1 is a list of vectors. This may be transformed to

a vector of strings, for example


  out2 <- sapply(out1, paste, collapse=" ")

  cbind(out2) # cbind() is only for a column output


  out2     

1 "2 3 4 5"

2 "3 4"    

3 "2"      

4 "1 3 5"  

5 "2 4"    


and to a text (with a possible file= argument)


  cat(paste(names(out2), out2), sep="\n")


  1 2 3 4 5

  2 3 4

  3 2

  4 1 3 5

  5 2 4


Petr Savicky.


______________________________________________

[hidden email] mailing list

https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


	

	

	
	
		View message @ http://r.789695.n4.nabble.com/help-requested-tp3082147p3084270.html

		
		To unsubscribe from help requested, click here.
	 		 	   		  
-- 
View this message in context: http://r.789695.n4.nabble.com/help-requested-tp3082147p3085414.html
Sent from the R help mailing list archive at Nabble.com.

	[[alternative HTML version deleted]]

