igraph-help
[Top][All Lists]

## Re: [igraph] igraph: how to select specific edges

 From: Biau David Subject: Re: [igraph] igraph: how to select specific edges Date: Sat, 12 Jan 2013 17:51:18 +0000 (GMT)

Ok thanks, it works. I tried the legend() but it didn't work as expected. I will work on it. Congrats for your package, it is just great!

David Biau

Envoyé le : Samedi 12 janvier 2013 18h27
Objet : Re: [igraph] igraph: how to select specific edges

On Sat, Jan 12, 2013 at 11:35 AM, Biau David wrote:
OK thanks,

but how do you delete the edges from the plot. When I plot(g) after the command delete, it does not remove the edges from the graph

It was included in my example. Here it is again, together with the plot:

library(igraph)
g <- graph.ring(10)
g <- delete.edges(g, E(g)[inc(1)])
plot(g)

also, I could not find a 'legend' function for igraph. Should we do them 'by hand'?

You can use the "regular" legend() function I believe.

G.

thanks and sorry for these trivial questions,

best,

David Biau

Envoyé le : Samedi 12 janvier 2013 17h15
Objet : Re: [igraph] igraph: how to select specific edges

On Sat, Jan 12, 2013 at 10:36 AM, Biau David wrote:
Dear all,

I would like to remove some edges from my network. I would like to remove all edges connecting one specific vertex (e.g., V(g)[type=='a']) to vertices which share a specific characteristic which I have identified (e.g., V(g)[type=='b']) . I haven't found the way to identify these edges.

Any idea?

See ?iterators:

‘inc’ takes a vertex sequence as an argument and returns ‘TRUE’
for edges which have an incident vertex in it.

E.g.

library(igraph)
g <- graph.ring(10)
E(g)[inc(1)]
# Edge sequence:
#
# [1]   2 --  1
# [10] 10 --  1

delete.edges(g, E(g)[inc(1)])
# IGRAPH U--- 10 8 -- Ring graph
# + attr: name (g/c), mutual (g/x), circular (g/x)

G.

David Biau

_______________________________________________
igraph-help mailing list
https://lists.nongnu.org/mailman/listinfo/igraph-help

--
Gabor Csardi <address@hidden>     MTA KFKI RMKI

--
Gabor Csardi <address@hidden>     MTA KFKI RMKI