igraph-help
[Top][All Lists]
Advanced

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

[igraph] Possible bug in degree.distribution for R v3.0.0 and above


From: Fabio Daolio
Subject: [igraph] Possible bug in degree.distribution for R v3.0.0 and above
Date: Tue, 3 Sep 2013 20:15:16 +0200

Dear all,

I'm not familiar with bug reporting and tracking, thus my apologies for 
spamming the help-list.
Anyway, I noticed that the "degree.distribution" function returns "NULL" under 
R v3.0.1.

I think this might be due to the fact that the "hist" function, which is 
called, returns an object
that doesn't have an "intensity" component anymore (since R 3.0.0).
Could that be?

A temporary fix might be to define your own function:
degree.distribution<-function (graph, cumulative = FALSE, ...) 
{
    if (!is.igraph(graph)) {
        stop("Not a graph object")
    }
    cs <- degree(graph, ...)
    hi <- hist(cs, -1:max(cs), plot = FALSE)$density
    if (!cumulative) {
        res <- hi
    }
    else {
        res <- rev(cumsum(rev(hi)))
    }
    res
} 

Cheers,
--
Fabio


reply via email to

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