Package: grape
GRAPE(Graph Representation leArning, Predictions and Evaluation) is a fast graph processing and embedding library, designed to scale with big graphs and to run on both off-the-shelf laptop and desktop computers and High-Performance Computing clusters of workstations.The library is written inRustandPythonprogramming languages, and has been developed byAnacletoLAB(Dept. of Computer Science of the University of Milan), in collaboration with theRobinson Lab - Jackson Laboratory for Genomic Medicineand with theBBOP - Lawrence Berkeley National Laboratory.The library is composed of two main modules,Ensmallen, which is the Rust/Python high-performance graph processing submodule, andEmbiggen, which is the Python Graph Representation learning, Prediction and Evaluation submodule.Installation ofGRAPEAs usual, just install it from PyPi by running:pipinstallgrapeGenerally, the installation does not take longer than a minute.It is possible tomanually compile Ensmallenfor any OS, libc version, and CPU architecture (such as Arm, AArch64, RiscV, Mips) which are supported by Rust and LLVM. Just open an issue if you need some help.Main functionalities of the libraryRobust graph loading and graph retrieval:80K+ graphsSupport for multiple graph formatshuman readable reports of graph characteristics60+ Node embedding models, with easy integration of third parties libraries.DeepWalk, Walklets and Node2Vec-based CBOW, SkipGram and GloVe,also with degree normalization!Firstandsecond order LINEUnstructured, Structured Embedding, TransEAll embedding models have an MMAPP-ed versions to allow for very large embeddingsAll embedding models have support for mixed precision, allowing embedding using 16 bits floatsIntegrated models fromKarate ClubandPyKEEN20+ Classifier models, with easy integration of third parties libraries.All sklearn models, adapted for edge prediction, edge-label prediction and node-label predictionGraphSAGE and Kipf GCN foredge prediction, edge-label prediction and node-label predictionBaseline Perceptron for edge predictionIntegrated support to parallelize holdouts across a SLURM clusterGraph processing: if NetworkX has it, odds are good we have it and it is way faster!Resnik, Jaccard, Ancestors Jaccard similaritiesDiameter,Vertex cover,connected components,Triangles,Squares,Betweenness Centrality,HyperBall-based approximated Closeness and Harmonic centralities,Exact Closeness centralityandExact Harmonic centralityFilters on graph properties andset operations on graph edgesGraph visualization toolsTSNE, UMAP, PCA of embeddingsEdge propertiesTutorialsYou can find tutorials covering various aspects of the GRAPE libraryhere.
All tutorials are as self-contained as possible and can be immediately executed on COLAB.If you believe that any example may be of help, do feel free toopen a GitHub issue describing what we are missing in this tutorial.DocumentationOn line documentation (currently being updated)The on line documentation of the library is availablehere.
Since Ensmallen is written in Rust, and PyO3 (the crate we use for the Python bindings),doesn’t support typing, the documentation is obtained generating an empty skeleton package. This allows to have a proper documentation but you won’t be able to see the source-code in it.Using the automatic method suggestions utilityTo aid working with the library, GRAPE provides an integrated recommender system meant to help you either to find a method or, if a method has been renamed for any reason, find its new name.As an example, after having loaded theSTRING Homo Sapiens graph, the function for computing the connected components can be retrieved by simply typing components as follows:fromgrape.datasets.stringimportHomoSapiensgraph=HomoSapiens()graph.componentsThe code above will raise the following error, and will suggest methods with a similar or related name:AttributeErrorTraceback(mostrecentcalllast)<ipython-input-3-52fac30ac7f6>in<module>()---->2graph.componentsAttributeError:Themethod'components'doesnotexists,didyoumeanoneofthefollowing?*'remove_components'*'connected_components'*'strongly_connected_components'*'get_connected_components_number'*'get_total_edge_weights'*'get_mininum_edge_weight'*'get_maximum_edge_weight'*'get_unchecked_maximum_node_degree'*'get_unchecked_minimum_node_degree'*'get_weighted_maximum_node_degree'In our example the method we need for computing the graph components would beconnected_components.Now the easiest way to get the method documentation is to use Python’shelpas follows:help(graph.connected_components)And the above will return you:connected_components(verbose) method of builtins.Graph instanceCompute the connected components building in parallel a spanning tree using [bader's algorithm](https://www.sciencedirect.com/science/article/abs/pii/S0743731505000882).**This works only for undirected graphs.**The returned quadruple contains:-Vector of the connected component for each node.-Number of connected components.-Minimum connected component size.-Maximum connected component size.Parameters----------verbose: Optional[bool]Whether to show a loading bar or not.Raises-------ValueErrorIf the given graph is directed.ValueErrorIf the system configuration does not allow for the creation of the thread pool.Cite GRAPEPlease cite the following paper if it was useful for your research:@article{cappelletti2023grape,title={GRAPE for Fast and Scalable Graph Processing and random walk-based Embedding},author={Cappelletti, L. and Fontana, T. and Casiraghi, E. and Ravanmehr, V. and  Callahan, T.J. and  Cano, C. and Joachimiak, M.P. and Mungall, C.J. and Robinson, P.N. and Reese, J. and Valentini, G.},year={2023},doi={10.1038/s43588-023-00465-8},journal={Nature Computational Science}}