Graphinate 0.3.2__tar.gz → 0.4.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.3.2 → graphinate-0.4.0}/.github/workflows/test-beta.yml +1 -1
- {graphinate-0.3.2 → graphinate-0.4.0}/PKG-INFO +22 -20
- {graphinate-0.3.2 → graphinate-0.4.0}/README.md +21 -19
- graphinate-0.4.0/docs/assets/stylesheets/extra.css +64 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/docs/examples/github.md +0 -7
- graphinate-0.4.0/docs/examples/math.md +29 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/docs/index.md +25 -19
- {graphinate-0.3.2 → graphinate-0.4.0}/docs/intro.md +31 -30
- {graphinate-0.3.2 → graphinate-0.4.0}/docs/start.md +7 -3
- {graphinate-0.3.2 → graphinate-0.4.0}/examples/code/python_ast.py +1 -1
- {graphinate-0.3.2 → graphinate-0.4.0}/examples/code/python_dependencies.py +3 -4
- {graphinate-0.3.2 → graphinate-0.4.0}/examples/github/followers.py +6 -1
- {graphinate-0.3.2 → graphinate-0.4.0}/examples/github/repositories.py +4 -2
- graphinate-0.4.0/examples/math/graph_atlas.py +52 -0
- graphinate-0.4.0/examples/math/graphs.py +808 -0
- {graphinate-0.3.2/src/graphinate/tools → graphinate-0.4.0/examples/math}/gui.py +1 -1
- {graphinate-0.3.2 → graphinate-0.4.0}/examples/math/polygonal_graph.py +7 -4
- {graphinate-0.3.2 → graphinate-0.4.0}/examples/system/processes.py +3 -2
- {graphinate-0.3.2 → graphinate-0.4.0}/examples/web/page_links.py +4 -1
- {graphinate-0.3.2 → graphinate-0.4.0}/pyproject.toml +1 -1
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/cli.py +2 -2
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/materializers/__init__.py +14 -24
- graphinate-0.4.0/tests/graphinate/test_materializers.py +87 -0
- graphinate-0.3.2/docs/assets/stylesheets/extra.css +0 -13
- graphinate-0.3.2/docs/examples/math.md +0 -15
- graphinate-0.3.2/examples/math/graph_atlas.py +0 -828
- graphinate-0.3.2/tests/graphinate/test_materializers.py +0 -79
- {graphinate-0.3.2 → graphinate-0.4.0}/.coveragerc +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/.github/dependabot.yml +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/.github/workflows/codeql.yml +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/.github/workflows/publish-docs.yaml +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/.github/workflows/publish.yml +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/.github/workflows/test.yml +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/.gitignore +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/.sonarcloud.properties +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/LICENSE +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/STATS.md +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/docs/acknowledge.md +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/docs/assets/images/logo-128.png +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/docs/assets/images/network_graph.png +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/docs/dev.md +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/docs/examples/code.md +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/docs/examples/system.md +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/docs/examples/web.md +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/docs/gen_ref_pages.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/docs/usage/cli.md +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/docs/usage/lib.md +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/examples/code/requirements.txt +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/examples/github/_client.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/examples/github/commits_visibilty_graph.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/examples/github/followers.graphql +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/examples/github/graphql.config.yml +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/examples/github/repositories.graphql +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/examples/github/requirements.txt +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/examples/math/requirements.txt +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/examples/system/requirements.txt +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/examples/web/requirements.txt +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/mkdocs.yml +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/playground/ethernet/traceroute.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/playground/genric_graph.graphql +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/playground/graphql.config.yml +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/playground/house_of_graphs.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/playground/social/albums.json +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/playground/social/musicisians.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/playground/text/nlp_graph.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/playground/text/requirements.txt +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/playground/time_series/requirements.txt +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/playground/time_series/visibility_graph.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/sonar-project.properties +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/__init__.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/__main__.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/builders.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/color.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/materializers/matplotlib.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/modeling.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/server/__init__.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/server/starlette/__init__.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/server/starlette/views.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/server/web/__init__.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/server/web/elements/__init__.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/server/web/elements/index.html +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/server/web/graphiql/__init__.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/server/web/graphiql/index.html +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/server/web/rapidoc/__init__.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/server/web/rapidoc/index.html +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/server/web/static/images/logo-128.png +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/server/web/static/images/network_graph.png +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/server/web/static/js/murmurhash3_gc.js +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/server/web/viewer/__init__.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/server/web/viewer/index.html +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/server/web/voyager/__init__.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/server/web/voyager/index.html +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/tools/__init__.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/tools/converters.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/tools/mutators.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/src/graphinate/typing.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/tests/conftest.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/tests/graphinate/test_builders.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/tests/graphinate/test_cli.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/tests/graphinate/test_color.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/tests/graphinate/test_modeling.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/tests/graphinate/test_server.py +0 -0
- {graphinate-0.3.2 → graphinate-0.4.0}/tests/graphinate/test_tools.py +0 -0
|
@@ -16,7 +16,7 @@ jobs:
|
|
|
16
16
|
fail-fast: false
|
|
17
17
|
matrix:
|
|
18
18
|
# https://github.com/actions/python-versions/blob/main/versions-manifest.json
|
|
19
|
-
python-version: [ "3.14.0-alpha.
|
|
19
|
+
python-version: [ "3.14.0-alpha.4" ]
|
|
20
20
|
steps:
|
|
21
21
|
- uses: actions/checkout@v4
|
|
22
22
|
- name: Set up Python ${{ matrix.python-version }}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: Graphinate
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
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
|
|
@@ -73,7 +73,7 @@ Description-Content-Type: text/markdown
|
|
|
73
73
|
<img alt="Libraries.io SourceRank" src="https://img.shields.io/librariesio/sourcerank/pypi/Graphinate.svg?logo=Libraries.io&label=SourceRank">
|
|
74
74
|
</td>
|
|
75
75
|
</tr>
|
|
76
|
-
<tr>
|
|
76
|
+
<tr style="vertical-align: middle;">
|
|
77
77
|
<td>Code</td>
|
|
78
78
|
<td>
|
|
79
79
|
<img alt="GitHub" src="https://img.shields.io/github/license/erivlis/graphinate">
|
|
@@ -82,7 +82,7 @@ Description-Content-Type: text/markdown
|
|
|
82
82
|
<a href="https://github.com/erivlis/graphinate/graphs/contributors"><img alt="Contributors" src="https://img.shields.io/github/contributors/erivlis/graphinate.svg?&logo=git"></a>
|
|
83
83
|
</td>
|
|
84
84
|
</tr>
|
|
85
|
-
<tr>
|
|
85
|
+
<tr style="vertical-align: middle;">
|
|
86
86
|
<td>Tools</td>
|
|
87
87
|
<td>
|
|
88
88
|
<a href="https://www.jetbrains.com/pycharm/"><img alt="PyCharm" src="https://img.shields.io/badge/PyCharm-FCF84A.svg?logo=PyCharm&logoColor=black&labelColor=21D789&color=FCF84A"></a>
|
|
@@ -93,16 +93,16 @@ Description-Content-Type: text/markdown
|
|
|
93
93
|
<a href="https://hatch.pypa.io"><img alt="Hatch project" class="off-glb" loading="lazy" src="https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg"></a>
|
|
94
94
|
</td>
|
|
95
95
|
</tr>
|
|
96
|
-
<tr>
|
|
96
|
+
<tr style="vertical-align: middle;">
|
|
97
97
|
<td>CI/CD</td>
|
|
98
98
|
<td>
|
|
99
|
-
<a href="https://github.com/erivlis/graphinate/actions/workflows/test.yml"><img alt="
|
|
100
|
-
<a href="https://github.com/erivlis/graphinate/actions/workflows/test.yml"><img alt="
|
|
99
|
+
<a href="https://github.com/erivlis/graphinate/actions/workflows/test.yml"><img alt="Test" src="https://github.com/erivlis/graphinate/actions/workflows/test.yml/badge.svg"></a>
|
|
100
|
+
<a href="https://github.com/erivlis/graphinate/actions/workflows/test-beta.yml"><img alt="Test (Beta)" src="https://github.com/erivlis/graphinate/actions/workflows/test-beta.yml/badge.svg"></a>
|
|
101
101
|
<a href="https://github.com/erivlis/graphinate/actions/workflows/publish.yml"><img alt="Publish" src="https://github.com/erivlis/graphinate/actions/workflows/publish.yml/badge.svg"></a>
|
|
102
102
|
<a href="https://github.com/erivlis/graphinate/actions/workflows/publish-docs.yaml"><img alt="Publish Docs" src="https://github.com/erivlis/graphinate/actions/workflows/publish-docs.yaml/badge.svg"></a>
|
|
103
103
|
</td>
|
|
104
104
|
</tr>
|
|
105
|
-
<tr>
|
|
105
|
+
<tr style="vertical-align: middle;">
|
|
106
106
|
<td>Scans</td>
|
|
107
107
|
<td>
|
|
108
108
|
<a href="https://codecov.io/gh/erivlis/graphinate"><img alt="Coverage" src="https://codecov.io/gh/erivlis/graphinate/graph/badge.svg?token=POODT8M9NV"/></a>
|
|
@@ -128,14 +128,14 @@ Description-Content-Type: text/markdown
|
|
|
128
128
|
|
|
129
129
|
### What is Graphinate?
|
|
130
130
|
|
|
131
|
-
**Graphinate** is a python library that
|
|
131
|
+
**Graphinate** is a python library that can be used to generate Graph Data Structures from Data Sources.
|
|
132
132
|
|
|
133
|
-
It can help create an efficient retrieval pipeline from a given data source, while also enabling the developer to
|
|
134
|
-
|
|
133
|
+
It can help create an efficient retrieval pipeline from a given data source, while also enabling the developer to map
|
|
134
|
+
data payloads and hierarchies to a Graph.
|
|
135
135
|
|
|
136
|
-
In addition, there are several modes of output to enable examination of the Graph
|
|
136
|
+
In addition, there are several modes of output to enable examination of the Graph and its content.
|
|
137
137
|
|
|
138
|
-
**Graphinate**
|
|
138
|
+
**Graphinate** uses and builds upon the excellent [**_NetworkX_**](https://networkx.org/).
|
|
139
139
|
|
|
140
140
|
### Links
|
|
141
141
|
|
|
@@ -163,25 +163,28 @@ pip install graphinate[server]
|
|
|
163
163
|
|
|
164
164
|
### Example
|
|
165
165
|
|
|
166
|
-
```python
|
|
166
|
+
```python title="Octagonal Graph"
|
|
167
167
|
import graphinate
|
|
168
168
|
|
|
169
169
|
N: int = 8
|
|
170
170
|
|
|
171
|
-
# Define GraphModel
|
|
172
|
-
graph_model = graphinate.model(name="Octagonal Graph")
|
|
171
|
+
# Define a GraphModel
|
|
172
|
+
graph_model: graphinate.GraphModel = graphinate.model(name="Octagonal Graph")
|
|
173
173
|
|
|
174
174
|
|
|
175
|
-
# Register edges supplier function
|
|
175
|
+
# Register in the Graph Model the edges' supplier function
|
|
176
176
|
@graph_model.edge()
|
|
177
177
|
def edge():
|
|
178
|
-
for i in range(N
|
|
178
|
+
for i in range(N):
|
|
179
179
|
yield {'source': i, 'target': i + 1}
|
|
180
|
-
yield {'source': N
|
|
180
|
+
yield {'source': N, 'target': 0}
|
|
181
|
+
|
|
181
182
|
|
|
183
|
+
# Choose builder and handler
|
|
184
|
+
builder, handler = graphinate.materializers.Materializers.NetworkX_with_edge_labels.value
|
|
182
185
|
|
|
183
186
|
# Materialize the GraphModel
|
|
184
|
-
graphinate.materialize(graph_model)
|
|
187
|
+
graphinate.materialize(graph_model, builder=builder, builder_output_handler=handler)
|
|
185
188
|
```
|
|
186
189
|
|
|
187
190
|
#### `graphinate.model` function
|
|
@@ -194,7 +197,6 @@ graphinate.materialize(graph_model)
|
|
|
194
197
|
|
|
195
198
|
> [!NOTE]
|
|
196
199
|
> This function can be used to easily generate an output from a `GraphModel` instance.
|
|
197
|
-
> By default, it will prompt the user to choose the output format, using a popup GUI dialog box.
|
|
198
200
|
|
|
199
201
|
## CLI
|
|
200
202
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<img alt="Libraries.io SourceRank" src="https://img.shields.io/librariesio/sourcerank/pypi/Graphinate.svg?logo=Libraries.io&label=SourceRank">
|
|
14
14
|
</td>
|
|
15
15
|
</tr>
|
|
16
|
-
<tr>
|
|
16
|
+
<tr style="vertical-align: middle;">
|
|
17
17
|
<td>Code</td>
|
|
18
18
|
<td>
|
|
19
19
|
<img alt="GitHub" src="https://img.shields.io/github/license/erivlis/graphinate">
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
<a href="https://github.com/erivlis/graphinate/graphs/contributors"><img alt="Contributors" src="https://img.shields.io/github/contributors/erivlis/graphinate.svg?&logo=git"></a>
|
|
23
23
|
</td>
|
|
24
24
|
</tr>
|
|
25
|
-
<tr>
|
|
25
|
+
<tr style="vertical-align: middle;">
|
|
26
26
|
<td>Tools</td>
|
|
27
27
|
<td>
|
|
28
28
|
<a href="https://www.jetbrains.com/pycharm/"><img alt="PyCharm" src="https://img.shields.io/badge/PyCharm-FCF84A.svg?logo=PyCharm&logoColor=black&labelColor=21D789&color=FCF84A"></a>
|
|
@@ -33,16 +33,16 @@
|
|
|
33
33
|
<a href="https://hatch.pypa.io"><img alt="Hatch project" class="off-glb" loading="lazy" src="https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg"></a>
|
|
34
34
|
</td>
|
|
35
35
|
</tr>
|
|
36
|
-
<tr>
|
|
36
|
+
<tr style="vertical-align: middle;">
|
|
37
37
|
<td>CI/CD</td>
|
|
38
38
|
<td>
|
|
39
|
-
<a href="https://github.com/erivlis/graphinate/actions/workflows/test.yml"><img alt="
|
|
40
|
-
<a href="https://github.com/erivlis/graphinate/actions/workflows/test.yml"><img alt="
|
|
39
|
+
<a href="https://github.com/erivlis/graphinate/actions/workflows/test.yml"><img alt="Test" src="https://github.com/erivlis/graphinate/actions/workflows/test.yml/badge.svg"></a>
|
|
40
|
+
<a href="https://github.com/erivlis/graphinate/actions/workflows/test-beta.yml"><img alt="Test (Beta)" src="https://github.com/erivlis/graphinate/actions/workflows/test-beta.yml/badge.svg"></a>
|
|
41
41
|
<a href="https://github.com/erivlis/graphinate/actions/workflows/publish.yml"><img alt="Publish" src="https://github.com/erivlis/graphinate/actions/workflows/publish.yml/badge.svg"></a>
|
|
42
42
|
<a href="https://github.com/erivlis/graphinate/actions/workflows/publish-docs.yaml"><img alt="Publish Docs" src="https://github.com/erivlis/graphinate/actions/workflows/publish-docs.yaml/badge.svg"></a>
|
|
43
43
|
</td>
|
|
44
44
|
</tr>
|
|
45
|
-
<tr>
|
|
45
|
+
<tr style="vertical-align: middle;">
|
|
46
46
|
<td>Scans</td>
|
|
47
47
|
<td>
|
|
48
48
|
<a href="https://codecov.io/gh/erivlis/graphinate"><img alt="Coverage" src="https://codecov.io/gh/erivlis/graphinate/graph/badge.svg?token=POODT8M9NV"/></a>
|
|
@@ -68,14 +68,14 @@
|
|
|
68
68
|
|
|
69
69
|
### What is Graphinate?
|
|
70
70
|
|
|
71
|
-
**Graphinate** is a python library that
|
|
71
|
+
**Graphinate** is a python library that can be used to generate Graph Data Structures from Data Sources.
|
|
72
72
|
|
|
73
|
-
It can help create an efficient retrieval pipeline from a given data source, while also enabling the developer to
|
|
74
|
-
|
|
73
|
+
It can help create an efficient retrieval pipeline from a given data source, while also enabling the developer to map
|
|
74
|
+
data payloads and hierarchies to a Graph.
|
|
75
75
|
|
|
76
|
-
In addition, there are several modes of output to enable examination of the Graph
|
|
76
|
+
In addition, there are several modes of output to enable examination of the Graph and its content.
|
|
77
77
|
|
|
78
|
-
**Graphinate**
|
|
78
|
+
**Graphinate** uses and builds upon the excellent [**_NetworkX_**](https://networkx.org/).
|
|
79
79
|
|
|
80
80
|
### Links
|
|
81
81
|
|
|
@@ -103,25 +103,28 @@ pip install graphinate[server]
|
|
|
103
103
|
|
|
104
104
|
### Example
|
|
105
105
|
|
|
106
|
-
```python
|
|
106
|
+
```python title="Octagonal Graph"
|
|
107
107
|
import graphinate
|
|
108
108
|
|
|
109
109
|
N: int = 8
|
|
110
110
|
|
|
111
|
-
# Define GraphModel
|
|
112
|
-
graph_model = graphinate.model(name="Octagonal Graph")
|
|
111
|
+
# Define a GraphModel
|
|
112
|
+
graph_model: graphinate.GraphModel = graphinate.model(name="Octagonal Graph")
|
|
113
113
|
|
|
114
114
|
|
|
115
|
-
# Register edges supplier function
|
|
115
|
+
# Register in the Graph Model the edges' supplier function
|
|
116
116
|
@graph_model.edge()
|
|
117
117
|
def edge():
|
|
118
|
-
for i in range(N
|
|
118
|
+
for i in range(N):
|
|
119
119
|
yield {'source': i, 'target': i + 1}
|
|
120
|
-
yield {'source': N
|
|
120
|
+
yield {'source': N, 'target': 0}
|
|
121
|
+
|
|
121
122
|
|
|
123
|
+
# Choose builder and handler
|
|
124
|
+
builder, handler = graphinate.materializers.Materializers.NetworkX_with_edge_labels.value
|
|
122
125
|
|
|
123
126
|
# Materialize the GraphModel
|
|
124
|
-
graphinate.materialize(graph_model)
|
|
127
|
+
graphinate.materialize(graph_model, builder=builder, builder_output_handler=handler)
|
|
125
128
|
```
|
|
126
129
|
|
|
127
130
|
#### `graphinate.model` function
|
|
@@ -134,7 +137,6 @@ graphinate.materialize(graph_model)
|
|
|
134
137
|
|
|
135
138
|
> [!NOTE]
|
|
136
139
|
> This function can be used to easily generate an output from a `GraphModel` instance.
|
|
137
|
-
> By default, it will prompt the user to choose the output format, using a popup GUI dialog box.
|
|
138
140
|
|
|
139
141
|
## CLI
|
|
140
142
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/* extra.css */
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
:root {
|
|
5
|
+
--md-primary-fg-color: #E3963E;
|
|
6
|
+
--md-primary-fg-color--dark: #FFBF00;
|
|
7
|
+
--md-primary-fg-color--light: #EBA937;
|
|
8
|
+
}
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
:root {
|
|
12
|
+
--md-primary-fg-color: rebeccapurple;
|
|
13
|
+
--md-primary-fg-color--dark: midnight;
|
|
14
|
+
--md-primary-fg-color--light: silver;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
/* Title levels */
|
|
19
|
+
h1 {
|
|
20
|
+
color: royalblue;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
h2 {
|
|
24
|
+
color: slateblue;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
h3 {
|
|
28
|
+
color: mediumslateblue;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
h4, h5, h6 {
|
|
32
|
+
color: steelblue;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* Blockquotes */
|
|
36
|
+
/*blockquote {*/
|
|
37
|
+
/* border-left: 4px solid #bdc3c7; !* Light gray *!*/
|
|
38
|
+
/* color: #7f8c8d; !* Gray *!*/
|
|
39
|
+
/* !*background-color: #ecf0f1; !* Very light gray *!*!*/
|
|
40
|
+
/* padding: 10px;*/
|
|
41
|
+
/*}*/
|
|
42
|
+
|
|
43
|
+
/* Code blocks */
|
|
44
|
+
/*pre, code {*/
|
|
45
|
+
/* background-color: #f8f9fa; !* Very light gray *!*/
|
|
46
|
+
/* color: #2c3e50; !* Dark blue *!*/
|
|
47
|
+
/*}*/
|
|
48
|
+
|
|
49
|
+
/* Tables */
|
|
50
|
+
/*table {*/
|
|
51
|
+
/* border-collapse: collapse;*/
|
|
52
|
+
/* width: 100%;*/
|
|
53
|
+
/*}*/
|
|
54
|
+
|
|
55
|
+
/*th, td {*/
|
|
56
|
+
/* border: 1px solid #bdc3c7; !* Light gray *!*/
|
|
57
|
+
/* padding: 8px;*/
|
|
58
|
+
/* text-align: left;*/
|
|
59
|
+
/*}*/
|
|
60
|
+
|
|
61
|
+
/*th {*/
|
|
62
|
+
/* background-color: #ecf0f1; !* Very light gray *!*/
|
|
63
|
+
/* color: #2c3e50; !* Dark blue *!*/
|
|
64
|
+
/*}*/
|
|
@@ -3,42 +3,35 @@
|
|
|
3
3
|
## Repositories
|
|
4
4
|
|
|
5
5
|
=== "Repositories"
|
|
6
|
-
|
|
7
6
|
``` python title="examples/github/repositories.py" linenums="1"
|
|
8
7
|
--8<-- "examples/github/repositories.py"
|
|
9
8
|
```
|
|
10
9
|
|
|
11
10
|
=== "Dependencies"
|
|
12
|
-
|
|
13
11
|
``` text title="examples/github/requirements.txt" linenums="1"
|
|
14
12
|
--8<-- "examples/github/requirements.txt"
|
|
15
13
|
```
|
|
16
14
|
|
|
17
|
-
|
|
18
15
|
``` python title="examples/github/_client.py" linenums="1"
|
|
19
16
|
--8<-- "examples/github/_client.py"
|
|
20
17
|
```
|
|
21
18
|
|
|
22
19
|
=== "Plot"
|
|
23
|
-
|
|
24
20
|

|
|
25
21
|
|
|
26
22
|
|
|
27
23
|
## Followers
|
|
28
24
|
|
|
29
25
|
=== "Followers"
|
|
30
|
-
|
|
31
26
|
``` python title="examples/github/followers.py" linenums="1"
|
|
32
27
|
--8<-- "examples/github/followers.py"
|
|
33
28
|
```
|
|
34
29
|
|
|
35
30
|
=== "Dependencies"
|
|
36
|
-
|
|
37
31
|
``` text title="examples/github/requirements.txt" linenums="1"
|
|
38
32
|
--8<-- "examples/github/requirements.txt"
|
|
39
33
|
```
|
|
40
34
|
|
|
41
|
-
|
|
42
35
|
``` python title="examples/github/_client.py" linenums="1"
|
|
43
36
|
--8<-- "examples/github/_client.py"
|
|
44
37
|
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Math
|
|
2
|
+
|
|
3
|
+
## Graph Atlas
|
|
4
|
+
|
|
5
|
+
=== "Graph Atlas"
|
|
6
|
+
``` python title="examples/math/graph_atlas.py" linenums="1"
|
|
7
|
+
--8<-- "examples/math/graph_atlas.py"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
=== "Dependencies"
|
|
11
|
+
``` text title="examples/math/requirements.txt" linenums="1"
|
|
12
|
+
--8<-- "examples/math/requirements.txt"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
``` python title="examples/math/graph.py" linenums="1"
|
|
16
|
+
--8<-- "examples/math/graphs.py"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Polygonal Graph
|
|
20
|
+
|
|
21
|
+
=== "Polygonal Graph"
|
|
22
|
+
``` python title="examples/math/polygonal_graph.py" linenums="1"
|
|
23
|
+
--8<-- "examples/math/polygonal_graph.py"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
=== "Dependencies"
|
|
27
|
+
``` text title="examples/math/requirements.txt" linenums="1"
|
|
28
|
+
--8<-- "examples/math/requirements.txt"
|
|
29
|
+
```
|
|
@@ -2,55 +2,61 @@
|
|
|
2
2
|
|
|
3
3
|
<table style="border-width: 0;">
|
|
4
4
|
<tr style="vertical-align: middle; border-width: 0;">
|
|
5
|
-
<td rowspan="
|
|
5
|
+
<td rowspan="5"><img height="240" src="https://github.com/erivlis/graphinate/assets/9897520/dae41f9f-69e5-4eb5-a488-87ce7f51fa32" alt="Graphinate. Data to Graphs."></td>
|
|
6
6
|
<td>Package</td>
|
|
7
7
|
<td>
|
|
8
|
-
<img alt="PyPI - version" src="https://img.shields.io/pypi/v/graphinate">
|
|
9
|
-
<img alt="PyPI - Status" src="https://img.shields.io/pypi/status/graphinate">
|
|
10
|
-
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/graphinate">
|
|
11
|
-
<img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dd/graphinate">
|
|
12
|
-
<
|
|
8
|
+
<img alt="PyPI - version" src="https://img.shields.io/pypi/v/graphinate.svg?logo=pypi&logoColor=lightblue">
|
|
9
|
+
<img alt="PyPI - Status" src="https://img.shields.io/pypi/status/graphinate.svg?logo=pypi&logoColor=lightblue">
|
|
10
|
+
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/graphinate.svg?logo=python&label=Python&logoColor=lightblue">
|
|
11
|
+
<img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dd/graphinate.svg?logo=pypi&logoColor=lightblue">
|
|
12
|
+
<img alt="Libraries.io SourceRank" src="https://img.shields.io/librariesio/sourcerank/pypi/Graphinate.svg?logo=Libraries.io&label=SourceRank">
|
|
13
|
+
</td>
|
|
14
|
+
</tr>
|
|
15
|
+
<tr style="vertical-align: middle;">
|
|
16
|
+
<td>Code</td>
|
|
17
|
+
<td>
|
|
13
18
|
<img alt="GitHub" src="https://img.shields.io/github/license/erivlis/graphinate">
|
|
14
|
-
<img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/erivlis/graphinate">
|
|
15
|
-
<img alt="GitHub last commit (by committer)" src="https://img.shields.io/github/last-commit/erivlis/graphinate">
|
|
16
|
-
<a href="https://github.com/erivlis/graphinate/graphs/contributors"><img alt="Contributors" src="https://img.shields.io/github/contributors/erivlis/graphinate.svg"></a>
|
|
17
|
-
<img alt="GitHub Watchers" src="https://img.shields.io/github/watchers/erivlis/graphinate.svg">
|
|
19
|
+
<img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/erivlis/graphinate.svg?label=Size&logo=git">
|
|
20
|
+
<img alt="GitHub last commit (by committer)" src="https://img.shields.io/github/last-commit/erivlis/graphinate.svg?&logo=git">
|
|
21
|
+
<a href="https://github.com/erivlis/graphinate/graphs/contributors"><img alt="Contributors" src="https://img.shields.io/github/contributors/erivlis/graphinate.svg?&logo=git"></a>
|
|
18
22
|
</td>
|
|
19
23
|
</tr>
|
|
20
|
-
<tr
|
|
24
|
+
<tr style="vertical-align: middle;">
|
|
21
25
|
<td>Tools</td>
|
|
22
26
|
<td>
|
|
23
27
|
<a href="https://www.jetbrains.com/pycharm/"><img alt="PyCharm" src="https://img.shields.io/badge/PyCharm-FCF84A.svg?logo=PyCharm&logoColor=black&labelColor=21D789&color=FCF84A"></a>
|
|
24
|
-
<a href="https://github.com/astral-sh/
|
|
25
|
-
<a href="https://github.com/astral-sh/
|
|
26
|
-
<a href="https://github.com/tox-dev/pipdeptree"><img src="https://img.shields.io/badge/pipdeptree-526CFE.svg?labelColor=gray&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAADFElEQVR4nFxTW2tcVRRe39773E/mliZjwKRmhBaKt4BWRKmGgihCH3xUKNWC/Q/ii76IP8AHpSIiRfqmD5YKCinalhgiCMZLSVtMM0mTdDLTuZyZc9l7yTlp7WXBgXPW+fa31rfWtxU9FLMN79Crr028e+iJsZfb7fJMp23xRlOvbTR3L/y5cuOL3Vbv7/vxuPviecI/eWr6k/mj4+8AkM11y+zs2MKwMJvNgIgYINZX/rlx+tIvf72fZXr4P0EQyOCjjw98P9vwn8+/+z3Bq6sek7AJkNhsOjQcyjvFmHd2upd+PP/zsSxNI5mnPvjw8U9fPFJ9XVkgNuDVayEbcgVEfgikNfFg4JAmh1LyyfGq06QqE9vN6+fEs4fHnjv25vjbAOA4AsL2MVZ1hRcI4QXIH7ilMqQXkiYXRBJRbFNQnTsRlqfmxFvH66ccFyAQMxP3I5cqNZBSxIWcKORMO9g3yeSHzFkGbnVCIkDUZ+beEy+8VJ4XguC6TMPYokwrCAHUJsBxYptoFBYSMi0oLIlcAkuFYhal8Zl5VanZU0zErgfurufMFjEkWZ7iRFY4SlgYfW9bUIJKFQNjiNPYf1QZOZn/hTaStPQKTI4eDCxSjsL4I6BeJzOjgcnT0HqPqwBJCdHZjW/miWjkkG3hzqKIe5FVlM3llGuWqOxTDMBkWlJ/6PB2p0Sb21gXixdvLeTtDGOHLFvQHpkiYyTuNU5kuxJercTdpEK3Bz4yLdFrXVsQ33x1/bModjhvyrKKVXB/YD9gb8PgKAlolAZipmFTOIYcxq21Xz8XS5dbi+e+2zqbA3MjxYninH3PpkyZljwYjZE2FoxBIWm6YVHaW/k66qwtF05curz509OHHzvqBqWp232fE+2AoCjOXNMfhcRcjAxxoijNFNpbG0vL588cNzpLC4I00cnCD1fPBuVqffbA5DMGNjR5MOSBpC+UYxGE5G5PmNXff/vy4rdnTmRJHD1wG+9G42D9qVfeePLk/oONI8qv7+/2fbq11f53ZfnqhStLi6d3b67/cT/+vwAAAP//Xo5dwOtdLi4AAAAASUVORK5CYII="></a>
|
|
28
|
+
<a href="https://github.com/astral-sh/uv"><img alt="uv" src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json" style="max-width:100%;"></a>
|
|
29
|
+
<a href="https://github.com/astral-sh/ruff"><img alt="ruff" src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" style="max-width:100%;"></a>
|
|
30
|
+
<a href="https://github.com/tox-dev/pipdeptree"><img alt="pipdeptree" src="https://img.shields.io/badge/pipdeptree-526CFE.svg?labelColor=gray&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAADFElEQVR4nFxTW2tcVRRe39773E/mliZjwKRmhBaKt4BWRKmGgihCH3xUKNWC/Q/ii76IP8AHpSIiRfqmD5YKCinalhgiCMZLSVtMM0mTdDLTuZyZc9l7yTlp7WXBgXPW+fa31rfWtxU9FLMN79Crr028e+iJsZfb7fJMp23xRlOvbTR3L/y5cuOL3Vbv7/vxuPviecI/eWr6k/mj4+8AkM11y+zs2MKwMJvNgIgYINZX/rlx+tIvf72fZXr4P0EQyOCjjw98P9vwn8+/+z3Bq6sek7AJkNhsOjQcyjvFmHd2upd+PP/zsSxNI5mnPvjw8U9fPFJ9XVkgNuDVayEbcgVEfgikNfFg4JAmh1LyyfGq06QqE9vN6+fEs4fHnjv25vjbAOA4AsL2MVZ1hRcI4QXIH7ilMqQXkiYXRBJRbFNQnTsRlqfmxFvH66ccFyAQMxP3I5cqNZBSxIWcKORMO9g3yeSHzFkGbnVCIkDUZ+beEy+8VJ4XguC6TMPYokwrCAHUJsBxYptoFBYSMi0oLIlcAkuFYhal8Zl5VanZU0zErgfurufMFjEkWZ7iRFY4SlgYfW9bUIJKFQNjiNPYf1QZOZn/hTaStPQKTI4eDCxSjsL4I6BeJzOjgcnT0HqPqwBJCdHZjW/miWjkkG3hzqKIe5FVlM3llGuWqOxTDMBkWlJ/6PB2p0Sb21gXixdvLeTtDGOHLFvQHpkiYyTuNU5kuxJercTdpEK3Bz4yLdFrXVsQ33x1/bModjhvyrKKVXB/YD9gb8PgKAlolAZipmFTOIYcxq21Xz8XS5dbi+e+2zqbA3MjxYninH3PpkyZljwYjZE2FoxBIWm6YVHaW/k66qwtF05curz509OHHzvqBqWp232fE+2AoCjOXNMfhcRcjAxxoijNFNpbG0vL588cNzpLC4I00cnCD1fPBuVqffbA5DMGNjR5MOSBpC+UYxGE5G5PmNXff/vy4rdnTmRJHD1wG+9G42D9qVfeePLk/oONI8qv7+/2fbq11f53ZfnqhStLi6d3b67/cT/+vwAAAP//Xo5dwOtdLi4AAAAASUVORK5CYII="></a>
|
|
31
|
+
<a href="https://squidfunk.github.io/mkdocs-material/"><img alt="mkdocs-material" src="https://img.shields.io/badge/Material_for_MkDocs-526CFE?&logo=MaterialForMkDocs&logoColor=white&labelColor=grey"></a>
|
|
32
|
+
<a href="https://hatch.pypa.io"><img alt="Hatch project" class="off-glb" loading="lazy" src="https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg"></a>
|
|
27
33
|
</td>
|
|
28
34
|
</tr>
|
|
29
|
-
<tr style="vertical-align: middle;
|
|
35
|
+
<tr style="vertical-align: middle;">
|
|
30
36
|
<td>CI/CD</td>
|
|
31
37
|
<td>
|
|
32
38
|
<a href="https://github.com/erivlis/graphinate/actions/workflows/test.yml"><img alt="Tests" src="https://github.com/erivlis/graphinate/actions/workflows/test.yml/badge.svg?branch=master"></a>
|
|
39
|
+
<a href="https://github.com/erivlis/graphinate/actions/workflows/test.yml"><img alt="Tests" src="https://github.com/erivlis/graphinate/actions/workflows/test-beta.yml/badge.svg?branch=master"></a>
|
|
33
40
|
<a href="https://github.com/erivlis/graphinate/actions/workflows/publish.yml"><img alt="Publish" src="https://github.com/erivlis/graphinate/actions/workflows/publish.yml/badge.svg"></a>
|
|
34
41
|
<a href="https://github.com/erivlis/graphinate/actions/workflows/publish-docs.yaml"><img alt="Publish Docs" src="https://github.com/erivlis/graphinate/actions/workflows/publish-docs.yaml/badge.svg"></a>
|
|
35
42
|
</td>
|
|
36
43
|
</tr>
|
|
37
|
-
<tr style="vertical-align: middle;
|
|
44
|
+
<tr style="vertical-align: middle;">
|
|
38
45
|
<td>Scans</td>
|
|
39
46
|
<td>
|
|
40
47
|
<a href="https://codecov.io/gh/erivlis/graphinate"><img alt="Coverage" src="https://codecov.io/gh/erivlis/graphinate/graph/badge.svg?token=POODT8M9NV"/></a>
|
|
41
|
-
<br>
|
|
42
48
|
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Quality Gate Status" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=alert_status"></a>
|
|
43
49
|
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Security Rating" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=security_rating"></a>
|
|
44
50
|
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Maintainability Rating" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=sqale_rating"></a>
|
|
45
51
|
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Reliability Rating" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=reliability_rating"></a>
|
|
46
|
-
<br>
|
|
47
52
|
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Lines of Code" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=ncloc"></a>
|
|
48
53
|
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Vulnerabilities" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=vulnerabilities"></a>
|
|
49
54
|
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Bugs" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=bugs"></a>
|
|
50
|
-
<br>
|
|
51
55
|
<a href="https://app.codacy.com/gh/erivlis/graphinate/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade"><img alt="Codacy Badge" src="https://app.codacy.com/project/badge/Grade/54b33c3f7313448f9471d01e2a06f037"></a>
|
|
52
56
|
<a href="https://app.codacy.com/gh/erivlis/graphinate/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage"><img alt="Codacy Coverage" src="https://app.codacy.com/project/badge/Coverage/54b33c3f7313448f9471d01e2a06f037"/></a>
|
|
53
57
|
<a href="https://scrutinizer-ci.com/g/erivlis/graphinate"><img alt="Scrutinizer" src="https://scrutinizer-ci.com/g/erivlis/graphinate/badges/quality-score.png?b=main"></a>
|
|
58
|
+
<a href="https://www.codefactor.io/repository/github/erivlis/graphinate"><img src="https://www.codefactor.io/repository/github/erivlis/graphinate/badge" alt="CodeFactor" /></a>
|
|
59
|
+
<a href="https://snyk.io/test/github/erivlis/graphinate"><img alt="Snyk" src="https://snyk.io/test/github/erivlis/Graphinate/badge.svg"></a>
|
|
54
60
|
</td>
|
|
55
61
|
</tr>
|
|
56
62
|
</table>
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
### What is Graphinate?
|
|
6
6
|
|
|
7
|
-
**Graphinate** is a python library that
|
|
7
|
+
**Graphinate** is a python library that can be used to generate Graph Data Structures from Data Sources.
|
|
8
8
|
|
|
9
9
|
It can help create an efficient retrieval pipeline from a given data source, while also enabling the developer to map
|
|
10
10
|
data payloads and hierarchies to a Graph.
|
|
11
11
|
|
|
12
12
|
In addition, there are several modes of output to enable examination of the Graph and its content.
|
|
13
13
|
|
|
14
|
-
**Graphinate**
|
|
14
|
+
**Graphinate** uses and is built upon the excellent [**_NetworkX_**](https://networkx.org/).
|
|
15
15
|
|
|
16
16
|
### What is a Graph?
|
|
17
17
|
|
|
@@ -35,10 +35,9 @@ formally.”
|
|
|
35
35
|
|
|
36
36
|
### A Graph as a Data Structure
|
|
37
37
|
|
|
38
|
-
A Graph
|
|
39
|
-
It is perhaps the simplest data structure, that is a bit more than just a
|
|
40
|
-
|
|
41
|
-
As such, it can be used to model all data sources that have structure.
|
|
38
|
+
A Graph can be a useful data structure.
|
|
39
|
+
It is, perhaps, the simplest data structure, that is a "bit more" than just a simple collection of "things".
|
|
40
|
+
As such, it can be used to model any data source that has structure.
|
|
42
41
|
|
|
43
42
|
### Graph Elements
|
|
44
43
|
|
|
@@ -47,14 +46,14 @@ A Graph consists of two types of elements:
|
|
|
47
46
|
#### Nodes
|
|
48
47
|
|
|
49
48
|
A Graph Node can be any Python Hashable object. Usually it will be a primitive type such as an integer or a string,
|
|
50
|
-
in particular when the node in itself has no
|
|
51
|
-
One can also add attributes to the node to describe additional information.
|
|
52
|
-
|
|
53
|
-
or stylistic information (e.g., color, size, shape, label etc.).
|
|
49
|
+
in particular when the node in itself has no specific meaning.
|
|
50
|
+
One can also add attributes to the node to describe additional information. This information can be anything.
|
|
51
|
+
Often attributes are used to store scalar dimensions (e.g., weight, area, width, age, etc.)
|
|
52
|
+
or stylistic information (e.g., color, size, shape, label, etc.).
|
|
54
53
|
|
|
55
54
|
#### Edges
|
|
56
55
|
|
|
57
|
-
A Graph Edge is a
|
|
56
|
+
A Graph Edge is a pair of two node values. It can also have additional attributes in the same vain as a Graph Node.
|
|
58
57
|
|
|
59
58
|
### Defining a Graph
|
|
60
59
|
|
|
@@ -62,13 +61,14 @@ One can define a Graph in two general ways:
|
|
|
62
61
|
|
|
63
62
|
#### Edge First
|
|
64
63
|
|
|
65
|
-
The most
|
|
66
|
-
|
|
67
|
-
definition to convey additional characteristics.
|
|
64
|
+
The most straightforward way to generate a Graph is to supply a list of edges. The simplest definition of an edge is a
|
|
65
|
+
pair of two values. Each value represents a node (or vertex) in the graph. Attributes may be added to the edge
|
|
66
|
+
definition to convey additional characteristics, such as weight, direction, etc.
|
|
68
67
|
|
|
69
68
|
In this case, one defines the **edges explicitly** and the **nodes implicitly**.
|
|
70
69
|
|
|
71
|
-
Such a graph is focused more on the _relationships_ between nodes or the _structure_ of the graph
|
|
70
|
+
Such a graph is focused more on the _relationships_ between nodes, or the _structure_ of the graph,
|
|
71
|
+
than on the nodes themselves.
|
|
72
72
|
|
|
73
73
|
#### Node First
|
|
74
74
|
|
|
@@ -78,33 +78,34 @@ relationships between the nodes.
|
|
|
78
78
|
|
|
79
79
|
In this case, **both nodes and the edges** are defined **explicitly**.
|
|
80
80
|
|
|
81
|
-
Such a graph
|
|
81
|
+
Such a graph may have a focus primarily on the nodes, and then only if needed on the relationship between them.
|
|
82
82
|
|
|
83
|
-
### Graphinate
|
|
83
|
+
### Graphinate
|
|
84
84
|
|
|
85
|
-
"Hydrate" a Graph from a Data Source.
|
|
86
|
-
Using Graphinate enables generating graphs from data sources.
|
|
85
|
+
Graphinate helps to generate graphs from data sources ("Hydrate" a Graph from a Data Source.)
|
|
87
86
|
It supports both *Edge First* and *Node First* creation scenarios.
|
|
88
87
|
|
|
89
|
-
This is achieved following
|
|
88
|
+
This is achieved the following way:
|
|
90
89
|
|
|
91
|
-
#### Source
|
|
90
|
+
#### Source
|
|
92
91
|
|
|
93
|
-
It is required to represent the
|
|
92
|
+
It is required to represent the data sources, as an Iterable of items that will be transformed, to graph edges
|
|
94
93
|
and/or nodes.
|
|
95
|
-
It is recommended to use Generators as the items Iterables.
|
|
94
|
+
It is recommended to use Generators as the items Iterables. This way, the data source can be lazy-loaded.
|
|
95
|
+
The Iterables or Generators can be anything, from a simple list of dictionaries to a complex database query.
|
|
96
96
|
|
|
97
97
|
#### Model
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
to
|
|
99
|
+
Graphinate introduces the concept of a Graph Model.
|
|
100
|
+
A Graph Model is a set of rules, that define how to transform the data source item into Graph elements (i.e. nodes and
|
|
101
|
+
edges). The GraphModel registers the sources using node and edge decorators.
|
|
101
102
|
|
|
102
103
|
#### Build
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
|
|
105
|
+
A Graph Model can be used to generate an actual instance of a Graph that contains the transformed source data.
|
|
106
|
+
Graphinate provides several GraphBuilder classes, that can be used to build the Graph from the Graph Model.
|
|
106
107
|
|
|
107
108
|
#### Materialize
|
|
108
109
|
|
|
109
|
-
Finally, we can use the builders to Materialize the graph in several ways that support different use cases
|
|
110
|
-
(i.e., visualizing, querying, reporting, etc.)
|
|
110
|
+
Finally, we can use the builders to Materialize the graph in several ways that support different use cases
|
|
111
|
+
(i.e., visualizing, querying, reporting, etc.).
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# Quick Start
|
|
2
2
|
|
|
3
3
|
**Graphinate** is designed to be used as a library first and foremost.
|
|
4
|
-
In addition, it has several interfaces for ease of use: CLI and a GraphQL API (using [**_Strawberry GraphQL_
|
|
4
|
+
In addition, it has several interfaces for ease of use: CLI and a GraphQL API (using [**_Strawberry GraphQL_
|
|
5
|
+
**](https://strawberry.rocks/)).
|
|
5
6
|
|
|
6
7
|
## Install
|
|
7
8
|
|
|
@@ -27,7 +28,7 @@ import graphinate
|
|
|
27
28
|
N: int = 8
|
|
28
29
|
|
|
29
30
|
# Define a GraphModel
|
|
30
|
-
graph_model = graphinate.model(name="Octagonal Graph")
|
|
31
|
+
graph_model: graphinate.GraphModel = graphinate.model(name="Octagonal Graph")
|
|
31
32
|
|
|
32
33
|
|
|
33
34
|
# Register in the Graph Model the edges' supplier function
|
|
@@ -38,6 +39,9 @@ def edge():
|
|
|
38
39
|
yield {'source': N, 'target': 0}
|
|
39
40
|
|
|
40
41
|
|
|
42
|
+
# Choose builder and handler
|
|
43
|
+
builder, handler = graphinate.materializers.Materializers.NetworkX_with_edge_labels.value
|
|
44
|
+
|
|
41
45
|
# Materialize the GraphModel
|
|
42
|
-
graphinate.materialize(graph_model)
|
|
46
|
+
graphinate.materialize(graph_model, builder=builder, builder_output_handler=handler)
|
|
43
47
|
```
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import graphinate
|
|
2
1
|
from pipdeptree._cli import get_options
|
|
3
2
|
from pipdeptree._discovery import get_installed_distributions
|
|
4
3
|
from pipdeptree._models import PackageDAG
|
|
5
|
-
|
|
4
|
+
|
|
5
|
+
import graphinate
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
def dependency_graph_model():
|
|
@@ -14,7 +14,6 @@ def dependency_graph_model():
|
|
|
14
14
|
"""
|
|
15
15
|
|
|
16
16
|
options = get_options(args=None)
|
|
17
|
-
handle_non_host_target(options)
|
|
18
17
|
|
|
19
18
|
pkgs = get_installed_distributions(local_only=options.local_only, user_only=options.user_only)
|
|
20
19
|
tree = PackageDAG.from_pkgs(pkgs)
|
|
@@ -35,5 +34,5 @@ if __name__ == '__main__':
|
|
|
35
34
|
graphinate.materialize(
|
|
36
35
|
dependency_model,
|
|
37
36
|
builder=graphinate.builders.GraphQLBuilder,
|
|
38
|
-
|
|
37
|
+
builder_output_handler=graphinate.graphql
|
|
39
38
|
)
|