igraph-help
[Top][All Lists]
Advanced

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

[igraph] problem with vertices


From: Figa Pelosa
Subject: [igraph] problem with vertices
Date: Thu, 27 Aug 2009 12:17:45 +0000 (GMT)

hallo,
after deleting a vertex in the graph, the vertex is still there.. how come?

This is what I do:

g is an undirected graph;

1) I delete all edges whose weight is less than a certain threshold:
for i in range(0, g.vcount()):
 for j in range(0, g.vcount()):
  if i!=j:
   if g.es[g.get_eid(i,j)]["weigth"]<threshold:
    g.delete_edges(g.get_eid(i,j))

2) then I look for the vertices with degree equal to zero:
for idx, c1 in enumerate(g.vs):
 if g.degree(idx, type=ALL, loops=False)==0:
  print(idx)
  a = g.vs.select(idx)["name"]
  print(a)

3) and I have this output:
43
['xxx']
44
['yyy']

4) So I remove those vertices from the graph:
for idx, c1 in enumerate(g.vs):
 if g.degree(idx, type=ALL, loops=False)==0:
  g.delete_vertices(idx)

5) I increase the threshold by 1 and remove again some edges -like in 1) but 
with an higher threshold-

6) I look again for the vertices with degree equal to zero -like in 2)

7) and I get this:
23
['aaa']
43
['yyy']
93
['zzz']

The vertex called "yyy" (that had ID=44) should be deleted, but after deleting 
it, a vertex (ID=43) is called "yyy" as well.
Why?

Thanks a lot
FP







reply via email to

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