igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Element order in .vs and .es


From: Tamás Nepusz
Subject: Re: [igraph] Element order in .vs and .es
Date: Sun, 24 Jul 2011 11:21:53 +0200

is there any guarantee about the element order in igraph.Graph.vs and
igraph.Graph.es ? If such an order exists, what is it?
Internally, igraph uses numeric IDs to identify vertices and edges. The IDs are integers, start from zero, and are always continuous, like the indexes of an array. These IDs are used when you index igraph.Graph vs and igraph.Graph.es. Currently, it is guaranteed that:

- if you do not delete any vertices or edges, then the IDs stay the same
- if you add new vertices or edges, those will receive the next available IDs (e.g., if you have 10 vertices and add 2 more, the two new vertices will receive IDs 10 and 11)
- the deletion of edges does not affect vertex IDs

In general, if you only add new vertices or edges to a graph but never remove them, then the order of elements in .vs and .es represents the order of addition.

-- 
T.


reply via email to

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