Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jweinst1/royal
A graph data library
https://github.com/jweinst1/royal
Last synced: 6 days ago
JSON representation
A graph data library
- Host: GitHub
- URL: https://github.com/jweinst1/royal
- Owner: jweinst1
- License: mit
- Created: 2019-12-02T21:58:55.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-08T22:25:14.000Z (almost 5 years ago)
- Last Synced: 2024-09-18T05:26:40.950Z (about 2 months ago)
- Language: C
- Homepage:
- Size: 98.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Royal
## Intro
`royal` is a library and framework for handling graph data. Unlike other data file formats or libraries, `royal` specializes in storing relationships between objects and data points. `royal` is not a graph database, it allows abstraction and processing of
graph relationships in the form of transportable data.## Development Status
Royal is currently in the alpha development phase. The API is being determined.
## Python API
`royal` provides both a python API and a C api. The python api calls the C library via a python extension module.
### Installation
To install royal, you can use pip
```
$ pip install royal
```### Usage
You can import `royal` like a normal python module. The primary object in `royal` is the `RoyalGraph`, an object which contains a sequence of connections.
```py
from royal import RoyalGraph
```A connection symbolizes the relationship between two values. Each connection has two values, and one relationship. These are also called edges and vertices, respectively. Edges and vertices are always strings. A `RoyalGraph` has a maximum size for each part of the connection. This size is determined when an instance of a `RoyalGraph` is created:
```py
g = RoyalGraph(5)
g2 = RoyalGraph(field=5)
```You can also tune the capacity of memory allocated for each graph, and the rate at which the graph will grow in memory consumption, via the `capacity` and `growth` keyword arguments.
### Adding Data
A graph accepts data in the form of connections. For now, the `append` method works primarily to construct a connection and add it to the graph:
```py
>>> g = RoyalGraph(10)
>>> g.append('apples', 'are', 'cool')
>>> g.append('sheets', 'are', 'messy')
```A graph can be visualized by doing:
```py
>>> print(g)
apples/are/cool
sheets/are/messy>>>
```Alternatively, you can convert the graph to a string with different delimeters and separation characters
```py
>>> print(g.str(split='-', sep=','))
apples-are-cool,sheets-are-messy
```