semvec/pypi-packages huggingface dataset:
fast-dijkstra 2.1.2
Fast Dijkstra

# Fast_dijkstra

Fast directed Dijkstra written in C++ with parallelization build in


# Function definition

```toml
Parameters
----------
indptr : List[int]
indices : List[int]
weights : Sequence[float]
sources : List[int]
cutoff: OPTIONAL  float (default = np.inf)
num_threads: OPTIONAL int (default = -1)
    -1: maximum allowed threads

Returns
-------
distances : numpy.ndarray
    Array of shape (num_sources, num_nodes) with shortest distances
predecessors : numpy.ndarray
    Array of shape (num_sources, num_nodes) with predecessor indices

```

## usage
* The graph is passed as a csr_matrix just like scipy. you can reuse scipy to create the graph from edges.
* edges must be integers. starting at 0
* Graph is directed

```py
from scipy.sparse import csr_matrix
from fast_dijkstra import dijkstra

edges = [(0, 1), (0, 2), (1, 2), (1, 3), (2, 3)]
weights = [1.0, 4.0, 2.0, 5.0, 1.0]
sources = [0, 1]

row = [e[0] for e in edges]
col = [e[1] for e in edges]

nodelist = sorted({e[0] for e in edges}.union({e[1] for e in edges}))
nlen = len(nodelist)

sparse = csr_matrix((weights, (row, col)), shape=(nlen, nlen))
indptr = sparse.indptr # [0, 2, 4, 5, 5]
indices = sparse.indices # [1, 2, 2, 3, 3]

distances, predecessor = dijkstra(indptr, indices, weights, sources)

distances   # [
            #   [ 0.,  1.,  3.,  4.],
            #   [inf,  0.,  2.,  3.]
            # ]

predecessor # [
            #   [-9999,     0,     1,     2],
            #   [-9999, -9999,     1,     2]
            # ]
```


# to deploy

1) change the version number in pyproject.toml under [project]
```toml
[project]
name = "fast_dijkstra"
version = "1.0.2"
```

* the poetry config is only used for local dev. to ignore.

2) create a new tag starting with "v"

```sh
git tag -a 'v1.0.2' -m 'description'
```

```sh
git push origin v1.0.2
```

Github action will build wheels for windows and Linux.

3) when Done, upload to Pypi


```sh
./upload v1.0.2
```

# local development build

poetry run python setup.py bdist_wheel

 or 

poetry run python -m build --wheel
vy-organ-sdk 2.5.2
SDK for building VY-CNS organs
Requires Python: >=3.8
Keywords: vy, organs, protocol, zenoh, microservices

# VY Organ SDK (Python)

Python SDK for building VY-CNS organs with Protocol v2 support.

## Installation

```bash
pip install vy-organ-sdk
```

## Quick Start

```python
from vy_organ_sdk import OrganHandler, HandlerRequest, HandlerResponse
from vy_organ_sdk.transports import ZenohOrganServer

class MyOrgan(OrganHandler):
    version = "1.0.0"
    supported_intents = ["my.organ.hello.v1"]

    def handle(self, request: HandlerRequest) -> HandlerResponse:
        return HandlerResponse.success({"message": "Hello!"})

if __name__ == "__main__":
    import asyncio
    server = ZenohOrganServer(MyOrgan(), organ_id="my-organ")
    asyncio.run(server.start())
```

## Environment Variables

- `ZENOH_CONNECT` - Zenoh router endpoints (required)
- `ORGAN_ID` - Unique organ identifier
- `ZENOH_CERT_PATH` - TLS client certificate path
- `ZENOH_KEY_PATH` - TLS client key path
- `ZENOH_CA_PATH` - TLS CA certificate path

## License

MIT