Package: durable-network-x
Durable NetworkXIntroductionDurable NetworkX is an extension to the popular Python package NetworkX, providing persistence capabilities for graph objects. By seamlessly integrating with NetworkX, Durable NetworkX offers users the ability to not only perform complex graph operations but also to store and manage graph data across sessions, ensuring data durability and easy retrieval.Why use Durable NetworkX?Integrated Experience with NetworkX: If you are already familiar with NetworkX, integrating Durable NetworkX is straightforward. You can perform all the graph operations that NetworkX provides while also enjoying the added persistence capabilities of Durable NetworkX.Data Durability: With Durable NetworkX, you no longer need to worry about losing your graph data after your Python session ends. Your graph data will persist, allowing you to load it in subsequent sessions, making it ideal for long-term projects and research.Versatile Storage Options: Durable NetworkX offers multiple storage manager implementations, includingLocalFileStorageManagerfor storing on the local filesystem andS3StorageManagerfor storing on Amazon S3. This flexibility ensures that you can choose the storage solution that best fits your project needs.Easy Management of Graph Instances: With the ability to create new instances, use existing ones, and delete instances, managing your graph datasets becomes hassle-free. This is especially beneficial for projects that deal with multiple graph datasets.Storage Efficiency: Durable NetworkX uses the GraphML format for storage, ensuring that your graph data is stored in a structured and efficient manner, which is also widely supported for interoperability with other graph processing tools.Scalable: Leveraging cloud storage solutions like Amazon S3 means that as your data grows, you can easily scale your storage without worrying about infrastructure.Enhanced Data Security: By using storage solutions like Amazon S3, you can benefit from the built-in security measures provided by these platforms, ensuring your graph data remains protected.How to Use Durable NetworkX?Installation:
You can add in your projectpip install durable-network-xOr, if you are using poetrypoetry add durable-network-xInitialization:fromdurable_network_x.storage_managers.local_file_storage_managerimportLocalFileStorageManagerfromdurable_network_ximportDurableNetworkXstorage_manager=LocalFileStorageManager(root_dir="/path/to/store/data")durable_graph=DurableNetworkX(storage_manager=storage_manager)Creating a New Graph Instance:durable_graph.new(instance_id="my_graph")Working with the Graph: All the operations you can perform on a NetworkX graph, you can perform on thegraphproperty of the Durable NetworkX instance.g=durable_graph.graphg.add_node(1)Saving Changes: After performing operations, save the graph.durable_graph.save()Loading an Existing Graph:durable_graph.use(instance_id="my_graph")Deleting a Graph Instance:durable_graph.delete()Using Amazon S3 as a StorageTo use Amazon S3, simply use theS3StorageManager.fromdurable_network_x.storage_managers.local_file_storage_managerimportS3StorageManager# Initialize a storage manager with the desired S3 bucket and credentialsstorage_manager=S3StorageManager(bucket_name="my-s3-bucket",aws_access_key_id="YOUR_AWS_KEY",aws_secret_access_key="YOUR_AWS_SECRET")# The rest of the operations remain the sameExtending with Custom Storage ManagersUsers can also define their own storage managers by inheriting from theStorageManagerclass and implementing the required methods (read,write,delete, andexists).from durable_network_x.storage_managers import StorageManagerContributingIf you would like to contribute todurable-network-x, please fork the repository, make your changes, and submit a pull request. I appreciate all contributions and feedback!LicenseMITEnjoy usingdurable-network-xand have fun building durable graph applications!