igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Question about igraph and graph.data.frame in R


From: Tamas Nepusz
Subject: Re: [igraph] Question about igraph and graph.data.frame in R
Date: Fri, 13 Jun 2008 11:35:22 +0200

Hi Peter,

My data frame (named forclus) has 796 rows (people) and 524 columns (variables).
I can create a distance matrix using the dist function:

dist <- as.matrix(dist(forclus))

I can create names for the rows using row.names(forclus).

But in your documentation you list a rather small data frame, with three nodes (foo,
bar, and foobar), 2 edges, and the weights entered by hand.


Do you have any suggestions as to how I can go from my large data frame to a graph,
and then to a minimum spanning tree?
I'm not particularly familiar with the R interface, but maybe graph.adjacency() helps:

http://cneurocvs.rmki.kfki.hu/igraph/doc/R/graph.adjacency.html

This function creates a graph based on a weighted adjacency matrix, which (according to my understanding) is exactly the distance matrix what you have. Vertex names can be assigned later to the graph as a vertex attribute.

Regards,
--
Tamas





reply via email to

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