Skip to main content

CRIPT Graph Operation Plugin for the Python SDK

CI Tests https://trunk.io check

This repository contains a plugin designed to work with the Python SDK of the CRIPT project. The CRIPT project is an innovative initiative in polymer technology. For more information about the project, please visit the CRIPT website.

The Python SDK, which this plugin complements, can be found here. It provides a powerful set of tools for working with CRIPT data graphs.

Installation

To install the CRIPT Graph Operation Plugin, you can use pip:

pip install cript-graph

NetworkX Graph Conversion

The plugin offers a convenient conversion function to convert a CRIPT SDK data graph into a NetworkX graph. NetworkX is a widely-used Python package for graph operations.

Here's an example of how to use the conversion function:

import cript
import cript_graph

with cript.API(None, None) as api:
    # CRIPT SDK code to build or download the data graph
    project = cript.Project(...)
    # ...
    networkx_graph = cript_graph.get_networkx_graph(project)
    # Perform NetworkX graph operations
    print(networkx_graph.nodes)
    print(networkx_graph.edges)

Please refer to the documentation of the get_networkx_graph function for detailed information about the resulting graph.

Graphviz Dot Visualization

Visualizing the entire data graph of CRIPT can sometimes be challenging, especially when more detailed information is required, such as for debugging purposes. In such cases, the Graphviz dot tool can be a valuable resource.

The plugin provides a tool to generate a visual representation of the data graph using the Graphviz dot language.

Here's an example of how to generate a dot file using the plugin:

import cript
import cript_graph

with cript.API(None, None) as api:
    # CRIPT SDK code to build or download the data graph
    project = cript.Project(...)
    # ...
    # Create an intermediate NetworkX graph
    networkx_graph = cript_graph.get_networkx_graph(project)
    # Generate the graph representation in the dot language
    dot_string = cript_graph.get_dot_graph(networkx_graph)

You can write the resulting dot language string to a file:

with open("graph.dot", "w") as file_handle:
    file_handle.write(dot_string)

To convert the dot file to an SVG graph using the Graphviz command line tool:

dot -Tsvg graph.dot > graph.svg

Alternatively, you can use the pydot package to handle the generation of the visualization from within Python:

import pydot

pydot_graph = pydot.graph_from_dot_data(dot_string)
pydot_graph.write_svg("graph.svg")

An example graph of CRIPT visualized using Graphviz dot:

Example Graph of CRIPT visualized via Graphviz dot

References

Walsh, D. J., Zou, W., Schneider, L., Mello, R., Deagen, M. E., Mysona, J., ... & Olsen, B. D. (2023). Community Resource for Innovation in Polymer Technology (CRIPT): A Scalable Polymer Material Data Structure.

Metadata

Release files for cript-graph 0.0.0

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

Source distribution (sdist)

Source distribution for cript-graph 0.0.0
File Size Uploaded
cript_graph-0.0.0.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cript-graph 0.0.0
File Interpreter ABI Platform
cript_graph-0.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.9 kB

Release files / cript_graph-0.0.0.tar.gz

Download URL cript_graph-0.0.0.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0d6d5bdd01f4fe140824108fa63cee63c0e06dfea0c0a66a1098f151ac9471e7
BLAKE2b-256 checksum
How to use checksums
3782ea693f0a63d95162a14132ba8ed619013392eae69b8e84f7e0faf7427982
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / cript_graph-0.0.0-py3-none-any.whl

Download URL cript_graph-0.0.0-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bb26fef931bb66ebd83aa0af1336df274a8440069f68b680e23bc54132e21963
BLAKE2b-256 checksum
How to use checksums
e4a40f8189bc2a22fab8cbf74a5bef6d335c27d8680cc6d32dcffd7bc5563789
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release history Release notifications | RSS feed

This release

0.0.0 This release

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