[Top][All Lists]

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

[igraph] Delete isolated edges, assign node attributes

From: Xx Xx
Subject: [igraph] Delete isolated edges, assign node attributes
Date: Fri, 29 Jul 2011 16:46:14 +0100 (BST)

Dear igraph users,

I have started to work with igraph and cannot find a way to solve two of my problems.

First of all when plotting my graph I have noticed isolated edges (two nodes connected just to each other and having no connection to the main graph). I now how to delete nodes that have no edges at all but is there a way to delete isolated edges?

Secondly I have a data frame with 8 columns each representing a node attribute (except first column). I wanted to add those attributes to the nodes and tried this option;

g <- set.vertex.attribute(g, "x", index=V(g), value = n[,2])

The problem is I am not quite sure is how to assign a proper attribute to proper node. The first column of the table has the ID that correspond to the node names I used when creating the graph. Any ideas how to add all 7 columns to proper vertices? 

Also when I try to print the graph with the attributes using

print(g, vertex.attributes=igraph.par("print.vertex.attributes"), names=TRUE, quote.names=TRUE)

all I get is edges information and no attributes. What command should I use to print each node with corresponding attribute and not a list of edges (I used adjacency matrix to create the graph)?

Thanks very much for help.


reply via email to

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