Average nearest neighbor degree Works only with simple graphs

123 views
Skip to first unread message

Brian Kim

unread,
Dec 9, 2020, 8:27:33 PM12/9/20
to brainGraph-help
Hello,

I'm using brainGraph version 3.0.

I am doing analysis on fMRI data. The data has been fisher z-transformed, and then converted to a matrix using create_mats.

I run into an issue when trying to create make_brainGraphList on the subject level array. The error states: "Average nearest neighbor degree Works only with simple graphs, Invalid value."

I'm a little confused. The only way for a non-simple graph to exist is to have multiple edges connecting two nodes or for there to be a self-edge. I don't think the first issue of multiple edges is possible, so there must be a self-edge. A possible concern is that the fisher transform causes the diagonal values in each matrix to be Inf. However, I have zeroed out all the diagonals and run into the same issue.

Do you have any ideas what may be causing these issue? I know this isn't a strict brainGraph issue as it overlaps with igraph, however, the matrix that I am passing in has been created via brainGraph's create_mats function.

Here is an abbreviated code snippet:

'''
my.all.mats <- create_mats(matfiles$A, modality=modality, threshold.by='density', mat.thres=thresholds, inds = inds)
A.all.norm.sub <- my.all.mats$A.norm.sub
A.all.norm.mean <- my.all.mats$A.norm.mean
 for (j in seq_along(thresholds)) {
        g[[j]] <- make_brainGraphList(A.all.norm.sub[[j]], atlas, modality=modality,
                                          gnames=covars.fmri$SUBJID)
        g.group[[j]] <- make_brainGraphList(A.all.norm.mean[[j]], atlas, modality=modality,
                                                gnames=groups)
 }
'''

Chris Watson

unread,
Dec 9, 2020, 8:57:06 PM12/9/20
to brainGr...@googlegroups.com
I wouldn't know without seeing the data. You could run the "knn" function on the graph that is causing the error and then see if there is anything strange about that matrix. You should at least be able to tell which threshold it is failing at by seeing what "j" is after the error is thrown.

Chris

--
You received this message because you are subscribed to the Google Groups "brainGraph-help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brainGraph-he...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brainGraph-help/277f5ef2-8122-45a5-a5a1-81ce2cd72318n%40googlegroups.com.

Brian Kim

unread,
Dec 9, 2020, 10:37:52 PM12/9/20
to brainGr...@googlegroups.com
Thanks for the guidance. I realized that I need to binarize the matrix first before passing it into the function. Works great now.

Reply all
Reply to author
Forward
0 new messages