Number of edges in a graph

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Number of edges in a graph

kparamas
Hi,

I have a igraph graph object.
g <- watts.strogatz.game(1, 100, 5, 0.05)

If I have the summary of g, it prints
> summary(g)
Vertices: 100
Edges: 500
Directed: FALSE
No graph attributes.
No vertex attributes.
No edge attributes.

How to print only the number of edges in g?
Reply | Threaded
Open this post in threaded view
|

Re: Number of edges in a graph

Petr Savicky-2
On Sun, Mar 20, 2011 at 10:02:10PM -0700, kparamas wrote:

> Hi,
>
> I have a igraph graph object.
> g <- watts.strogatz.game(1, 100, 5, 0.05)
>
> If I have the summary of g, it prints
> > summary(g)
> Vertices: 100
> Edges: 500
> Directed: FALSE
> No graph attributes.
> No vertex attributes.
> No edge attributes.
>
> How to print only the number of edges in g?

Hi.

The function watts.strogatz.game() is probably from an extension
package. Can you send the name of the package and a reproducible
code to generate a simple example of the graph?

Try str(g). This shows the names of the components of object g,
which can then be used to extract only some of them.

Hope this helps.

Petr Savicky.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Number of edges in a graph

Peter Ehlers
In reply to this post by kparamas
?ecount

Peter Ehlers

On 2011-03-20 22:02, kparamas wrote:

> Hi,
>
> I have a igraph graph object.
> g<- watts.strogatz.game(1, 100, 5, 0.05)
>
> If I have the summary of g, it prints
>> summary(g)
> Vertices: 100
> Edges: 500
> Directed: FALSE
> No graph attributes.
> No vertex attributes.
> No edge attributes.
>
> How to print only the number of edges in g?
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Number-of-edges-in-a-graph-tp3392633p3392633.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.