About gdflib
gdflib is a Python package made to dump GDF graph files.
Installing
gdflib can be installed from pypi:
easy_install gdflib
or:
pip install gdflib
should just work for most of the users
Usage
Most simple example:
>>> from gdflib import GdfEntries, Node
>>>
>>> entities = GdfEntries()
>>> entities.add_node(Node(name='node1', label='This is the first node'))
>>> entities.add_node(Node(name='node2', label='This is the second node'))
>>> entities.link('node1', 'node2')
>>> print entities.dumps()
nodedef>name , style INT, width DOUBLE, color VARCHAR, image VARCHAR, label VARCHAR, height DOUBLE, visible BOOLEAN, labelcolor VARCHAR, y DOUBLE, x DOUBLE, strokecolor VARCHAR, fixed BOOLEAN, labelvisible BOOLEAN
node1,1,4.000000,cornflowerblue,,'This is the first node',4.000000,true,cornflowerblue,,,cadetblue,false,false
node2,1,4.000000,cornflowerblue,,'This is the second node',4.000000,true,cornflowerblue,,,cadetblue,false,false
edgedef>node1 , node2 , directed BOOLEAN, color VARCHAR, weight DOUBLE, width DOUBLE, label VARCHAR, visible BOOLEAN, labelcolor VARCHAR, labelvisible BOOLEAN
node1,node2,true,dandelion,1.000000,3.000000,'1',true,dandelion,false
By default all nodes implement the standard properties defined for GDF, unspecified properties will get the default value. Custom nodes can be defined through the Declarative interface:
>>> from gdflib import String, Double
>>> from gdflib import GdfEntries, Node
>>>
>>> class Product(Node):
... company = String(default='Unknown Company')
... price = Double(required=True)
...
>>> entities = GdfEntries(Product)
>>> entities.add_node(Product(name='node1', company='Custom Company', price=33.10))
>>> entities.add_node(Product(name='node2', label='Low Cost Product', price=18.21))
>>> entities.link('node1', 'node2')
>>> entities.dumps()
nodedef>name , style INT, width DOUBLE, color VARCHAR, image VARCHAR, label VARCHAR, height DOUBLE, visible BOOLEAN, labelcolor VARCHAR, y DOUBLE, x DOUBLE, strokecolor VARCHAR, fixed BOOLEAN, labelvisible BOOLEAN, company VARCHAR, price DOUBLE
node1,1,4.000000,cornflowerblue,,'node1',4.000000,true,cornflowerblue,,,cadetblue,false,false,'Custom Company',33.100000
node2,1,4.000000,cornflowerblue,,'Low Cost Product',4.000000,true,cornflowerblue,,,cadetblue,false,false,'Unknown Company',18.210000
edgedef>node1 , node2 , directed BOOLEAN, color VARCHAR, weight DOUBLE, width DOUBLE, label VARCHAR, visible BOOLEAN, labelcolor VARCHAR, labelvisible BOOLEAN
node1,node2,true,dandelion,1.000000,3.000000,'1',true,dandelion,false
gdflib provides also support for custom edges, those can be defined like custom nodes by subclassing Edge and providing additional attributes. In such case instead of using link function to link two nodes, add_edge call should be uses.
Metadata
Release files for gdflib 0.0.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 | Provenance | Actions |
|---|---|---|---|---|
| gdflib-0.0.1.tar.gz | 4.3 kB | Without provenance | Details for gdflib-0.0.1.tar.gz |
Release files / gdflib-0.0.1.tar.gz
| Download URL | gdflib-0.0.1.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
231e297bd17ce2a162a9d31ce30883f8fa6dea1aafe55e57531cc1856c3158e7
|
|
BLAKE2b-256 checksum How to use checksums |
ffafb69145b7a26ef7da69af79d4f1fb0e4c48016970209be7b6272af62e29b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for gdflib 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.