“GraphVar” is a user-friendly graphical-user-interface (GUI)-based toolbox (MATLAB) for comprehensive graph-theoretical analyses of brain connectivity, including network construction and characterization, statistical analysis on network topological measures, and interactive exploration of results. By combining together features across multiple current toolboxes, such as the Brain Connectivity Toolbox, the Graph Analysis Toolbox, and the Network Based Statistic Toolbox (BCT, Rubinov and Sporns 2010; GAT, Hosseini et al., 2012; NBS, Zalesky et al., 2010), GraphVar represents a comprehensive collection of graph analysis routines for functional neuroimaging researchers. GraphVar offers an interactive viewer that allows intuitive exploration of statistical results. Results can easily be exported and reloaded.

The program entails a detailed manual that includes usage instructions and a description of all the implemented functions, a Quick Guide for getting started, and a tutorial for getting started with sample data.

- GraphVar contains most functions included in the Brain Connectivity Toolbox, but allows users to add custom functions which can subsequently be accessed viathe GUI.

- GraphVar accepts correlation matrices as input but can also generate correlation or partial correlation matrices, offers generation of connectivity matrices based on percentage bend correlations, spearman correlation and mutual information from input time series. (e.g. ROISignals_TC from the DPARSF output). Additionally GraphVar generates covariance matrices that may be used for estimating binary graphs with the sparse inverse covariance matrix option (SICE).

- Binary and weighted network topological measures can be easily calculated, normalized, exported, and used in statistical analyses.

- Statistical analyses include general linear models (GLM and Machine Learning) with the network measures but also on the raw connectivity matrices (i.e., network based statistics including identification of graph components).

- Statistical tests can be performed in a parametric and non-parametric fashion (i.e., testing against null-model networks, non-parametric permutation testing).

- GraphVar now supports Sliding Window analyses on the raw matrices but also with the graph topological measures!

2. Release notes:

Release info GraphVar 2.0:

Background: We previously presented GraphVar as a user-friendly

MATLAB toolbox for comprehensive graph analyses of functional

brain connectivity. Here we introduce a comprehensive extension of

the toolbox allowing users to seamlessly explore easily customizable

decoding models across functional connectivity measures as

well as additional features.

New Method: GraphVar 2.0 provides machine learning (ML)

model construction, validation and exploration. Machine learning

can be performed across any combination of network measures

and additional variables, allowing for a flexibility in neuroimaging

applications.

Results: In addition to previously integrated functionalities, such

as network construction and graph-theoretical analyses of brain

connectivity with a high-speed general linear model (GLM), users

can now perform customizable ML across connectivity matrices,

network metrics and additionally imported variables. The new

extension also provides parametric and nonparametric testing of

classifier and regressor performance, data export, figure generation

and high quality export.

Comparison with existing methods: Compared to other existing

toolboxes, GraphVar 2.0 offers (1) comprehensive customization,

(2) an all-in-one user friendly interface, (3) customizable model

design and manual hyperparameter entry, (4) interactive results

exploration and data export, (5) automated cueing for modelling

multiple outcome variables within the same session, (6) an easy to

follow introductory review.

Conclusions: GraphVar 2.0 allows comprehensive, user-friendly

exploration of encoding (GLM) and decoding (ML) modelling

approaches on functional connectivity measures making big data

neuroscience readily accessible to a broader audience of neuroimaging

investigators.

Release info GraphVar 1.03:We found that in the GraphVar 1.0 update, the function to calculate the clustering coefficientfor binary undirected graphs was accidentally replaced with a function to calculate the number oftriangles around each node. The clustering coefficient, however, is defined as the number of trianglesaround each node divided by the number of possible triangles. In other words, the values that werereturned are simply the unscaled form of the binary undirected clustering coefficient.

The functions for calculating the clustering coefficient on weighted network (clustering_coef_wu; clustering_coef_wd)and the binary clustering coefficient fpr directed networks (clustering_coef_bd) were not affected.

However, even though the values are thus conceptually related, the number of triangles and theactual clustering coefficient share only roughly 20% of their variance. Therefore, pleasere-run your analyses if you have used the clustering coefficient for binary undirected graphswith a GraphVar version 1.00, 1.01, or 1.02.

4. Added "CheckFrag": will check if network fragmentation with respect to the settings in your network construction occur

5. GraphVar now saves more output files when doing sliding window analyses (not only the dynamic summary measure as before) and will also save all results when only "calculate and Export" for further usage. Files in your interim results folder are now (depending on what computations you do here with clustering_coeff as example):- clustering_coef_bu_4.9_1.mat: dynamic summary measure (e.g. variance) of clustering_coef_bu across windows for each node on threshold 0.49 for all subjects- clustering_coef_bu_4.9_1per_SW.mat: the (normalized) clustering_coef_bu for each node in each of the sliding windows on threshold 0.49 for all subjects- clustering_coef_bu_4.9_1-rand1.mat: dynamic summary measure (e.g. variance) of clustering_coef_bu across windows for each node in the first random network on threshold 0.49 for all subjects- clustering_coef_bu_4.9_1-rand_per_SW.mat: the clustering_coef_bu for each node in each random network in each of the sliding windows on threshold 0.49 for all subjects (i.e., cell comprised of: subjects x random networks x sliding windows)

6. Changed the normalization procedure for dynamic summary measures (this does not include "nodal flexibility/promiscuity":- OLD normalization procedure: the dynamic summary measure of the orig. data was devided by the mean of the dynamic summary measure of the random data (there was a lot of information loss)- NOW: first, per sliding window graph metrics are normalized as usual by division of the mean of the same graph metric derived in random networks in the same sliding window. Second, the dynamic summary measure is calculated across sliding windows of the beforehand normalized graph metrics.

Hi Chao-Gan,thanks again for the hint with the graphical lasso and for providing the script! I would really like to integrate this possibility as at the moment we do not have a possibility to deal with the case if #time points <= #ROIs.However, until now I am relatively unfamiliar with graphical lasso but I have had a quick look at your script - it seems to me that the graphical lasso is somehow dependent on each sparsity threshold as you calculate delta sparsity from the estimated sparsity and subsequently compute the lasso-sparsity set...GraphVar is written in a way that we have different modules which means that the generation of the conn matrix (or lasso matrix) is independent from the thresholding (density range), which the user has to select after the matrices were generated (i.e., we compute one correlation matrix, mutual information matrix etc. based on the single time courses for each subject - before the other procedures - as it is regularly done). You can see what our input/output is for generating the matrices (e.g. lines 47-53; 75-85; 139 in .../src/calc/GenerateFromTimecourses).To deal with this problem and to provide a fast solution to the users (if I am somehow wrong with my assumption about the dependence of the sparsity range), it would be really awesome if you could help us by providing a script where the output is a single matrix for each subject that subsequently can be thresholded at the desired threshold ranges. Alternatively, I will think about how to rewrite the toolbox to compute these matrices based on the threshold selection.

It's very easy to modify this function into your GraphVar, but I currently don't have time. Please keep in mind, all the codes written by me are under GNU GPL license. Thus, you can use them freely as long as you comply to GNU GPL.

I'm trying to use GraphVar, but am coming up with an error. I am using Matlab 2012b for 64-bit Linux. I created connectivity matrices from data generated in dpabi, but when I try to run "Calculate and Statistics", I get the following message. Any help would be appreciated:

Thanks,Matt

Error using cell/ismember>cellismemberlegacy (line 131)Input A of class char and input B of class cell must be cell arrays of strings,unless one is a string.

it seems like your subject ID´s are encoded by GraphVar as numeric values and not as a string (we are really sorry, that might be a bug in our software). You can check this, if you reload your variable sheet (with the subjects demographic data) and the checkbox in the second column next to your subject IDs is checked automatically. The radio button (first column) has to indicate your subject ID and there should not be any check in the second column. If you load the variable sheet from the sample workspace you can see how the setup should look like.

This bug seems to occur when using .csv and numerical subject identifiers. We develop mainly on Windows with Excel spreadsheets where this bug did not occur so far (so we did not notice until your question). Thanks for your question; we will fix that as soon as possible!

The best solution at the moment would be to rename your subject IDs with not only numbers to circumvent this problem (i.e., to use subject identifiers that not only contain numbers as "subject1" or "s1"... etc.)<

Error in @(hObject,eventdata)GraphVar('Btn_calcCorr_Callback',hObject,eventdata,guidata(hObject))

Error while evaluating uicontrol Callback

I have checked my variables sheet and my subject IDs are coded as not-only numbers as you suggested (I have subject001-subject052) however when the dialog box to choose the variables opens the radial button is automatically selected for the subject ID but the checkbox is not automatically chosen for my other variable of interest. This is a list of numbers between 0 and 1 with 4 decimal places. Is this variable my issue?

This release contains a major bug fix (erroneous convertion of connection weights into connection-length weights) that impacted the calculation of the following WEIGHTED measures (binary was not affected):

Hi,
it seems as if your matrix is not symmetric and thus directed. GraphVar currently only works with undirected networks and so does the BCT randomization function you want to use. So please make sure that there are exactly the same values above and under the diagonal (sometimes programs and other functions produce rounding errors some digits after the comma). Best, Johann

Thank you fo your quick reply. I've taken the snippet of code from the randomizer_bin_und function that checks for directedness and run it against all of my matricies and they do pass those tests. I know my matricies are undirected (they are taken directly from DPARSFA) and the error happens very quickly after the calculation begins regardless of which of my datasets I use. Any other ideas on what could be causing this?

this seems really odd. GraphVar works like this: it will take your subject´s matrix and perform the thresholding (if you do proportional thresholding, the first check for symmetry is already done in BCT´s “threshold_proportional”). Depending on your graph metric choice (this should be a binary function/metric if you want to use the “randomizer_bin_und”) , GraphVar will set the network to binary/(weighted). Subsequently, the thresholded binarized matrix is handed over to the “randomizer_bin_und” function and the random network is generated. So if there is an error that explicitly says (as you posted) “Matrix should be undirected” resulting the “randomizer_bin_und” function, the thresholding function already appears to detect the matrix as directed.

W==W’ (will give you a matrix comparing the upper and lower part of your matrix: 1 denotes same entry; 0 denotes differences)

[row,col] = find(W~=W') (will give you the exact position were differences occur)

W(W~=W') (will give you these values from W)

With DPARSFA I have had the experience that sometimes there are for some reasons rounding problems during generation of the correlation matrix which are not visually detectable (problem wrt symmetry: DPARSFA calculates each single cell in the matrix and not simply mirrors the upper half - I think). To make it work I would suggest to use DPARSFA to extract the time courses (ROI Signals) of your nodes and subsequently generate the connectivity matrix with GraphVar (here we mirror the values). Let me know if this works.

So I'm in the process of fixing my data to work with GraphVar (they're difference matricies, so they need to be adjusted) and your suggestions have really helped. But, now I'm using conn matrices that were created in graphvar from DPARSF ROIsignals files. I'm using those calculated correlation matrices to correlate with other measures, but when I run the analyses it end with an error that says something to the effect of, "There's no valid data to do statistics with." Any suggestions for this problem?

it seems as if you have coded a variable as a string (e.g. male and female). Simple group comparisons will work in this manner, but if you do e.g. a partial correlation these variables will have to be coded as numerical values (so 0 1 instead of male female).
The same for doing correlations with strings. I hope this helps.

My variables are a continuous integers (for example age or test score). I am running GraphVar on a mac and am therefore using semicolon separated csv files instead of xls. Could this be the cause of my issue? How can I fix it?

Bryson, please have a look how the csv variable sheet is organized in the sample workspace. You can check if your variables are encoded as strings when you load your sheet. If the second colum is not checked automatically the respective variable is encoded as a string. Best, Johann

Modifying my variable sheet seems tro have fixed it. For anyone else, in a csv file if you have a semicolon after the entry, then it will be considered a string, but if you have a comma after it it will be considered a number. At least this seems to work for me as a general rule.

Hi,
in order to 'show a network' (i.e. network based statistics) you need to test against random data (i.e. either with shuffled data/groups or random networks). For group comparison I would suggest at least 100 or even more (1000) iterations to derive an acceptable p value.

First of all, thank you for creating this useful tool! It seems to be valuable for both scripting-experienced and non-experienced users, as it gives a broad view possible analyses to be made.

I am using Matlab R2013a on Windows 8, 64bit, with Microsoft Excel installed, and have encountered some problems I was hoping you could help me solve.

1) The first is that after creating a new workspace, whenever I try going back to the SampleWorkspace one, I get an error. I copied it at the end of this post, under “Error Reloading SampleWorkspace Error”. I am not sure why the variableSheet is undefined. I have both csv and xlsx files, and I haven’t changed them.

2) In my own workspace, I have tried computing the “Weighted: Community structure Newman – affiliation”. Upon pressing the “Calculate variables and export”, I get an error. I copied it at the end of this post, under “Error Computing Community Structure”.

3) I am not sure if this is a bug or not, but it seems that if I try creating a workspace with only one subject, it is not possible to use the “Select Subjects (Conn Matrix)” button. Trying to use it, no subjects appear in the Subjects window.

1. I tried to replicate this problem on some computers and strangely could only replicate it on one. Attached you find a script that should fix the error. Put it in scr.gui.GrapVar: DOWNLOAD HERE

2. I could not replicate this error... on all computers the weighted version of the affiliation vector could be calculated and exported - However, I do not have a MATLAB 2013 version to test (I have 2011 2014)

1. Switching between workspaces still gives this odd error, even after replacing the GraphVar_OpeningFcn.m file. I could replicate this error both on my PC and on another one, with Windows 7, Matlab 2011b.

2. I could calculate the community structure on the template workspace, but now got an error on my own workspace (see attached). I intently used 90 AAL ROIs in my own data to make use of the same Excel sheet for the BrainRegions.xlsx file, but that did not solve the problem.

3. Thank for clarifying this!

Best,

Roey

==================

Error using cell/ismember (line 27)

Input must be cell arrays of strings.

Error in GraphVar_getDialogData>check_StructureName (line 359)

if(sum(~ismember(name,handles.vpNamesNeo)) && isFirst)

Error in GraphVar_getDialogData (line 53)

if(~check_StructureName(handles,forCalcFunc))

Error in GraphVar_calc (line 29)

[returnVal,dialogData] = GraphVar_getDialogData(handles,1,noCorr);

Error in GraphVar_CalcExport_Callback (line 42)

[res allTasks] = GraphVar_calc(handles,1);

Error in gui_mainfcn (line 96)

feval(varargin{:});

Error in GraphVar (line 40)

gui_mainfcn(gui_State, varargin{:});

Error in @(hObject,eventdata)GraphVar('GraphVar_CalcExport_Callback',hObject,eventdata,guidata(hObject))

1. For me everything works somehow - for being able to replicate what you experience you would have to send me the exact steps (I did: 1: start_GraphVar; open sample workspace; swith workspace (gui button); create new workspace; open new workspace; switch workspace back to sample workspace. 2: start_GraphVar; create new workspace; open new workspace; switch workspace back to sample workspace) ... This works fine for me. What do you do? Can you please try adding GraphVar completely new to your path (i.e., installing the default verison) and see if this still occurs?

2. The error you posted is not related to the BrainRegionsFile but to the variables sheet and tells you (if I am not mistaken as I don´t know your settings) that your variables sheet does not contain a string column header (as "gender", "research_site").

Best would be you simply send me your workspace (with all modifications) and I can try running it on my computer to see what´s the problem.

I got the same problem. Even if I deleted my own workspace, removed GraphVar from Matlab path, exited Matlab, reopened Matlab, added eGraphVar into the path. Then I started with 'start_GraphVar', click on sampleworkspace, it crushed again and give the same error.

When I check the 'GraphVar_OpeningFcn.m', there was a warning with the "variableSheet", it said, the variable may be used before it is defined.

The current version is not intended to do analyses on directed networks. However, you can simply extend Graphvar for directed networks (if you already have the directed input matrices). For this you would only have to include the respective directed version of the BCT function in the script “src/gui/getFunctions.m”. It is written in the Appendix 2 of the Manual how to do this. You may have to write a helper function (also see manual) if you are interested in a specific output of the directed version of the BCT function (e.g. the function “strength_dir has three outputs: is, os, str) to determine which output of the function you want to use…. This should be really fast and easy.

Also, if you want to use the randomization functions, you would have to change these respectively to the directed versions (Appendix 2). Btw. the SICE threshold function will not work with directed matrices as we mirror the matrix.

I am getting the follow error when running GraphVar on Matlab 2015a. This only happens when 'generate random network' is selected, and the process always stops at step 29 and produces an error.

Error using matlabpool (line 27)matlabpool has been removed.To query the size of an already started parallel pool, query the 'NumWorkers' property of the pool.To check if a pool is already started use 'isempty(gcp('nocreate'))'.

Thank you so much for your help. Unforunately the problem persists with the following message:

Error using matlabpool (line 27)matlabpool has been removed.To query the size of an already started parallel pool, query the 'NumWorkers' property of the pool.To check if a pool is already started use 'isempty(gcp('nocreate'))'.

I uptaded my Mac to Sierra and Matlab 2017a and it seems that Graphvar stopped running. The whole software won't let me run any functions now. I tried to substitue the above script in src/gui/GraphVar without any help. What would you suggest me to do? Thank you in advance.

Thank you for this pretty cool toolbox, it will save me tons of time. I am encountering issues analyzing my data. My data consists of functional connectivity matrices each in a *.mat file. I am able to load the data on GraphVar, but once I click on "Calculate & Statistics" I obtained the following:

Thank you, Johann. I have tried commenting out that entire IF - ELSE loop (I will next do as you recommend and only delete the second part of the statement), and the code seems to run then, but the progress bar is definitely malfunctioning (for example, the very top bar can be at 4036 of 672 operations).

The CheckFrag issue has been happening on both Mac (OS X 10.11.1) and on Windows.

Unrelated question: When selecting random time series to be generated (100) along with sliding window correlations to be computed (84 windows total for each of 24 subjects in my case, 82 regions of interest), Step 2: Correlating Vars pops up, but there is absolutely no progress happening - is this step supposed to be computationally very intensive? (I am using a computer with 32 GB of RAM and a 4.0 GhZ Intel Core i7 processor) and Every time I've tried running this, I've just ended up force quitting Matlab :(

I will try to figure out why this CheckFrag problem happens ... until now I could not replicate the error - sorry.Yes - the statusbar is incorrect if you operate with sliding windows (we have added this feature after the status bar was programmed - we will update this issue asap).

The operation you want to do is pretty computationally intensive - you see this if you look at your CPU workload. You could speed this up by using multiple CPU´s (number of workers). It will be considerably faster if no random time series are generated (however, you may need to do this if you wish to use these non-parametric p-values for thresholding of the network - i.e., significance based thresholding). If you decide to skip this feature you could still use relative or absolute thresholding.

Thank you Johann. I am still trying to figure out the toolbox. It
seems to work fine with the included sample data. However, my data
does not have additional variables, only the networks' matrices, I
am only interested in computing the graph metrics. This seems to be
an issue with the toolbox as it seems to search for the
Variables.csv file, even as I unclick the Statistics functions in
bottom right. I did modify line 361 as you suggested. Any help would
be most appreciated.

Yes - I am aware of this issue and will change this asap. For now please organize yourself a "fake" variable sheet with the subjects names in the ID column and highlight the subject name accordingly in GraphVar... this will work (keep to the format of the sample variable sheet).Originally, the requirement of a variable sheet and highlight of the subject name was thought as a precaution to not mixup subject data. Sorry about that!

1.Is the SICE target density in Generate Conn Matrix the same meaning as SICE threshold in Network Construction panel? What kind of data should be input in Netwok Construction step? Covariance Matrix or after SICE target density?

2.Is it appropriate to calculate graph metrics with SICE or Covariance data? Is it possible to do group comparison as Shuai Huang did in his article?

Q: Is the SICE target density in Generate Conn Matrix the same meaning as SICE threshold in Network Construction panel?A: No. SICE (also referred to as graphical lasso) in Generate Conn Matrix can be used to create conn matrices with a predefined density (i.e., you will get a set of matrices with a specific network threshold obtained by sparse inverse covariance estimation). This procedure will use the time series data. In the Nework construction panel SICE is an alternative option to relative thresholding. Here covariance matrices are required as input. These can be created from the time series using the Generate Conn Matrix function.

Q: Is it appropriate to calculate graph metrics with SICE or Covariance data?A: This is basically an alternative way of constructing networks based on partial correlations which should be used if there are more nodes (ROIs) in the network as compared to time points of your data. Please have a look in the GraphVar article for a detailed description. Yes - it is appropriate to calculate graph metrics with SICE.Q:Is it possible to do group comparison as Shuai Huang did in his article?A: GraphVar offers parametric and non-parametric group comparisons. These are done after the graph metrics are obtained from e.g. the networks thresholded with the SICE option.

Thanks for your clarifing about SICE options. I've tried to calculate graph metrics with covairance matrix using multiple SICE threshold, but there is always an error in randomizer_bin_und indicating that "Matrix should be undirected". The design page was attached.

the SICE function uses an approximate algorithm to calculate the inverse of the covariance matrix. We were unaware that this could lead to asymmetric matrices. Any asymmetry of the SICE should be below the 10e-4 tolerance of the estimation. We believe that in your case, the 10e-4 were just enough to affect the thresholding, i.e. to switch a zero to a one or vice versa. We have fixed the SICEDense.m function so that this error should not occur again (now we mirror the upper diagonal).DOWNLOAD THE NEW SICE HERE.

Thank you for useful GraphVar, it is very useful for calculating graph metrics. But i met some question, it stop working when it finished 47%. there no any error. i try to exit it and open it again and again. the results are same. i don't know what's wrong with it .Can you help me?