graph from txt file
Hello, Package igraph can create graphs. Example: dat <- read.table(text=" node1 node2 attr1 attr2 2 1 2 3 3 2 3 2 4 3 4 2 6 5 1 4 ", header=TRUE) dat vertices <- as.vector( t(dat[, 1:2]) ) g <- graph(vertices, directed=FALSE) E(g)$weight <- dat$attr1 E(g)$color <- dat$attr2 plot(g, layout=layout.circle, edge.label=E(g)$weight, edge.color=E(g)$color) Also, you should post data examples like the posting guide says. With your description, a small example like the one above would do. Hope this helps, Rui Barradas Em 29-06-2012 19:05, HIMANSHU MITTAL escreveu:
yes i would prefer igraph, but it can be any r package as long as it can create the graph On Fri, Jun 29, 2012 at 11:14 PM, Peter Ehlers <ehlers at ucalgary.ca> wrote:
On 2012-06-29 10:28, HIMANSHU MITTAL wrote:
Hi all, I have a text file in which the graph info is stored as: node1 node2 attr1 attr2 where there is an edge b/w node1&2 and attr1&2 are edge atttributes is there any way to create a graph using such format in r?
The igraph package? Peter Ehlers
Regards,
Himanshu Mittal
[[alternative HTML version deleted]]
______________________________**________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help> PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html <http://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org 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.