|
From: | Zhige Xin |
Subject: | Re: [igraph] Data structure of network |
Date: | Thu, 11 Apr 2013 09:46:38 -0700 |
> I mean I can traverse and change the label of any node in that network.This can be done by manipulating the "label" attribute of a node. Nodes can be accessed by indexing the "vs" vertex sequence of the graph. E.g.:
graph.vs[1]["label"] = "new label"
Edges can be manipulated similarly by indexing the "es" edge sequence:
graph.es[1]["weight"] = 42
Please take a look at the add_edge(), add_edges(), delete_edge() and delete_edges() method of the Graph object in the documentation:
> For example, node 0 has two neighbors 1 and 2. After some time, node 0 may only connect to node 2 or 3. So how can I change this by manipulating the object of network (network = nx.read(net_path))?
http://igraph.sourceforge.net/doc/python/igraph.Graph-class.html#add_edge
http://igraph.sourceforge.net/doc/python/igraph.Graph-class.html#add_edges
http://igraph.sourceforge.net/doc/python/igraph.Graph-class.html#delete_edges
Members of the edge sequence also have a delete() method:
graph.es[1].delete()
By the way, out of curiosity, why do you import the igraph module using the alias "nx"? "nx" usually refers to the NetworkX module.
--
T.
_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help
[Prev in Thread] | Current Thread | [Next in Thread] |