igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Directed edgelist in ncol format?


From: Tamás Nepusz
Subject: Re: [igraph] Directed edgelist in ncol format?
Date: Sun, 9 Jan 2011 11:27:40 +0100

> In the documentation I found that the ncol format works only with undirected 
> networks
Well, to be more precise: the NCOL format does not convey information about the 
directedness of the network; in other words, you have to know whether your 
network is directed or undirected when you load it from NCOL format. But 
otherwise you can simply save a directed graph in NCOL format if you pass 
directed=TRUE to read.graph when you load it back. E.g.:

> g <- barabasi.game(100, 2)
> is.directed(g)
[1] TRUE
> write.graph(g, "test.ncol", format="ncol")
> g2 <- read.graph("test.ncol", directed=TRUE)
> graph.isomorphic(g, g2)
[1] TRUE

So probably the simplest thing you can do is: g <- read.graph("your_file.ncol", 
directed=TRUE)

-- 
T.




reply via email to

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