https://github.com/josugoar/scinet
Network science abstract data types
https://github.com/josugoar/scinet
algorithms data-structures
Last synced: 5 months ago
JSON representation
Network science abstract data types
- Host: GitHub
- URL: https://github.com/josugoar/scinet
- Owner: josugoar
- License: mit
- Created: 2020-05-25T11:21:20.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-02-09T00:14:32.000Z (10 months ago)
- Last Synced: 2025-07-02T18:19:10.972Z (5 months ago)
- Topics: algorithms, data-structures
- Language: Python
- Homepage: https://pypi.org/project/scinet-josugoar
- Size: 150 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# scinet
> Network science abstract data types
**scinet.Graph** is designed upon the [graph (abstract data type)](https://en.wikipedia.org/wiki/Graph_(abstract_data_type)) definition and functions as a bare bones skeletal graph data mapping, containing abstract vertices and edges.
Includes DiGraph and MultiGraph support, with HyperGraph capabilities.
## Installation
1. Install [Python >= 3.8](https://www.python.org/downloads/)
2. Install [scinet]()
```sh
$ pip install scinet-josugoar
```
## Usage
Import **scinet**
```py
import scinet as sn
```
Create graph
```py
G = sn.Graph()
```
Manipulate data
* add_vertex
```py
G.add_vertex(vertex := "foo")
```
* add_edge
Edges must be assigned using hashable keys so that no name conflicts exist between source_vertex and target_vertex edges
```py
key = G.add_edge(source_vertex := "foo", target_vertex := "bar"[, edge := "foobar"])
```
* remove_vertex
```py
G.remove_vertex(vertex := "foo")
```
* remove_edge
```py
G.remove_edge(source_vertex := "foo", target_vertex := "bar"[, edge := "foobar"])")
```
* adjacent
```py
(target_vertex := "bar") in G[(source_vertex := "foo")]
>>> True
```
* neighbours
```py
set(G[(vertex := "foo")])
>>> { "neighbour_1", "neighbour_2", ... }
```
See [docs](docs/scinet.html) for further details.