Skip to main content
gdMetriX

PyPI Python NumPy Downloads Coverage License GitHub Pages Paper Code style: Black PRs Welcome

gdMetriX is an extension to networkX providing commonly used quality measures in graph drawing as well as access to some datasets used previously for evaluating graph embedding algorithms.

Installation

gdMetriX requires Python 3.9 or higher.

Before installing, make sure you have the latest version of pip installed:

python -m pip install --upgrade pip

To install the package using pip use the following command:

pip install gdMetriX

Examples

Working with networkX

gdMetriX works with the graph classes of networkX. For more details on how to work with networkX, please refer to their documentation.

For all graph drawing metrics, gdMetriX needs node positions, which is expected as a tuple with the attribute name ' pos'. You can set the attributes using networkX:

import networkx as nx
import gdMetriX

g = nx.Graph()
g.add_node('nodeA')
g.add_node('nodeB')
pos = {'nodeA': (0, 3.5), 'nodeB': (-3, 3)}
nx.set_node_attributes(g, pos)

Alternatively you can also set the position for a individual vertex:

g.add_node('nodeC', pos=(0, 0))

Calculating quality metrics

For a complete list of implemented metrics, please refer to the documentation.

For an example, in order to calculate the number of crossings, use:

crossings = gdMetriX.get_crossings(g)
print(len(crossings))

The node positions are automatically read from the graph. You can also supply them directly:

pos = {'nodeA': (0, 3.5), 'nodeB': (-3, 3), 'nodeC': (0, 0)}
crossings = gdMetriX.get_crossings(g, pos=pos)
print(len(crossings))

Loading datasets

gdMetriX supports the automatic import of graph drawing datasets. The datasets are collected from the Graph Layout Benchmark Datasets project from the Northeastern University Visualization Lab easily accessible for networkX.

The project aims to collect datasets used for graph layout algorithms and make them available for long-term access. The graphs are stored on the Open Science Foundation platform.

Information about the individual datasets can be found at the project homepage.

To get a list of all available datasets:

>> > available_datasets = get_available_datasets()
>> > print(available_datasets)
['subways', 'code', 'rome', 'chess', 'steinlib', ...

To iterate over all graphs of a given dataset, simply call :func:get_list_of_graphs():

>> > for graph in get_list_of_graphs('subways'):
    >> > print(graph.nodes())

License

The project is distributed under the GNU General Public License Version 3.

Citing

If you find this project useful for your work, consider citing the corresponding Dagstuhl publication.

Release files for gdMetriX 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gdMetriX 0.0.5
File Size Uploaded
gdmetrix-0.0.5.tar.gz 74.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gdMetriX 0.0.5
File Interpreter ABI Platform
gdmetrix-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size:159.4 kB

Release files / gdmetrix-0.0.5.tar.gz

Download URL gdmetrix-0.0.5.tar.gz
Size 74.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3167cbec95f675552d3791e67dd6267283f412af8542f00af74d49ad37a8f4b0
BLAKE2b-256 checksum
How to use checksums
ba6845c70479b63644468a0c123556f2e8ce0b2041be7693a8cc75751b542ef6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.3

Release files / gdmetrix-0.0.5-py3-none-any.whl

Download URL gdmetrix-0.0.5-py3-none-any.whl
Size 84.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8272be0d5259154965eb109012eff7a73a968aa5e9725425a2d75ea12ccf2902
BLAKE2b-256 checksum
How to use checksums
e4458999749c711ece3a620d1dee390d6b7289bd8a4f60c81a035e7a44a2bf75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page