To use the code, MATLAB installation is required, as is the Statistics toolbox. Code was tested with MATLAB version R2021b. For some functionality, a Python toolbox is also required and Python must be configured to run from Matlab: https://www.mathworks.com/help/matlab/call-python-libraries.html kneed for Python: https://pypi.org/project/kneed/ Satopaa, V., Albrecht, J., Irwin, D., & Raghavan, B. (2011, June). Finding a" kneedle" in a haystack: Detecting knee points in system behavior. In 2011 31st international conference on distributed computing systems workshops (pp. 166-171). IEEE. Code for this manuscript is organized in several folders. All of the code is intended to be run from the root package directory as working directory, except for code in RSDMEpaper which is intended to be run from within that folder as working directory. The folder RSDMEpaper contains code and data specific to the manuscript to produce figures and tables (see below). The folder +RSDME contains code to analyze raw data; the script runAll.m will call all necessary scripts in turn. The folders +ecogutils and +loadECoG contain packages with several helper scripts used in the rest of the software. The folders @AdjMatrix and @Embedding contain classes for handling adjacency matrices and embeddings, respectively. If you are using this code in your own project, we recommend using these classes. To create an AdjMatrix object: > obj = AdjMatrix(A,chanData); where "A" is an adjacency matrix, chanData is a structure array with length equal to the width and height of A and containing at least a field "ROI" that labels each node. To create an embedding representation of this object or an array of embeddings from an array of AdjMatrix objects: > obj.embed(threshold,'cosine',t); where "threshold" indicates the minimum number of connections to maintain (1/3 in the manuscript), and "t" is the parameter representing the number of diffusion steps (typically 1 in the manuscript). You can also create an Embedding directly from an adjacency matrix using the @Embedding class constructor. DATA AVAILABLE IN THIS REPOSITORY Data necessary to reproduce figures are in RSDMEpaper\AllFigureData.mat The data in that file are organized by the relevant manuscript figure. For example, the Matlab structure "fig2" contains data corresponding to that figure: Psymm, a 206x206 matrix representing the normalized adjacency matrix for an example participant, Emb, the embedding representation of this matrix (rows correspond to recording sites, columns correspond to dimensions), ROIlabels, a cell array of strings labeling the ROIs of each of the 206 recording sites in Psymm and Emb, and colorMap, a matrix containing RGB triplets for color labeling in the figure. Similarly, the structure "fig3" contains corresponding data for the average participant figure. Outputs of statistical analyses (e.g., p-values reported in the manuscript) are in RSDMEpaper\statsOut.txt Please contact Bryan Krause (bmkrause@wisc.edu) for assistance with the code or data included in this repository. REPRODUCING PAPER FIGURES Figures can be reproduced by: 1) Change your working Matlab directory to RSDMEpaper 2) Run plotRSDMEfigures.m by typing plotRSDMEfigures into the Matlab command line. RAW DATA ACCESS The IRB protocol under which these patients were consented specified that participants’ data would be shared with qualified individuals working on approved scientific projects following establishment of a data use agreement. Intracranial EEG data are collected during a medical procedure (inpatient monitoring for seizure) and, as such, contain information that could be used to draw inferences about the medical conditions of an individual. The neural data from iEEG and fMRI, along with demographic data reported in the manuscript, have the potential for use beyond scientific inquiry were it shared without restrictions. A data transfer and use agreement between the Authors’ institution and scientists with legitimate interest in the dataset reduces the risk of loss of privacy of the research participants who have contributed their neural data to this work. Thus, the complete data set is available upon request and establishment of a formal data sharing agreement. Please contact The University of Iowa Division of Sponsored Projects at dsp-contracts@uiowa.edu to request data access.