STRND: Graph reconstruction via Node2Vec (pecanpy) + UMAP
Project description
STRND
STRND = Spatio Topological Recovery by Network Discovery
- Feed an edge list (pandas DataFrame, NX, PyG, list of edges)
- Get back node coordinates in 2D or 3D (pandas DataFrame)
Install
pip install strnd
Minimal use
from strnd import get_strnd_positions_df
coords_df = get_strnd_positions_df(edge_df, dim=2)
# coords_df columns: node_ID, x, y
edge_df must have columns source, target (and optionally weight).
Example with Graph Generation + Quality Metrics
import numpy as np
from proxigraph.config import GraphConfig
from proxigraph.core import ProximityGraph
from PointQuality import QualityMetrics
from strnd import get_strnd_positions_df
np.random.seed(42)
# 1) create a graph
config = GraphConfig(dim=2, num_points=1000, L=1, point_mode="circle", proximity_mode="delaunay_corrected")
pg = ProximityGraph(config=config)
positions = pg.generate_positions()
edge_df = pg.get_edge_list(as_dataframe=True)
# 2) run STRND
rec_positions = get_strnd_positions_df(edge_df, dim=2)
# 3) quality
rec_positions_ordered = rec_positions.sort_values("node_ID")[["x","y"]].to_numpy()
qm = QualityMetrics(positions, rec_positions_ordered)
print(qm.evaluate_metrics(compute_distortion=False))
# 4) print head
print(rec_positions.head())
dependencies
- numpy
- pandas
- matplotlib
- pecanpy (node2vec)
- umap-learn
- (optional) proxigraph for the demo
license
MIT (or whatever you choose) ```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
strnd-0.1.0.tar.gz
(8.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
strnd-0.1.0-py3-none-any.whl
(8.5 kB
view details)
File details
Details for the file strnd-0.1.0.tar.gz.
File metadata
- Download URL: strnd-0.1.0.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6b9e0ea77ca79d1ef4b34e533850b20db217b498709a8827ef34ba9d8937abb
|
|
| MD5 |
dd02f8254f40ad63ccdb10a1607cb7b2
|
|
| BLAKE2b-256 |
71a3b3a5a53c42a9268c16e0213963bf6b728702103438374a0c1b5e7f46c804
|
File details
Details for the file strnd-0.1.0-py3-none-any.whl.
File metadata
- Download URL: strnd-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ec33a3ddba26ddec44caa14ebe939de6ebe4ae1ea48bc16766a57fc2b94e778
|
|
| MD5 |
e8ed0f3b63ea848bf12e40717a0da8bb
|
|
| BLAKE2b-256 |
38aa7a736994c259f672bf5a3cb0f727eb2ec23b319a7335368404f9be0aebf0
|