This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
# Simple GEXF
A simple `.gexf` parser / writer for python

**Notice:** This is currently work in progress, and I hope to be able to create documentation in the future when I've settled on the overall structure.

## Motivation:
The official [`pygexf`](https://github.com/paulgirard/pygexf) is poorly maintained and almost not documented at all. I needed a simple abstraction layer for the `XML` format for my project.
This project uses [`xmltodict`](https://github.com/martinblech/xmltodict) which means it's much easier to understand and debug than `pygexf` which uses `lxml`.
This is a tool for those who'd rather spend their time learning about something more interesting and worthwhile than `XML`.


## Usage:

~~~python
from simplegexf import Gexf, Edge

gexf = Gexf('tags.gexf')

try:
graph = gexf.graphs[0]
except IndexError:
graph = gexf.add_graph(defaultedgetype="directed")

# Define Graph attributes
graph.define_attributes([
('description', 'string'),
('count', 'integer'),
])

# Define Edge attributes for Graph
graph.define_attributes([
('relation_type', 'string'),
], _class='edge')

nodes = {node.id: node for node in graph.nodes}

tags = [
{
id: 0,
name: 'Test tag 1',
description: 'This is a test tag',
},
{
id: 1,
name: 'Test tag 2',
description: 'This is a test tag',
parents: [0],
},
{
id: 2,
name: 'Test tag 3',
description: 'This is a test tag',
parents: [0, 1],
}
]

# Create nodes for tags:
for tag in tags:
try:
# See if node exists:
node = nodes[str(tag['id'])]
except KeyError:
# Create a new node:
node = self.graph.add_node(id=str(tag['id']), label=tag['name'])

# Update node:
node.set('viz:size', value=10.0)
node.set('viz:color', r=130, g=130, b=130)

# Update node attributes:
for attr in self.graph.node_attributes.keys():
try:
node.attributes[attr] = tag[attr]
except KeyError:
try:
del node.attributes[attr]
except IndexError:
pass

nodes = {node.id: node for node in graph.nodes}

# Create edges for tags:
for tag in tags:
try:
for parent_id in tag['parents']:
edge = Edge(parent_id, tag['id'])
graph.edges.append(edge)
# Attributes are not available before adding edge to graph
edge.attributes['relation_type'] = 'parents'
except KeyError:
pass

graph.sort_nodes(attr='count', reverse=True)

gexf.write()
~~~
Release History

Release History

0.1.5

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
simplegexf-0.1.5.tar.gz (4.7 kB) Copy SHA256 Checksum SHA256 Source Mar 3, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting