Skip to content

This package implements export and import functions for the JSON Graph Format (gZipped) `JGF(Z)` (https://jsongraphformat.info). Supported input formats/libraries are `networkx`, `igraph`, `numpy` matrices and `JXNF` files. All network, node and edges attributes are saved as well.

License

filipinascimento/jgf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JGF(Z) format implementation

This package implements export and import functions for the JSON Graph Format (gZipped) JGF(Z) (https://jsongraphformat.info). Supported input formats/libraries are networkx, igraph, numpy matrices and JXNF files. All network, node and edges attributes are saved as well.

This project is being developed to support the new network datatype for (brainlife.io).

Authors

Contributors

Funding

We kindly ask that you acknowledge the funding below in your publications and code reusing this code.

NIH-NIBIB-R01EB029272

Installation

You can install this package using pip:

pip install jgf

or install it from this git repository:

git clone <repository URL>
cd <repository PATH>
pip install -e ./

API Reference

API reference can be found in (https://jgf.readthedocs.io/).

Example of use

To use the library in igraph environment simply import the correct module and run save or load functions:

import igraph as ig
import jgf.igraph as jig

g = ig.Graph.Famous("Zachary")

# will save a compressed file
jig.save(g,"zachary.jgfz")

g, = jig.load("zachary.jgfz")

You can also use it to save and load connectivity matrices as square numpy matrices:

import numpy as np
import jgf.conmat as jcm

A = np.array([
  [  0, 0.1, 0.2,   0,   0],
  [  0,   0,   0, 0.5,   0],
  [  0,   0,   0,   0, 1.0],
  [1.0, 1.0,   0,   0,   0],
  [  0,   0, 0.5,   0,   0],
  ])

nodeProperties = {
  "name" : [
    "Node 1",
    "Node 2",
    "Node 3",
    "Node 4",
    "Node 5",
  ]
}
# will save a compressed file
jcm.save(A,"example.jgfz",label= "Example", nodeProperties=nodeProperties)

B,properties = jcm.load("example.jgfz",getExtraData=True)

About

This package implements export and import functions for the JSON Graph Format (gZipped) `JGF(Z)` (https://jsongraphformat.info). Supported input formats/libraries are `networkx`, `igraph`, `numpy` matrices and `JXNF` files. All network, node and edges attributes are saved as well.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages