[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] User-defined attributes
From: |
Tamás Nepusz |
Subject: |
Re: [igraph] User-defined attributes |
Date: |
Wed, 14 Mar 2012 10:29:58 +0100 |
> Is there a way to create/set user-defined attributes on the vertices of a
> graph? I have not found anything in the manual on this.
Yes, there is, but it depends on whether you are using R on Python. In R, you
can set vertex attributes as follows:
V(g)$name <- c("A", "B", "C", "D")
The above sets all the vertex attributes at once. The attribute of a specific
vertex can be updated as follows:
V(g)[2]$name <- "foo"
In Python, it looks like this:
g.vs["name"] = ["A", "B", "C", "D"]
g.vs[2]["name"] = "foo"
--
T.