Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/geyang/sparse-graph
https://github.com/geyang/sparse-graph
graph-search graphs sparse-graphs
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/geyang/sparse-graph
- Owner: geyang
- License: mit
- Created: 2020-10-28T06:18:04.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-06-24T20:16:50.000Z (over 3 years ago)
- Last Synced: 2024-04-14T15:11:53.194Z (8 months ago)
- Topics: graph-search, graphs, sparse-graphs
- Language: Jupyter Notebook
- Homepage:
- Size: 3.46 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: LICENSE
Awesome Lists containing this project
README
Dynamic Graphical Memory Implementation
=======================================- `planning.py `__ shows how to use this graph
with graph_search.
- `graph_sparsification.py `__
shows how to sparsify a graph
- `batch_sparsification.py `__
efficiently sparsify a graph with as a batch
- `incremental_api.py `__ shows how to
extend with sparsityUsage
-----To instantiate a graph:
.. code-block:: python
graph = AsymMesh(n=10_000, k=6, dim=2, img_dim=[2], kernel_fn=l2, embed_fn=id2D, d_max=20)
graph.extend(xys, images=xys, meta=xys)
graph.update_zs()
graph.update_edges()Most of the time it is better to enforce sparsity of the graph by only
adding new vertices when there is no existing vertex that is close-by.
The new dedupe API allows us to do this in a batch fashion:.. code-block:: python
spots = graph.dedupe(images=xys, r_min=r_min)
xys = xys[spots]
ds = graph.to_goal(zs_2=xys)
if ds.size == 0:
graph.extend(xys, images=xys, meta=xys)
else:
m = ds.min(axis=-1) >= r_min
if m.sum() > 0:
graph.extend(xys[m], images=xys[m], meta=xys[m])
graph.update_edges()+---------------------+--------------+--------------------------------+
| Dense | Sparse | Details |
+=====================+==============+================================+
| |dense_graph| | |image1| | 10x more edges in the dense |
| | | graph in comparison to the |
| | | sparse graph. |
+---------------------+--------------+--------------------------------+To Experiment
-------------Import this module in the method module.
.. |dense_graph| image:: figures/random_graph.png?raw=true
.. |image1| image:: figures/batch_graph.png?raw=true