An Python Class for Generate gexf format graph description file for gephi.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gexfpy-0.1.1.tar.gz.
File metadata
- Download URL: gexfpy-0.1.1.tar.gz
- Upload date:
- Size: 60.4 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50047e7c763dce04b064df40293d88fc1f9464913bbf1d6f1ac64ae99ac8d526
|
|
| MD5 |
02eaf54ed2c2053053fd7e34e1fffe8c
|
|
| BLAKE2b-256 |
d5eaf582f21130851e87edc8f6ad7979fba64ca2199017b495415f6f88a4d914
|
File details
Details for the file gexfpy-0.1.1-py2.py3-none-any.whl.
File metadata
- Download URL: gexfpy-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 2, Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17c3b4bed0ea4eed3a2ade9a8a34c0ad292aeb6e4526922a589f4d6ff1eeef18
|
|
| MD5 |
804175fd9dfeb33e807eddc0117a967b
|
|
| BLAKE2b-256 |
98668fa7d763c1532dd2c282eb552050d3258255c32da28ac466e78d2e2f12fd
|