[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] reading weighted graph with edgelist format

From: Gábor Csárdi
Subject: Re: [igraph] reading weighted graph with edgelist format
Date: Sat, 26 Jun 2010 21:13:29 +0200

The NCOL format has some nasty bugs in the 0.5.3 version IFAIK, but
you can just read the file with scan(), create a matrix from it with
matrix() and then use graph.data.frame():

el <- matrix(scan("filename"), byrow=TRUE, ncol=3)
g <- graph.data.frame(as.data.frame(el))


On Thu, Jun 24, 2010 at 9:52 AM, Tamas Nepusz <address@hidden> wrote:
>> Can edgelist format read a weighted graph from a file consists of 3 columns, 
>> with weights on the 3rd column?
> Yes, it is called the NCOL format. (Pass format="ncol" to read.graph). In the 
> case of the NCOL format, you can use names instead of vertex IDs in the first 
> and second columns; vertex names will be assigned to the "name" vertex 
> attribute and edge weights will be assigned to the "weight" edge attribute.
> --
> Tamas
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help

Gabor Csardi <address@hidden>     UNIL DGM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]