GEXFpy is a python wrapper for Gexf XML version 1.2 .
We provide 2 ways to use it:
- Parse Gexf XML as Graph Python Object: read gexf version 1.2 xml file into python as Gexf python object.
- Serialize Graph Python Object into Gexf XML: create python object Gexf instance and serialize this object into gexf version 1.2 xml file.
Getting Started
Requirements and Installation
- Python version >= 3.8
- xsdata version == 21.9
pip install gexfpy
Install from source via:
pip install git+https://github.com/chunqishi/gexfpy.git
Or clone the repository and install with the following commands:
git clone git@github.com:chunqishi/gexfpy.git
cd gexfpy
pip install -e .
Usage
API Usage
You can run all kinds of experiments through GEXFpy APIs. A quickstart example can be found in the quick_start.py. More examples are provided in the examples/.
from gexfpy import parse
# basic usage parse file
sbu_310 = parse('sbu_310.gexf')
print('graph sbu_310 nodes number =', len(sbu_310.graph.nodes[0].node))
# serialize Gexf object into xml string
from gexfpy import stringify
from gexfpy import Gexf, Graph, Nodes, Edges, Node, Edge, Color
gexf = Gexf()
gexf.graph = Graph()
gexf.graph.nodes = [Nodes(node=[Node(id=1, label="node 1",
color=[Color(r=255, g=0, b=0)]),
Node(id=2, label="node 2"),
Node(id=3, label="node 3")],
count=3)]
gexf.graph.edges = [Edges(edge=[Edge(source=1, target=2, label="edge 1"),
Edge(source=2, target=3, label="edge 1")],
count=2)]
s = stringify(gexf)
print(s)
Check the documentation <https://gexfpy.readthedocs.io>_ for more
✨✨✨
Changelog
Version 0.1.1 2021-10-30
It works only for gexf version 1.2 draft
Release files for gexfpy 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gexfpy-0.1.1.tar.gz | 60.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gexfpy-0.1.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 68.6 kB
Release files / gexfpy-0.1.1.tar.gz
| Download URL | gexfpy-0.1.1.tar.gz |
|---|---|
| Size | 60.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
50047e7c763dce04b064df40293d88fc1f9464913bbf1d6f1ac64ae99ac8d526
|
|
BLAKE2b-256 checksum How to use checksums |
d5eaf582f21130851e87edc8f6ad7979fba64ca2199017b495415f6f88a4d914
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.6.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
|
Release files / gexfpy-0.1.1-py2.py3-none-any.whl
| Download URL | gexfpy-0.1.1-py2.py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
17c3b4bed0ea4eed3a2ade9a8a34c0ad292aeb6e4526922a589f4d6ff1eeef18
|
|
BLAKE2b-256 checksum How to use checksums |
98668fa7d763c1532dd2c282eb552050d3258255c32da28ac466e78d2e2f12fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.6.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
|