Skip to main content

SatClave

A small library implementing graph functions, and other in future

Installation


pip install satclave

Get started

Here are the implementations of SatClave.

Graph

from satclave import Graph

# Create a new graph

graph = Graph()



# Add some vertices

graph.add_vertex(1)

graph.add_vertex(2)

graph.add_vertex(3)

graph.add_vertex(4)



# Add some edges

graph.add_edge(1, 2)

graph.add_edge(2, 3)

graph.add_edge(3, 4)

graph.add_edge(4, 1)



# Print the graph

print("Vertices:", graph.vertices)

print("Edges:", graph.edges)



# Test graph connectivity

print("Is the graph connected?", graph.is_connected())



# Test DFS and BFS

print("DFS:", graph.depth_first_search(1))

print("BFS:", graph.breadth_first_search(1))



# Test shortest path

print("Shortest path from 1 to 3:", graph.get_shortest_path(1, 3))



# Test connected components

print("Connected components:", graph.get_connected_components())



# Test vertex removal

graph.remove_vertex(2)

print("Vertices after removal:", graph.vertices)

print("Edges after removal:", graph.edges)



# Test cycle detection

print("Does the graph contain a cycle?", graph.is_cyclic())

Vector

from vector import Vector



# create two vectors

v1 = Vector([1, 2, 3])

v2 = Vector([4, 5, 6])



# test vector addition and subtraction

v3 = v1 + v2

v4 = v2 - v1

print(f"v1 + v2 = {v3}")  

print(f"v2 - v1 = {v4}") 



# test dot product and cross product

dot_product = v1.dot(v2)

cross_product = v1.cross(v2)

print(f"v1 . v2 = {dot_product}")  

print(f"v1 x v2 = {cross_product}") 



# test vector magnitude and normalization

magnitude_v1 = v1.magnitude()

normalized_v1 = v1.normalize()

print(f"magnitude of v1 = {magnitude_v1}")  

print(f"normalized v1 = {normalized_v1}")  

Release files for satclave 0.1.2

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

Source distribution (sdist)

Source distribution for satclave 0.1.2
File Size Uploaded
satclave-0.1.2.tar.gz 5.4 kB Details

Release files / satclave-0.1.2.tar.gz

Download URL satclave-0.1.2.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d9a894207e97275ed983acef63298e5ae06182d8291d096d28804db784d69c35
BLAKE2b-256 checksum
How to use checksums
614681e3594ebbf3e7e5200b2039d6b0c7b6cd8ee9c44ee68d06644cc1b65464
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release history Release notifications | RSS feed

This release

0.1.2 This release

1 release file

0.1.1

1 release file

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