{ "info": { "author": "UNKNOWN", "author_email": "UNKNOWN", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Topic :: Scientific/Engineering :: Visualization", "Topic :: Text Processing :: Markup :: XML" ], "description": "# Simple GEXF\nA simple `.gexf` parser / writer for python\n\n**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.\n\n## Motivation:\nThe 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.\nThis project uses [`xmltodict`](https://github.com/martinblech/xmltodict), which means it's much easier to understand and debug than `pygexf` which uses `lxml`.\nThis is a tool for those who'd rather spend their time learning about something more interesting and worthwhile than `XML`.\n\n\n## Usage:\n\n~~~python\nfrom simplegexf import Gexf, Edge\n\ngexf = Gexf('tags.gexf')\n\ntry:\n graph = gexf.graphs[0]\nexcept IndexError:\n graph = gexf.add_graph(defaultedgetype=\"directed\")\n\n# Define Graph attributes\ngraph.define_attributes([\n ('description', 'string'),\n ('count', 'integer'),\n])\n\n# Define Edge attributes for Graph\ngraph.define_attributes([\n ('relation_type', 'string'),\n], _class='edge')\n\nnodes = {node.id: node for node in graph.nodes}\n\ntags = [\n {\n id: 0,\n name: 'Test tag 1',\n description: 'This is a test tag',\n },\n {\n id: 1,\n name: 'Test tag 2',\n description: 'This is a test tag',\n parents: [0],\n },\n {\n id: 2,\n name: 'Test tag 3',\n description: 'This is a test tag',\n parents: [0, 1],\n }\n]\n\n# Create nodes for tags:\nfor tag in tags:\n try:\n # See if node exists:\n node = nodes[str(tag['id'])]\n except KeyError:\n # Create a new node:\n node = self.graph.add_node(id=str(tag['id']), label=tag['name'])\n\n # Update node:\n node.set('viz:size', value=10.0)\n node.set('viz:color', r=130, g=130, b=130)\n\n # Update node attributes:\n for attr in self.graph.node_attributes.keys():\n try:\n node.attributes[attr] = tag[attr]\n except KeyError:\n try:\n del node.attributes[attr]\n except IndexError:\n pass\n\nnodes = {node.id: node for node in graph.nodes}\n\n# Create edges for tags:\nfor tag in tags:\n try:\n for parent_id in tag['parents']:\n edge = Edge(parent_id, tag['id'])\n graph.edges.append(edge)\n # Attributes are not available before adding edge to graph\n edge.attributes['relation_type'] = 'parents'\n except KeyError:\n pass\n\ngraph.sort_nodes(attr='count', reverse=True)\n\ngexf.write()\n~~~", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/demux/simplegexf", "keywords": "simplegexf gephi gexf", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "simplegexf", "package_url": "https://pypi.org/project/simplegexf/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/simplegexf/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/demux/simplegexf" }, "release_url": "https://pypi.org/project/simplegexf/0.1.5/", "requires_dist": null, "requires_python": null, "summary": "A simple .gexf parser/writer for python", "version": "0.1.5" }, "last_serial": 1988117, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "d508db4993d215dee611ecf2cec82320", "sha256": "9ebd4993ff28e4cbd212b0696e4f0d645a2faa49cf52c5c6023da9354a2cf656" }, "downloads": -1, "filename": "simplegexf-0.1.0.tar.gz", "has_sig": false, "md5_digest": "d508db4993d215dee611ecf2cec82320", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4750, "upload_time": "2016-02-19T19:10:30", "url": "https://files.pythonhosted.org/packages/8b/b8/560727d486730248d484fab4692fd34901b200632d575aca4b45150b6e54/simplegexf-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "a1229c07da5f493ff9a6602b66e4910c", "sha256": "cca4f4910ad360a38811fa30ca1456c34cb3b6d96dd7f36b53d91352d36a6874" }, "downloads": -1, "filename": "simplegexf-0.1.1.tar.gz", "has_sig": false, "md5_digest": "a1229c07da5f493ff9a6602b66e4910c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2139, "upload_time": "2016-02-20T16:53:41", "url": "https://files.pythonhosted.org/packages/e1/f4/0cfb089d188fe513f28912091616475453425ce3563fd001141d9a713622/simplegexf-0.1.1.tar.gz" } ], "0.1.2": [], "0.1.3": [ { "comment_text": "", "digests": { "md5": "788218cbd3f6e5e5a8a411ea50aaa7f9", "sha256": "1d89a28e1afd9b31c276da1b604dbb53f530770125af0a72ae25355ba8f405e8" }, "downloads": -1, "filename": "simplegexf-0.1.3.tar.gz", "has_sig": false, "md5_digest": "788218cbd3f6e5e5a8a411ea50aaa7f9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2157, "upload_time": "2016-03-03T19:02:01", "url": "https://files.pythonhosted.org/packages/e5/7e/3dfa0c54c7d1467085f42f1a5aed4be08aa3528c4593aea3f84402420782/simplegexf-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "81dd28a2ab13e08a06e2c9ea534f580e", "sha256": "f625f53b2aecf4c961ca8a4c6e56da0407bc3b42f87e92ab40aa683d3ba88e64" }, "downloads": -1, "filename": "simplegexf-0.1.4.tar.gz", "has_sig": false, "md5_digest": "81dd28a2ab13e08a06e2c9ea534f580e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2178, "upload_time": "2016-03-03T19:30:08", "url": "https://files.pythonhosted.org/packages/7e/c6/fea46e5d61b28522c49da2c3584ccf035ef3078966e7922ff1cf57347ca7/simplegexf-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "dadf9ca8b266bad6a7ecdf4b246b346b", "sha256": "4a7347d332b20c19012072605fcf681b1b31919062b4d6f0f218868aecfe9067" }, "downloads": -1, "filename": "simplegexf-0.1.5.tar.gz", "has_sig": false, "md5_digest": "dadf9ca8b266bad6a7ecdf4b246b346b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4669, "upload_time": "2016-03-03T19:41:25", "url": "https://files.pythonhosted.org/packages/b3/32/181ddf7471482f4098cca04209ed2f66551acecf037aebb1fe0e1bdf6858/simplegexf-0.1.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "dadf9ca8b266bad6a7ecdf4b246b346b", "sha256": "4a7347d332b20c19012072605fcf681b1b31919062b4d6f0f218868aecfe9067" }, "downloads": -1, "filename": "simplegexf-0.1.5.tar.gz", "has_sig": false, "md5_digest": "dadf9ca8b266bad6a7ecdf4b246b346b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4669, "upload_time": "2016-03-03T19:41:25", "url": "https://files.pythonhosted.org/packages/b3/32/181ddf7471482f4098cca04209ed2f66551acecf037aebb1fe0e1bdf6858/simplegexf-0.1.5.tar.gz" } ] }