Graphinate 0.6.0__tar.gz → 0.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {graphinate-0.6.0 → graphinate-0.8.0}/.github/workflows/codeql.yml +5 -5
- {graphinate-0.6.0 → graphinate-0.8.0}/.gitignore +2 -1
- {graphinate-0.6.0 → graphinate-0.8.0}/PKG-INFO +82 -13
- {graphinate-0.6.0 → graphinate-0.8.0}/README.md +78 -11
- graphinate-0.8.0/docs/.dates_cache.json +86 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/docs/examples/code.md +12 -7
- graphinate-0.8.0/docs/examples/social.md +15 -0
- graphinate-0.8.0/docs/examples/web.md +35 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/docs/gen_ref_pages.py +1 -1
- graphinate-0.8.0/docs/index.md +4 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/docs/intro.md +18 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/docs/start.md +10 -3
- graphinate-0.8.0/docs/tutorial.md +350 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/docs/usage/cli.md +1 -1
- {graphinate-0.6.0 → graphinate-0.8.0}/docs/usage/lib.md +0 -7
- graphinate-0.8.0/examples/code/git_commits.py +59 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/examples/code/python_ast.py +51 -10
- {graphinate-0.6.0 → graphinate-0.8.0}/examples/code/python_dependencies.py +2 -5
- {graphinate-0.6.0 → graphinate-0.8.0}/examples/code/requirements.txt +1 -0
- graphinate-0.8.0/examples/code/tokens.py +50 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/examples/github/followers.py +4 -12
- {graphinate-0.6.0 → graphinate-0.8.0}/examples/github/repositories.py +4 -4
- graphinate-0.6.0/tests/graphinate/test_materializers.py → graphinate-0.8.0/examples/math/_test_materializers.py +10 -9
- {graphinate-0.6.0 → graphinate-0.8.0}/examples/math/graph_atlas.py +4 -3
- graphinate-0.6.0/src/graphinate/materializers/__init__.py → graphinate-0.8.0/examples/math/materializers.py +5 -9
- {graphinate-0.6.0 → graphinate-0.8.0}/examples/math/polygonal_graph.py +11 -24
- graphinate-0.8.0/examples/math/requirements.txt +2 -0
- graphinate-0.8.0/examples/science/caffeine.py +44 -0
- graphinate-0.8.0/examples/social/cache/13/dd/73ce25face7beb30b69b64feeb77.val +0 -0
- graphinate-0.8.0/examples/social/cache/21/9e/00846f323987ba16cfbe0127d8eb.val +0 -0
- graphinate-0.8.0/examples/social/cache/70/b6/2aefb0269adce7fedf877fa0d267.val +0 -0
- graphinate-0.8.0/examples/social/cache/87/f5/ec1739bc369e84c3fcb302bf532a.val +0 -0
- graphinate-0.8.0/examples/social/cache/ba/fe/3aca7b2c38abff60e7ce5eb486a8.val +0 -0
- graphinate-0.8.0/examples/social/cache/c7/9e/ce82b0288020b7152779df09bd73.val +0 -0
- graphinate-0.8.0/examples/social/cache/cache.db +0 -0
- graphinate-0.8.0/examples/social/cache/d2/53/3b88f2fc162561cfdbbe9abc352a.val +0 -0
- graphinate-0.8.0/examples/social/cache/e2/d5/5d079f200eabf9b625b0473f6fbe.val +0 -0
- graphinate-0.8.0/examples/social/gui.py +108 -0
- graphinate-0.8.0/examples/social/music_artists.py +146 -0
- graphinate-0.8.0/examples/social/requirements.txt +3 -0
- graphinate-0.8.0/examples/system/.ignore +796 -0
- graphinate-0.8.0/examples/system/files.py +79 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/examples/system/processes.py +11 -24
- {graphinate-0.6.0 → graphinate-0.8.0}/examples/system/requirements.txt +1 -0
- graphinate-0.8.0/examples/web/html_dom.py +57 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/examples/web/page_links.py +3 -8
- {graphinate-0.6.0 → graphinate-0.8.0}/mkdocs.yml +21 -13
- {graphinate-0.6.0 → graphinate-0.8.0}/pyproject.toml +21 -6
- graphinate-0.8.0/src/graphinate/__init__.py +18 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/src/graphinate/builders.py +90 -103
- {graphinate-0.6.0 → graphinate-0.8.0}/src/graphinate/cli.py +10 -13
- {graphinate-0.6.0 → graphinate-0.8.0}/src/graphinate/color.py +5 -0
- graphinate-0.8.0/src/graphinate/constants.py +4 -0
- graphinate-0.8.0/src/graphinate/converters.py +91 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/src/graphinate/modeling.py +53 -32
- graphinate-0.8.0/src/graphinate/renderers/__init__.py +5 -0
- graphinate-0.6.0/src/graphinate/server/__init__.py → graphinate-0.8.0/src/graphinate/renderers/graphql.py +12 -14
- {graphinate-0.6.0/src/graphinate/materializers → graphinate-0.8.0/src/graphinate/renderers}/matplotlib.py +5 -3
- graphinate-0.8.0/src/graphinate/server/web/viewer/__init__.py +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/src/graphinate/server/web/viewer/index.html +164 -45
- graphinate-0.8.0/src/graphinate/server/web/voyager/__init__.py +0 -0
- graphinate-0.6.0/src/graphinate/tools/__init__.py → graphinate-0.8.0/src/graphinate/tools.py +3 -1
- {graphinate-0.6.0 → graphinate-0.8.0}/tests/conftest.py +6 -5
- {graphinate-0.6.0 → graphinate-0.8.0}/tests/graphinate/test_builders.py +25 -63
- graphinate-0.8.0/tests/graphinate/test_converters.py +60 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/tests/graphinate/test_modeling.py +4 -3
- graphinate-0.6.0/.coveragerc +0 -3
- graphinate-0.6.0/STATS.md +0 -18
- graphinate-0.6.0/docs/dev.md +0 -35
- graphinate-0.6.0/docs/examples/web.md +0 -18
- graphinate-0.6.0/docs/index.md +0 -69
- graphinate-0.6.0/examples/math/requirements.txt +0 -1
- graphinate-0.6.0/src/graphinate/__init__.py +0 -16
- graphinate-0.6.0/src/graphinate/tools/converters.py +0 -28
- graphinate-0.6.0/src/graphinate/tools/mutators.py +0 -153
- graphinate-0.6.0/tests/graphinate/test_tools.py +0 -65
- {graphinate-0.6.0 → graphinate-0.8.0}/.github/dependabot.yml +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/.github/workflows/publish-docs.yaml +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/.github/workflows/publish.yml +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/.github/workflows/test-beta.yml +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/.github/workflows/test.yml +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/.sonarcloud.properties +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/LICENSE +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/docs/acknowledge.md +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/docs/assets/badge/v0.json +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/docs/assets/images/logo-128.png +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/docs/assets/images/network_graph.png +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/docs/assets/stylesheets/extra.css +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/docs/examples/github.md +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/docs/examples/math.md +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/docs/examples/system.md +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/examples/github/_client.py +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/examples/github/commits_visibilty_graph.py +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/examples/github/followers.graphql +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/examples/github/graphql.config.yml +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/examples/github/repositories.graphql +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/examples/github/requirements.txt +0 -0
- {graphinate-0.6.0/src/graphinate/server/web/elements → graphinate-0.8.0/examples/math}/__init__.py +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/examples/math/graphs.py +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/examples/math/gui.py +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/examples/web/requirements.txt +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/playground/ethernet/traceroute.py +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/playground/genric_graph.graphql +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/playground/graphql.config.yml +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/playground/house_of_graphs.py +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/playground/social/albums.json +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/playground/social/musicisians.py +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/playground/text/nlp_graph.py +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/playground/text/requirements.txt +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/playground/time_series/requirements.txt +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/playground/time_series/visibility_graph.py +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/sonar-project.properties +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/src/graphinate/__main__.py +0 -0
- {graphinate-0.6.0/src/graphinate/server/web/graphiql → graphinate-0.8.0/src/graphinate/server}/__init__.py +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/src/graphinate/server/starlette/__init__.py +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/src/graphinate/server/starlette/views.py +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/src/graphinate/server/web/__init__.py +0 -0
- {graphinate-0.6.0/src/graphinate/server/web/rapidoc → graphinate-0.8.0/src/graphinate/server/web/elements}/__init__.py +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/src/graphinate/server/web/elements/index.html +0 -0
- {graphinate-0.6.0/src/graphinate/server/web/viewer → graphinate-0.8.0/src/graphinate/server/web/graphiql}/__init__.py +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/src/graphinate/server/web/graphiql/index.html +0 -0
- {graphinate-0.6.0/src/graphinate/server/web/voyager → graphinate-0.8.0/src/graphinate/server/web/rapidoc}/__init__.py +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/src/graphinate/server/web/rapidoc/index.html +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/src/graphinate/server/web/static/images/logo-128.png +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/src/graphinate/server/web/static/images/logo.svg +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/src/graphinate/server/web/static/images/network_graph.png +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/src/graphinate/server/web/voyager/index.html +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/src/graphinate/typing.py +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/tests/graphinate/test_cli.py +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/tests/graphinate/test_color.py +0 -0
- {graphinate-0.6.0 → graphinate-0.8.0}/tests/graphinate/test_server.py +0 -0
|
@@ -13,10 +13,10 @@ name: "CodeQL"
|
|
|
13
13
|
|
|
14
14
|
on:
|
|
15
15
|
push:
|
|
16
|
-
branches: [ "
|
|
16
|
+
branches: [ "main" ]
|
|
17
17
|
pull_request:
|
|
18
18
|
# The branches below must be a subset of the branches above
|
|
19
|
-
branches: [ "
|
|
19
|
+
branches: [ "main" ]
|
|
20
20
|
schedule:
|
|
21
21
|
- cron: '44 6 * * 4'
|
|
22
22
|
|
|
@@ -50,7 +50,7 @@ jobs:
|
|
|
50
50
|
|
|
51
51
|
# Initializes the CodeQL tools for scanning.
|
|
52
52
|
- name: Initialize CodeQL
|
|
53
|
-
uses: github/codeql-action/init@
|
|
53
|
+
uses: github/codeql-action/init@v3
|
|
54
54
|
with:
|
|
55
55
|
languages: ${{ matrix.language }}
|
|
56
56
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
@@ -64,7 +64,7 @@ jobs:
|
|
|
64
64
|
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
|
|
65
65
|
# If this step fails, then you should remove it and run the build manually (see below)
|
|
66
66
|
- name: Autobuild
|
|
67
|
-
uses: github/codeql-action/autobuild@
|
|
67
|
+
uses: github/codeql-action/autobuild@v3
|
|
68
68
|
|
|
69
69
|
# ℹ️ Command-line programs to run using the OS shell.
|
|
70
70
|
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
|
@@ -77,6 +77,6 @@ jobs:
|
|
|
77
77
|
# ./location_of_script_within_repo/buildscript.sh
|
|
78
78
|
|
|
79
79
|
- name: Perform CodeQL Analysis
|
|
80
|
-
uses: github/codeql-action/analyze@
|
|
80
|
+
uses: github/codeql-action/analyze@v3
|
|
81
81
|
with:
|
|
82
82
|
category: "/language:${{matrix.language}}"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: Graphinate
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 0.8.0
|
|
4
|
+
Summary: Graphinate. Data to Graphs.
|
|
5
5
|
Project-URL: Homepage, https://erivlis.github.io/graphinate
|
|
6
6
|
Project-URL: Documentation, https://erivlis.github.io/graphinate
|
|
7
7
|
Project-URL: Bug Tracker, https://github.com/erivlis/graphinate/issues
|
|
@@ -30,8 +30,10 @@ Requires-Python: >=3.10
|
|
|
30
30
|
Requires-Dist: click
|
|
31
31
|
Requires-Dist: inflect
|
|
32
32
|
Requires-Dist: loguru
|
|
33
|
+
Requires-Dist: mappingtools
|
|
33
34
|
Requires-Dist: matplotlib
|
|
34
35
|
Requires-Dist: networkx
|
|
36
|
+
Requires-Dist: networkx-mermaid>=0.1.0
|
|
35
37
|
Requires-Dist: strawberry-graphql[asgi,opentelemetry]
|
|
36
38
|
Provides-Extra: plot
|
|
37
39
|
Requires-Dist: scipy; extra == 'plot'
|
|
@@ -40,7 +42,7 @@ Requires-Dist: starlette-prometheus; extra == 'server'
|
|
|
40
42
|
Requires-Dist: uvicorn[standard]; extra == 'server'
|
|
41
43
|
Description-Content-Type: text/markdown
|
|
42
44
|
|
|
43
|
-
# [
|
|
45
|
+
# [Graphinate. Data to Graphs.](https://erivlis.github.io/graphinate/)
|
|
44
46
|
|
|
45
47
|
<img height="360" src="https://github.com/erivlis/graphinate/assets/9897520/dae41f9f-69e5-4eb5-a488-87ce7f51fa32" alt="Graphinate. Data to Graphs.">
|
|
46
48
|
|
|
@@ -117,6 +119,38 @@ Description-Content-Type: text/markdown
|
|
|
117
119
|
</tr>
|
|
118
120
|
</table>
|
|
119
121
|
|
|
122
|
+
## Table of Contents
|
|
123
|
+
|
|
124
|
+
- [Introduction](#introduction)
|
|
125
|
+
- [What is Graphinate?](#what-is-graphinate)
|
|
126
|
+
- [Links](#links)
|
|
127
|
+
- [Quick Start](#quick-start)
|
|
128
|
+
- [Install](#install)
|
|
129
|
+
- [Example](#example)
|
|
130
|
+
- [CLI](#cli)
|
|
131
|
+
- [Commands](#commands)
|
|
132
|
+
- [Save](#save)
|
|
133
|
+
- [Server](#server)
|
|
134
|
+
- [Gallery](#gallery)
|
|
135
|
+
- [Python AST](#python-ast)
|
|
136
|
+
- [GitHub Repository](#github-repository)
|
|
137
|
+
- [Python AST - 3D Force-Directed Animation](#python-ast---3d-force-directed-animation)
|
|
138
|
+
- [Web Page Links](#web-page-links)
|
|
139
|
+
- [Development](#development)
|
|
140
|
+
- [Ruff](#ruff)
|
|
141
|
+
- [Test](#test)
|
|
142
|
+
- [Standard (cobertura) XML Coverage Report](#standard-cobertura-xml-coverage-report)
|
|
143
|
+
- [HTML Coverage Report](#html-coverage-report)
|
|
144
|
+
- [Docs](#docs)
|
|
145
|
+
- [test](#test-1)
|
|
146
|
+
- [build](#build)
|
|
147
|
+
- [Acknowledgements](#acknowledgements)
|
|
148
|
+
- [Dependencies](#dependencies)
|
|
149
|
+
- [Python](#python)
|
|
150
|
+
- [Javascript and HTML](#javascript-and-html)
|
|
151
|
+
- [Dev Tools](#dev-tools)
|
|
152
|
+
- [IDE](#ide)
|
|
153
|
+
|
|
120
154
|
## Introduction
|
|
121
155
|
|
|
122
156
|
### What is Graphinate?
|
|
@@ -157,6 +191,7 @@ pip install graphinate[server]
|
|
|
157
191
|
### Example
|
|
158
192
|
|
|
159
193
|
```python title="Octagonal Graph"
|
|
194
|
+
import examples.math.materializers
|
|
160
195
|
import graphinate
|
|
161
196
|
|
|
162
197
|
N: int = 8
|
|
@@ -174,10 +209,16 @@ def edge():
|
|
|
174
209
|
|
|
175
210
|
|
|
176
211
|
# Choose builder and handler
|
|
177
|
-
builder, handler =
|
|
212
|
+
builder, handler = examples.math.materializers.Materializers.NetworkX_with_edge_labels.value
|
|
213
|
+
|
|
214
|
+
# Use the NetworkX Builder
|
|
215
|
+
builder = graphinate.builders.NetworkxBuilder(graph_model)
|
|
178
216
|
|
|
179
|
-
#
|
|
180
|
-
|
|
217
|
+
# build the NetworkX graph
|
|
218
|
+
graph = builder.build()
|
|
219
|
+
|
|
220
|
+
# plot the graph using matplotlib
|
|
221
|
+
graphinate.plot(graph, with_edge_labels=True)
|
|
181
222
|
```
|
|
182
223
|
|
|
183
224
|
#### `graphinate.model` function
|
|
@@ -186,11 +227,6 @@ graphinate.materialize(graph_model, builder=builder, builder_output_handler=hand
|
|
|
186
227
|
> This function creates `GraphModel` class that is used to declaratively register _Edge_ and/or _Node_ data
|
|
187
228
|
> supplier functions by using the `GraphModel.node()` and `GraphModel.edge()` decorators.
|
|
188
229
|
|
|
189
|
-
#### `graphinate.materialize` function
|
|
190
|
-
|
|
191
|
-
> [!NOTE]
|
|
192
|
-
> This function can be used to easily generate an output from a `GraphModel` instance.
|
|
193
|
-
|
|
194
230
|
## CLI
|
|
195
231
|
|
|
196
232
|
### Commands
|
|
@@ -257,12 +293,35 @@ Options:
|
|
|
257
293
|
|
|
258
294
|
## Development
|
|
259
295
|
|
|
296
|
+
### Install dependencies
|
|
297
|
+
|
|
298
|
+
Use UV to install all dependencies
|
|
299
|
+
|
|
300
|
+
```shell
|
|
301
|
+
uv sync --all-extras --all-groups
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Update dependencies
|
|
305
|
+
|
|
306
|
+
```shell
|
|
307
|
+
uv lock --upgrade
|
|
308
|
+
uv sync --all-extras --all-groups
|
|
309
|
+
```
|
|
310
|
+
|
|
260
311
|
### Ruff
|
|
261
312
|
|
|
313
|
+
#### Report issues
|
|
314
|
+
|
|
262
315
|
```shell
|
|
263
316
|
ruff check src
|
|
264
317
|
```
|
|
265
318
|
|
|
319
|
+
#### Fix issues
|
|
320
|
+
|
|
321
|
+
```shell
|
|
322
|
+
ruff check src --fix
|
|
323
|
+
```
|
|
324
|
+
|
|
266
325
|
### Test
|
|
267
326
|
|
|
268
327
|
#### Standard (cobertura) XML Coverage Report
|
|
@@ -277,6 +336,12 @@ ruff check src
|
|
|
277
336
|
python -m pytest tests -n auto --cov=src --cov-branch --doctest-modules --cov-report=html --junitxml=test_results.xml
|
|
278
337
|
```
|
|
279
338
|
|
|
339
|
+
#### Terminal Coverage Report
|
|
340
|
+
|
|
341
|
+
```shell
|
|
342
|
+
python -m pytest tests -n auto --cov=src --cov-branch --doctest-modules --cov-report=term --junitxml=test_results.xml
|
|
343
|
+
```
|
|
344
|
+
|
|
280
345
|
### Docs
|
|
281
346
|
|
|
282
347
|
#### test
|
|
@@ -321,8 +386,12 @@ python -m mkdocs build
|
|
|
321
386
|
|
|
322
387
|
<a href="https://www.jetbrains.com/pycharm/"><img height="60" style="background: linear-gradient(-45deg, #FCF84A, #3DEA62, #21D789);" src="https://resources.jetbrains.com/storage/products/company/brand/logos/PyCharm.png" alt="PyCharm logo"></a>
|
|
323
388
|
|
|
324
|
-
|
|
389
|
+
--------------------------------
|
|
390
|
+
|
|
391
|
+

|
|
392
|
+
|
|
393
|
+
--------------------------------
|
|
325
394
|
|
|
326
395
|
<img alt="Star Chart" src="https://forthebadge.com/images/badges/works-on-my-machine.svg">
|
|
327
396
|
|
|
328
|
-
Copyright © 2023 Eran Rivlis
|
|
397
|
+
Copyright © 2023-2025 Eran Rivlis
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# [
|
|
1
|
+
# [Graphinate. Data to Graphs.](https://erivlis.github.io/graphinate/)
|
|
2
2
|
|
|
3
3
|
<img height="360" src="https://github.com/erivlis/graphinate/assets/9897520/dae41f9f-69e5-4eb5-a488-87ce7f51fa32" alt="Graphinate. Data to Graphs.">
|
|
4
4
|
|
|
@@ -75,6 +75,38 @@
|
|
|
75
75
|
</tr>
|
|
76
76
|
</table>
|
|
77
77
|
|
|
78
|
+
## Table of Contents
|
|
79
|
+
|
|
80
|
+
- [Introduction](#introduction)
|
|
81
|
+
- [What is Graphinate?](#what-is-graphinate)
|
|
82
|
+
- [Links](#links)
|
|
83
|
+
- [Quick Start](#quick-start)
|
|
84
|
+
- [Install](#install)
|
|
85
|
+
- [Example](#example)
|
|
86
|
+
- [CLI](#cli)
|
|
87
|
+
- [Commands](#commands)
|
|
88
|
+
- [Save](#save)
|
|
89
|
+
- [Server](#server)
|
|
90
|
+
- [Gallery](#gallery)
|
|
91
|
+
- [Python AST](#python-ast)
|
|
92
|
+
- [GitHub Repository](#github-repository)
|
|
93
|
+
- [Python AST - 3D Force-Directed Animation](#python-ast---3d-force-directed-animation)
|
|
94
|
+
- [Web Page Links](#web-page-links)
|
|
95
|
+
- [Development](#development)
|
|
96
|
+
- [Ruff](#ruff)
|
|
97
|
+
- [Test](#test)
|
|
98
|
+
- [Standard (cobertura) XML Coverage Report](#standard-cobertura-xml-coverage-report)
|
|
99
|
+
- [HTML Coverage Report](#html-coverage-report)
|
|
100
|
+
- [Docs](#docs)
|
|
101
|
+
- [test](#test-1)
|
|
102
|
+
- [build](#build)
|
|
103
|
+
- [Acknowledgements](#acknowledgements)
|
|
104
|
+
- [Dependencies](#dependencies)
|
|
105
|
+
- [Python](#python)
|
|
106
|
+
- [Javascript and HTML](#javascript-and-html)
|
|
107
|
+
- [Dev Tools](#dev-tools)
|
|
108
|
+
- [IDE](#ide)
|
|
109
|
+
|
|
78
110
|
## Introduction
|
|
79
111
|
|
|
80
112
|
### What is Graphinate?
|
|
@@ -115,6 +147,7 @@ pip install graphinate[server]
|
|
|
115
147
|
### Example
|
|
116
148
|
|
|
117
149
|
```python title="Octagonal Graph"
|
|
150
|
+
import examples.math.materializers
|
|
118
151
|
import graphinate
|
|
119
152
|
|
|
120
153
|
N: int = 8
|
|
@@ -132,10 +165,16 @@ def edge():
|
|
|
132
165
|
|
|
133
166
|
|
|
134
167
|
# Choose builder and handler
|
|
135
|
-
builder, handler =
|
|
168
|
+
builder, handler = examples.math.materializers.Materializers.NetworkX_with_edge_labels.value
|
|
169
|
+
|
|
170
|
+
# Use the NetworkX Builder
|
|
171
|
+
builder = graphinate.builders.NetworkxBuilder(graph_model)
|
|
136
172
|
|
|
137
|
-
#
|
|
138
|
-
|
|
173
|
+
# build the NetworkX graph
|
|
174
|
+
graph = builder.build()
|
|
175
|
+
|
|
176
|
+
# plot the graph using matplotlib
|
|
177
|
+
graphinate.plot(graph, with_edge_labels=True)
|
|
139
178
|
```
|
|
140
179
|
|
|
141
180
|
#### `graphinate.model` function
|
|
@@ -144,11 +183,6 @@ graphinate.materialize(graph_model, builder=builder, builder_output_handler=hand
|
|
|
144
183
|
> This function creates `GraphModel` class that is used to declaratively register _Edge_ and/or _Node_ data
|
|
145
184
|
> supplier functions by using the `GraphModel.node()` and `GraphModel.edge()` decorators.
|
|
146
185
|
|
|
147
|
-
#### `graphinate.materialize` function
|
|
148
|
-
|
|
149
|
-
> [!NOTE]
|
|
150
|
-
> This function can be used to easily generate an output from a `GraphModel` instance.
|
|
151
|
-
|
|
152
186
|
## CLI
|
|
153
187
|
|
|
154
188
|
### Commands
|
|
@@ -215,12 +249,35 @@ Options:
|
|
|
215
249
|
|
|
216
250
|
## Development
|
|
217
251
|
|
|
252
|
+
### Install dependencies
|
|
253
|
+
|
|
254
|
+
Use UV to install all dependencies
|
|
255
|
+
|
|
256
|
+
```shell
|
|
257
|
+
uv sync --all-extras --all-groups
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Update dependencies
|
|
261
|
+
|
|
262
|
+
```shell
|
|
263
|
+
uv lock --upgrade
|
|
264
|
+
uv sync --all-extras --all-groups
|
|
265
|
+
```
|
|
266
|
+
|
|
218
267
|
### Ruff
|
|
219
268
|
|
|
269
|
+
#### Report issues
|
|
270
|
+
|
|
220
271
|
```shell
|
|
221
272
|
ruff check src
|
|
222
273
|
```
|
|
223
274
|
|
|
275
|
+
#### Fix issues
|
|
276
|
+
|
|
277
|
+
```shell
|
|
278
|
+
ruff check src --fix
|
|
279
|
+
```
|
|
280
|
+
|
|
224
281
|
### Test
|
|
225
282
|
|
|
226
283
|
#### Standard (cobertura) XML Coverage Report
|
|
@@ -235,6 +292,12 @@ ruff check src
|
|
|
235
292
|
python -m pytest tests -n auto --cov=src --cov-branch --doctest-modules --cov-report=html --junitxml=test_results.xml
|
|
236
293
|
```
|
|
237
294
|
|
|
295
|
+
#### Terminal Coverage Report
|
|
296
|
+
|
|
297
|
+
```shell
|
|
298
|
+
python -m pytest tests -n auto --cov=src --cov-branch --doctest-modules --cov-report=term --junitxml=test_results.xml
|
|
299
|
+
```
|
|
300
|
+
|
|
238
301
|
### Docs
|
|
239
302
|
|
|
240
303
|
#### test
|
|
@@ -279,8 +342,12 @@ python -m mkdocs build
|
|
|
279
342
|
|
|
280
343
|
<a href="https://www.jetbrains.com/pycharm/"><img height="60" style="background: linear-gradient(-45deg, #FCF84A, #3DEA62, #21D789);" src="https://resources.jetbrains.com/storage/products/company/brand/logos/PyCharm.png" alt="PyCharm logo"></a>
|
|
281
344
|
|
|
282
|
-
|
|
345
|
+
--------------------------------
|
|
346
|
+
|
|
347
|
+

|
|
348
|
+
|
|
349
|
+
--------------------------------
|
|
283
350
|
|
|
284
351
|
<img alt="Star Chart" src="https://forthebadge.com/images/badges/works-on-my-machine.svg">
|
|
285
352
|
|
|
286
|
-
Copyright © 2023 Eran Rivlis
|
|
353
|
+
Copyright © 2023-2025 Eran Rivlis
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"acknowledge.md": {
|
|
3
|
+
"created": "2023-08-20T00:21:55.621436",
|
|
4
|
+
"modified": "2024-07-23T19:55:37.245608"
|
|
5
|
+
},
|
|
6
|
+
"index.md": {
|
|
7
|
+
"created": "2023-08-15T00:05:21.586874",
|
|
8
|
+
"modified": "2025-03-08T22:16:20.899386"
|
|
9
|
+
},
|
|
10
|
+
"intro.md": {
|
|
11
|
+
"created": "2023-08-19T23:54:18.668094",
|
|
12
|
+
"modified": "2025-03-07T10:45:53.488431"
|
|
13
|
+
},
|
|
14
|
+
"start.md": {
|
|
15
|
+
"created": "2023-08-20T00:07:42.683716",
|
|
16
|
+
"modified": "2025-03-02T01:05:03.715683"
|
|
17
|
+
},
|
|
18
|
+
"tutorial.md": {
|
|
19
|
+
"created": "2025-02-26T00:03:30.194156",
|
|
20
|
+
"modified": "2025-03-07T12:16:22.526422"
|
|
21
|
+
},
|
|
22
|
+
"examples\\code.md": {
|
|
23
|
+
"created": "2023-08-20T00:09:32.677003",
|
|
24
|
+
"modified": "2025-03-07T10:14:05.629365"
|
|
25
|
+
},
|
|
26
|
+
"examples\\github.md": {
|
|
27
|
+
"created": "2023-10-05T11:43:15.316025",
|
|
28
|
+
"modified": "2025-01-28T23:47:41.840220"
|
|
29
|
+
},
|
|
30
|
+
"examples\\math.md": {
|
|
31
|
+
"created": "2023-10-05T11:43:22.861997",
|
|
32
|
+
"modified": "2025-01-28T23:54:42.968373"
|
|
33
|
+
},
|
|
34
|
+
"examples\\social.md": {
|
|
35
|
+
"created": "2025-02-24T23:49:35.972953",
|
|
36
|
+
"modified": "2025-02-24T23:51:09.584738"
|
|
37
|
+
},
|
|
38
|
+
"examples\\system.md": {
|
|
39
|
+
"created": "2024-03-27T01:28:38.922865",
|
|
40
|
+
"modified": "2024-03-27T01:51:20.126046"
|
|
41
|
+
},
|
|
42
|
+
"examples\\web.md": {
|
|
43
|
+
"created": "2023-10-05T11:43:30.550657",
|
|
44
|
+
"modified": "2025-03-07T10:25:30.054257"
|
|
45
|
+
},
|
|
46
|
+
"reference\\SUMMARY.md": {
|
|
47
|
+
"created": "2025-03-08T20:51:52.801367",
|
|
48
|
+
"modified": "2025-03-08T20:51:52.807370"
|
|
49
|
+
},
|
|
50
|
+
"usage\\cli.md": {
|
|
51
|
+
"created": "2023-09-27T21:23:44.140564",
|
|
52
|
+
"modified": "2025-03-01T23:56:33.595498"
|
|
53
|
+
},
|
|
54
|
+
"usage\\lib.md": {
|
|
55
|
+
"created": "2023-09-27T21:23:44.133584",
|
|
56
|
+
"modified": "2025-03-07T12:07:02.708943"
|
|
57
|
+
},
|
|
58
|
+
"reference\\graphinate\\builders.md": {
|
|
59
|
+
"created": "2025-03-08T20:51:52.788270",
|
|
60
|
+
"modified": "2025-03-08T20:51:52.792269"
|
|
61
|
+
},
|
|
62
|
+
"reference\\graphinate\\index.md": {
|
|
63
|
+
"created": "2025-03-08T20:51:52.786270",
|
|
64
|
+
"modified": "2025-03-08T20:51:52.788270"
|
|
65
|
+
},
|
|
66
|
+
"reference\\graphinate\\modeling.md": {
|
|
67
|
+
"created": "2025-03-08T20:51:52.792269",
|
|
68
|
+
"modified": "2025-03-08T20:51:52.795269"
|
|
69
|
+
},
|
|
70
|
+
"reference\\graphinate\\typing.md": {
|
|
71
|
+
"created": "2025-03-08T20:51:52.800360",
|
|
72
|
+
"modified": "2025-03-08T20:51:52.805368"
|
|
73
|
+
},
|
|
74
|
+
"reference\\graphinate\\renderers\\graphql.md": {
|
|
75
|
+
"created": "2025-03-08T20:51:52.796358",
|
|
76
|
+
"modified": "2025-03-08T20:51:52.800360"
|
|
77
|
+
},
|
|
78
|
+
"reference\\graphinate\\renderers\\index.md": {
|
|
79
|
+
"created": "2025-03-08T20:51:52.794269",
|
|
80
|
+
"modified": "2025-03-08T20:51:52.798361"
|
|
81
|
+
},
|
|
82
|
+
"reference\\graphinate\\renderers\\matplotlib.md": {
|
|
83
|
+
"created": "2025-03-08T20:51:52.798361",
|
|
84
|
+
"modified": "2025-03-08T20:51:52.803367"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
# Code
|
|
2
2
|
|
|
3
|
+
## GIT Commits
|
|
4
|
+
|
|
5
|
+
=== "GIT Commits"
|
|
6
|
+
|
|
7
|
+
``` python title="examples/code/git_commits.py" linenums="1"
|
|
8
|
+
--8<-- "examples/code/git_commits.py"
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
3
13
|
## Python AST
|
|
4
14
|
|
|
5
15
|
=== "Python AST"
|
|
6
16
|
|
|
7
|
-
```
|
|
17
|
+
```python title="examples/code/python_ast.py" linenums="1"
|
|
8
18
|
--8<-- "examples/code/python_ast.py"
|
|
9
19
|
```
|
|
10
20
|
|
|
@@ -24,12 +34,7 @@
|
|
|
24
34
|
|
|
25
35
|
=== "Python Dependencies"
|
|
26
36
|
|
|
27
|
-
```
|
|
37
|
+
```python title="examples/code/python_dependencies.py" linenums="1"
|
|
28
38
|
--8<-- "examples/code/python_dependencies.py"
|
|
29
39
|
```
|
|
30
40
|
|
|
31
|
-
=== "Requirements"
|
|
32
|
-
|
|
33
|
-
``` text title="examples/code/requirements.txt" linenums="1"
|
|
34
|
-
--8<-- "examples/code/requirements.txt"
|
|
35
|
-
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Social
|
|
2
|
+
|
|
3
|
+
## Music
|
|
4
|
+
|
|
5
|
+
=== "Music"
|
|
6
|
+
|
|
7
|
+
``` python title="examples/social/music.py" linenums="1"
|
|
8
|
+
--8<-- "examples/social/music.py"
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
=== "Dependencies"
|
|
12
|
+
|
|
13
|
+
``` text title="examples/social/requirements.txt" linenums="1"
|
|
14
|
+
--8<-- "examples/social/requirements.txt"
|
|
15
|
+
```
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Web
|
|
2
|
+
|
|
3
|
+
## Web Page Links
|
|
4
|
+
|
|
5
|
+
=== "Web Page Links"
|
|
6
|
+
|
|
7
|
+
``` python title="examples/web/page_links.py" linenums="1"
|
|
8
|
+
--8<-- "examples/web/page_links.py"
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
=== "Dependencies"
|
|
12
|
+
|
|
13
|
+
``` text title="examples/web/requirements.txt" linenums="1"
|
|
14
|
+
--8<-- "examples/web/requirements.txt"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
=== "Plot"
|
|
18
|
+
|
|
19
|
+

|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## HTML DOM
|
|
24
|
+
|
|
25
|
+
=== "HTML DOM"
|
|
26
|
+
|
|
27
|
+
``` python title="examples/web/html_dom.py" linenums="1"
|
|
28
|
+
--8<-- "examples/web/html_page_dom.py"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
=== "Dependencies"
|
|
32
|
+
|
|
33
|
+
``` text title="examples/web/requirements.txt" linenums="1"
|
|
34
|
+
--8<-- "examples/web/requirements.txt"
|
|
35
|
+
```
|
|
@@ -6,7 +6,7 @@ import mkdocs_gen_files
|
|
|
6
6
|
|
|
7
7
|
nav = mkdocs_gen_files.Nav()
|
|
8
8
|
|
|
9
|
-
ignore = ('
|
|
9
|
+
ignore = ('cli.py', 'color.py', 'converters.py', 'constants.py', 'server', 'tools')
|
|
10
10
|
|
|
11
11
|
for path in sorted(Path("src").rglob("*.py")):
|
|
12
12
|
if any(v in path.as_posix() for v in ignore):
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Introduction
|
|
2
2
|
|
|
3
|
+
## Why?
|
|
4
|
+
|
|
5
|
+
### Why Graphs?
|
|
6
|
+
|
|
7
|
+
Graphs are a powerful data structure that can be used to model a wide range of problems.
|
|
8
|
+
They are used in many fields, such as computer science, mathematics, physics, biology, and social sciences.
|
|
9
|
+
|
|
10
|
+
### Why Graphinate?
|
|
11
|
+
|
|
12
|
+
Usually the creation phase of a Graph is a tedious and error-prone process.
|
|
13
|
+
It requires a lot of boilerplate code to transform data into a Graph.
|
|
14
|
+
This process can be automated and simplified. This is where **Graphinate** comes in.
|
|
15
|
+
|
|
3
16
|
## What?
|
|
4
17
|
|
|
5
18
|
### What is Graphinate?
|
|
@@ -51,14 +64,19 @@ A Graph consists of two types of elements:
|
|
|
51
64
|
|
|
52
65
|
A Graph Node can be any Python Hashable object. Usually it will be a primitive type such as an integer or a string,
|
|
53
66
|
in particular when the node in itself has no specific meaning.
|
|
67
|
+
|
|
54
68
|
One can also add attributes to the node to describe additional information. This information can be anything.
|
|
55
69
|
Often attributes are used to store scalar dimensions (e.g., weight, area, width, age, etc.)
|
|
56
70
|
or stylistic information (e.g., color, size, shape, label, etc.).
|
|
57
71
|
|
|
72
|
+
Nodes are usually visualized as circles or points.
|
|
73
|
+
|
|
58
74
|
#### Edges
|
|
59
75
|
|
|
60
76
|
A Graph Edge is a pair of two node values. It can also have additional attributes in the same vain as a Graph Node.
|
|
61
77
|
|
|
78
|
+
Edges are usually visualized as lines connecting two nodes.
|
|
79
|
+
|
|
62
80
|
### Defining a Graph
|
|
63
81
|
|
|
64
82
|
One can define a Graph in two general ways:
|
|
@@ -23,6 +23,7 @@ pip install graphinate[server]
|
|
|
23
23
|
## Demo
|
|
24
24
|
|
|
25
25
|
```python title="Octagonal Graph"
|
|
26
|
+
import examples.math.materializers
|
|
26
27
|
import graphinate
|
|
27
28
|
|
|
28
29
|
N: int = 8
|
|
@@ -40,8 +41,14 @@ def edge():
|
|
|
40
41
|
|
|
41
42
|
|
|
42
43
|
# Choose builder and handler
|
|
43
|
-
builder, handler =
|
|
44
|
+
builder, handler = examples.math.materializers.Materializers.NetworkX_with_edge_labels.value
|
|
44
45
|
|
|
45
|
-
#
|
|
46
|
-
graphinate.
|
|
46
|
+
# Use the NetworkX Builder
|
|
47
|
+
builder = graphinate.builders.NetworkxBuilder(graph_model)
|
|
48
|
+
|
|
49
|
+
# build the NetworkX graph
|
|
50
|
+
graph = builder.build()
|
|
51
|
+
|
|
52
|
+
# plot the graph using matplotlib
|
|
53
|
+
graphinate.plot(graph, with_edge_labels=True)
|
|
47
54
|
```
|