https://github.com/aplbrain/gordium
A tool for untangling the mysteries of large-scale graphs.
https://github.com/aplbrain/gordium
Last synced: 11 months ago
JSON representation
A tool for untangling the mysteries of large-scale graphs.
- Host: GitHub
- URL: https://github.com/aplbrain/gordium
- Owner: aplbrain
- Created: 2019-02-19T21:43:59.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-04-28T13:48:15.000Z (about 4 years ago)
- Last Synced: 2025-06-30T12:44:33.792Z (12 months ago)
- Language: Python
- Size: 65.4 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gordium
A tool for untangling the mysteries of large-scale graphs.
## Installation
```shell
git clone https://github.com/aplbrain/gordium.git
pip install -r requirements.txt
pip install .
```
## Data
Gordium expects to receive a pandas DataFrame representing an edge list. It will handle two columns containing the ids of source nodes and target nodes respectively. By default, these column names are expected to be "source" and "target", but they can be specified by passing values for `src_label` and `tgt_label` to the Gordium constructor. At present, all edges are treated as directed, multiedges are ignored, edge attributes are ignored, and selfloops are permitted. A typical CSV representing the edgeframe of a directed 3-cycle is presented below.
```csv
source,target
0,1
1,2
2,0
```
## Usage
```python
import pandas as pd
from gordium import Gordium
edgeframe = pd.read_csv('example.csv')
g = Gordium(
edgeframe,
src_label='MY_SOURCE',
tgt_label='MY_TARGET')
analytics = g.process()
```
## Graph Backends
Gordium defaults to using NetworkX for its graph
algorithms, but it also supports several additional
backends. To use a different backend, pass the
backend constructor into the Gordium constructor as
a `backend`.
Current backends include:
- NetworkXBackend
- IGraphBackend (optional; requires [igraph](https://igraph.org/python/))
```python
import pandas as pd
from gordium import Gordium, IGraphBackend
edgeframe = pd.read_csv('example.csv')
g = Gordium(
edgeframe,
backend=IGraphBackend,
src_label='MY_SOURCE',
tgt_label='MY_TARGET')
analytics = g.process()
```