Graphinate 0.8.4__tar.gz → 0.8.5__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.8.4 → graphinate-0.8.5}/PKG-INFO +2 -2
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/github/_client.py +4 -4
- {graphinate-0.8.4 → graphinate-0.8.5}/pyproject.toml +2 -2
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/builders.py +21 -5
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/color.py +34 -7
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/modeling.py +5 -5
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/renderers/graphql.py +1 -1
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/renderers/matplotlib.py +1 -1
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/server/web/viewer/index.html +21 -18
- {graphinate-0.8.4 → graphinate-0.8.5}/.coveragerc +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/.github/dependabot.yml +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/.github/workflows/codeql.yml +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/.github/workflows/publish-docs.yaml +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/.github/workflows/publish.yml +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/.github/workflows/test-beta.yml +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/.github/workflows/test.yml +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/.gitignore +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/.sonarcloud.properties +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/LICENSE +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/README.md +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/docs/.dates_cache.json +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/docs/acknowledge.md +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/docs/assets/badge/v0.json +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/docs/assets/images/logo-128.png +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/docs/assets/images/network_graph.png +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/docs/assets/stylesheets/extra.css +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/docs/examples/code.md +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/docs/examples/github.md +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/docs/examples/math.md +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/docs/examples/social.md +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/docs/examples/system.md +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/docs/examples/web.md +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/docs/gen_ref_pages.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/docs/index.md +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/docs/intro.md +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/docs/start.md +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/docs/tutorial.md +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/docs/usage/cli.md +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/docs/usage/lib.md +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/code/git_commits.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/code/python_ast.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/code/python_dependencies.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/code/requirements.txt +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/code/tokens.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/github/commits_visibilty_graph.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/github/followers.graphql +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/github/followers.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/github/graphql.config.yml +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/github/repositories.graphql +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/github/repositories.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/github/requirements.txt +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/math/__init__.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/math/_test_materializers.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/math/graph_atlas.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/math/graphs.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/math/gui.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/math/materializers.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/math/polygonal_graph.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/math/requirements.txt +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/social/cache/13/dd/73ce25face7beb30b69b64feeb77.val +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/social/cache/21/9e/00846f323987ba16cfbe0127d8eb.val +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/social/cache/70/b6/2aefb0269adce7fedf877fa0d267.val +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/social/cache/87/f5/ec1739bc369e84c3fcb302bf532a.val +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/social/cache/ba/fe/3aca7b2c38abff60e7ce5eb486a8.val +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/social/cache/c7/9e/ce82b0288020b7152779df09bd73.val +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/social/cache/cache.db +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/social/cache/d2/53/3b88f2fc162561cfdbbe9abc352a.val +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/social/cache/e2/d5/5d079f200eabf9b625b0473f6fbe.val +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/social/gui.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/social/music_artists.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/social/requirements.txt +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/system/.ignore +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/system/files.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/system/processes.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/system/requirements.txt +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/web/html_dom.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/web/page_links.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/examples/web/requirements.txt +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/mkdocs.yml +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/playground/ethernet/traceroute.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/playground/genric_graph.graphql +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/playground/graphql.config.yml +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/playground/house_of_graphs.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/playground/science/caffeine.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/playground/social/albums.json +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/playground/social/musicisians.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/playground/text/nlp_graph.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/playground/text/requirements.txt +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/playground/time_series/requirements.txt +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/playground/time_series/visibility_graph.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/sonar-project.properties +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/__init__.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/__main__.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/cli.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/constants.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/converters.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/renderers/__init__.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/server/__init__.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/server/starlette/__init__.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/server/starlette/views.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/server/web/__init__.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/server/web/elements/__init__.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/server/web/elements/index.html +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/server/web/graphiql/__init__.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/server/web/graphiql/index.html +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/server/web/rapidoc/__init__.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/server/web/rapidoc/index.html +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/server/web/static/images/logo-128.png +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/server/web/static/images/logo.svg +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/server/web/static/images/network_graph.png +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/server/web/viewer/__init__.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/server/web/voyager/__init__.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/server/web/voyager/index.html +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/tools.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/typing.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/tests/conftest.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/tests/graphinate/test_builders.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/tests/graphinate/test_cli.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/tests/graphinate/test_color.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/tests/graphinate/test_converters.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/tests/graphinate/test_modeling.py +0 -0
- {graphinate-0.8.4 → graphinate-0.8.5}/tests/graphinate/test_server.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: Graphinate
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.5
|
|
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
|
|
@@ -33,7 +33,7 @@ Requires-Dist: loguru
|
|
|
33
33
|
Requires-Dist: mappingtools
|
|
34
34
|
Requires-Dist: matplotlib
|
|
35
35
|
Requires-Dist: networkx
|
|
36
|
-
Requires-Dist: networkx-mermaid
|
|
36
|
+
Requires-Dist: networkx-mermaid
|
|
37
37
|
Requires-Dist: strawberry-graphql[asgi,opentelemetry]
|
|
38
38
|
Provides-Extra: plot
|
|
39
39
|
Requires-Dist: scipy; extra == 'plot'
|
|
@@ -30,7 +30,7 @@ def github_user(user_id: Optional[str] = None) -> Union[NamedUser, Authenticated
|
|
|
30
30
|
"""
|
|
31
31
|
Get the GitHub user object for the specified user ID or the authenticated user.
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Args:
|
|
34
34
|
user_id (Optional[str]): The ID of the user to retrieve.
|
|
35
35
|
If not provided, retrieve the authenticated user.
|
|
36
36
|
|
|
@@ -51,7 +51,7 @@ def github_repositories(
|
|
|
51
51
|
"""
|
|
52
52
|
Get the GitHub repositories for the specified user ID or the authenticated user.
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
Args:
|
|
55
55
|
user_id (Optional[str]): The ID of the user whose repositories to retrieve.
|
|
56
56
|
If not provided, retrieve repositories of the authenticated user.
|
|
57
57
|
repo_id (Optional[str]): The ID of the repository to retrieve.
|
|
@@ -78,7 +78,7 @@ def github_commits(
|
|
|
78
78
|
"""
|
|
79
79
|
Retrieve commits from a GitHub repository.
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
Args:
|
|
82
82
|
repo (Repository): The GitHub repository object from which to retrieve commits.
|
|
83
83
|
commit_id (str, optional): The ID of the commit to retrieve.
|
|
84
84
|
If provided, only that commit will be returned.
|
|
@@ -115,7 +115,7 @@ def github_files(
|
|
|
115
115
|
"""
|
|
116
116
|
Retrieves Files from a GitHub Commit
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
Args:
|
|
119
119
|
commit (Commit): A Commit object from the GitHub API.
|
|
120
120
|
file_id (Optional[str]): An optional parameter specifying the filename to filter the files. Default is None.
|
|
121
121
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "Graphinate"
|
|
3
|
-
version = "0.8.
|
|
3
|
+
version = "0.8.5"
|
|
4
4
|
description = "Graphinate. Data to Graphs."
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "Eran Rivlis", email = "eran@rivlis.info" },
|
|
@@ -34,7 +34,7 @@ dependencies = [
|
|
|
34
34
|
"mappingtools",
|
|
35
35
|
"matplotlib",
|
|
36
36
|
"networkx",
|
|
37
|
-
"networkx-mermaid
|
|
37
|
+
"networkx-mermaid",
|
|
38
38
|
"strawberry-graphql[asgi,opentelemetry]",
|
|
39
39
|
]
|
|
40
40
|
|
|
@@ -15,9 +15,10 @@ from collections.abc import Callable, Hashable, Mapping
|
|
|
15
15
|
from datetime import datetime
|
|
16
16
|
from enum import Enum
|
|
17
17
|
from types import MappingProxyType
|
|
18
|
-
from typing import Any, Optional, Union
|
|
18
|
+
from typing import Any, Literal, Optional, Union
|
|
19
19
|
|
|
20
20
|
import inflect
|
|
21
|
+
import mappingtools
|
|
21
22
|
import networkx as nx
|
|
22
23
|
import networkx_mermaid as nxm
|
|
23
24
|
import strawberry
|
|
@@ -299,17 +300,27 @@ class D3Builder(NetworkxBuilder):
|
|
|
299
300
|
def __init__(self, model: GraphModel, graph_type: GraphType = GraphType.Graph):
|
|
300
301
|
super().__init__(model, graph_type)
|
|
301
302
|
|
|
302
|
-
def build(self, **kwargs) -> GraphRepresentation:
|
|
303
|
+
def build(self, values_format: Literal['json', 'python'] = 'python', **kwargs) -> GraphRepresentation:
|
|
303
304
|
"""
|
|
304
305
|
|
|
305
306
|
Args:
|
|
307
|
+
values_format: Literal['python', 'json'] - The format of the values
|
|
306
308
|
**kwargs:
|
|
307
309
|
|
|
308
310
|
Returns:
|
|
309
311
|
D3 Graph
|
|
310
312
|
"""
|
|
311
313
|
super().build(**kwargs)
|
|
312
|
-
|
|
314
|
+
color.convert_colors_to_hex(self._graph)
|
|
315
|
+
d3graph = self.from_networkx(self._graph)
|
|
316
|
+
|
|
317
|
+
match values_format:
|
|
318
|
+
case 'json':
|
|
319
|
+
return mappingtools.transformers.strictify(d3graph, value_converter=json.dumps)
|
|
320
|
+
case 'python':
|
|
321
|
+
return d3graph
|
|
322
|
+
case _:
|
|
323
|
+
raise ValueError(f"Invalid values format: {values_format}")
|
|
313
324
|
|
|
314
325
|
@staticmethod
|
|
315
326
|
def from_networkx(nx_graph: nx.Graph):
|
|
@@ -326,6 +337,7 @@ class MermaidBuilder(NetworkxBuilder):
|
|
|
326
337
|
def build(self,
|
|
327
338
|
orientation: nxm.DiagramOrientation = nxm.DiagramOrientation.LEFT_RIGHT,
|
|
328
339
|
node_shape: nxm.DiagramNodeShape = nxm.DiagramNodeShape.DEFAULT,
|
|
340
|
+
title: str | None = None,
|
|
329
341
|
with_edge_labels: bool = False,
|
|
330
342
|
**kwargs) -> nxm.typing.MermaidDiagram:
|
|
331
343
|
"""
|
|
@@ -336,6 +348,10 @@ class MermaidBuilder(NetworkxBuilder):
|
|
|
336
348
|
The orientation of the graph, by default Orientation.LEFT_RIGHT.
|
|
337
349
|
node_shape : NodeShape, optional
|
|
338
350
|
The shape of the nodes, by default NodeShape.DEFAULT.
|
|
351
|
+
title: str, optional
|
|
352
|
+
The title of the graph (default: None).
|
|
353
|
+
If None, the graph name will be used if available.
|
|
354
|
+
Supplying and empty string will remove the title.
|
|
339
355
|
with_edge_labels:
|
|
340
356
|
Whether to include edge labels, by default False.
|
|
341
357
|
**kwargs: additional inputs to the node and edge generator functions
|
|
@@ -346,7 +362,7 @@ class MermaidBuilder(NetworkxBuilder):
|
|
|
346
362
|
super().build(**kwargs)
|
|
347
363
|
color.convert_colors_to_hex(self._graph)
|
|
348
364
|
nxm_builder = nxm.DiagramBuilder(orientation=orientation, node_shape=node_shape)
|
|
349
|
-
return nxm_builder.build(self._graph, with_edge_labels=with_edge_labels)
|
|
365
|
+
return nxm_builder.build(self._graph, title=title, with_edge_labels=with_edge_labels)
|
|
350
366
|
|
|
351
367
|
|
|
352
368
|
class GraphQLBuilder(NetworkxBuilder):
|
|
@@ -797,7 +813,7 @@ def build(builder_cls: type[Builder],
|
|
|
797
813
|
"""
|
|
798
814
|
Build a graph from a graph model
|
|
799
815
|
|
|
800
|
-
|
|
816
|
+
Args:
|
|
801
817
|
builder_cls: builder class type
|
|
802
818
|
graph_model: a GraphModel instance
|
|
803
819
|
graph_type: type of the generated graph
|
|
@@ -8,14 +8,24 @@ import networkx as nx
|
|
|
8
8
|
|
|
9
9
|
@functools.lru_cache
|
|
10
10
|
def node_color_mapping(graph: nx.Graph, cmap: Union[str, mpl.colors.Colormap] = "tab20") -> Mapping:
|
|
11
|
-
"""
|
|
12
|
-
|
|
11
|
+
"""Map node types to RGBA colors based on a colormap.
|
|
12
|
+
Args:
|
|
13
13
|
graph: nx.Graph - The input graph for which node colors need to be mapped.
|
|
14
14
|
cmap: Union[str, mpl.colors.Colormap], optional - The colormap used to map values to RGBA colors.
|
|
15
15
|
Default is "tab20".
|
|
16
16
|
Returns:
|
|
17
17
|
Mapping - A dictionary mapping nodes to their corresponding RGBA colors based on the colormap.
|
|
18
|
+
|
|
19
|
+
.. note::
|
|
20
|
+
The graph should have a 'node_types' attribute containing the types of nodes.
|
|
21
|
+
The colormap can be specified as a string or a matplotlib colormap object.
|
|
18
22
|
"""
|
|
23
|
+
|
|
24
|
+
node_types = graph.graph.get('node_types', {})
|
|
25
|
+
|
|
26
|
+
if len(node_types) > 1 and 'node' in node_types:
|
|
27
|
+
node_types.pop('node')
|
|
28
|
+
|
|
19
29
|
type_lookup = {t: i for i, t in enumerate(graph.graph['node_types'].keys())}
|
|
20
30
|
color_lookup = {node: type_lookup.get(data.get('type'), 0) for node, data in graph.nodes.data()}
|
|
21
31
|
if len(color_lookup) > 1:
|
|
@@ -31,10 +41,14 @@ def node_color_mapping(graph: nx.Graph, cmap: Union[str, mpl.colors.Colormap] =
|
|
|
31
41
|
def color_hex(color: Union[str, Sequence[Union[float, int]]]) -> Union[str, Sequence[Union[float, int]]]:
|
|
32
42
|
"""Get HEX color code
|
|
33
43
|
|
|
34
|
-
|
|
44
|
+
Args:
|
|
35
45
|
color: input color
|
|
36
46
|
Returns:
|
|
37
47
|
Color HEX code
|
|
48
|
+
|
|
49
|
+
.. note::
|
|
50
|
+
If the input is a tuple or list, it should contain either three floats (0-1) or three ints (0-255).
|
|
51
|
+
The function will convert these to a HEX color code.
|
|
38
52
|
"""
|
|
39
53
|
if isinstance(color, (tuple, list)): # noqa: UP038
|
|
40
54
|
rgb = color[:3]
|
|
@@ -52,7 +66,20 @@ def color_hex(color: Union[str, Sequence[Union[float, int]]]) -> Union[str, Sequ
|
|
|
52
66
|
else:
|
|
53
67
|
return color
|
|
54
68
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
69
|
+
|
|
70
|
+
def convert_colors_to_hex(graph: nx.Graph, color: str = 'color') -> None:
|
|
71
|
+
"""Convert all color labels in the graph to hexadecimal format.
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
graph (nx.Graph): The input graph with node attributes.
|
|
75
|
+
color (str): The attribute name for the color. Default is 'color'.
|
|
76
|
+
|
|
77
|
+
Returns:
|
|
78
|
+
None: The function modifies the graph in place.
|
|
79
|
+
|
|
80
|
+
.. note::
|
|
81
|
+
This function assumes that the color attribute is present in the node data.
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
color_values = {node: color_hex(data[color]) for node, data in graph.nodes(data=True) if color in data}
|
|
85
|
+
nx.set_node_attributes(graph, values=color_values, name=color)
|
|
@@ -114,7 +114,7 @@ class GraphModel:
|
|
|
114
114
|
Used to declaratively register Edge and/or Node data supplier functions by using
|
|
115
115
|
decorators.
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
Args:
|
|
118
118
|
name: the archetype name for Graphs generated based on the GraphModel.
|
|
119
119
|
"""
|
|
120
120
|
|
|
@@ -166,7 +166,7 @@ class GraphModel:
|
|
|
166
166
|
def node_children_types(self, _type: str = UniverseNode) -> dict[str, list[str]]:
|
|
167
167
|
"""Children Node Types for given input Node Type
|
|
168
168
|
|
|
169
|
-
|
|
169
|
+
Args:
|
|
170
170
|
_type: Node Type. Default value is UNIVERSE_NODE.
|
|
171
171
|
|
|
172
172
|
Returns:
|
|
@@ -200,7 +200,7 @@ class GraphModel:
|
|
|
200
200
|
"""Decorator to Register a Generator of node payloads as a source for Graph Nodes.
|
|
201
201
|
It creates a NodeModel object.
|
|
202
202
|
|
|
203
|
-
|
|
203
|
+
Args:
|
|
204
204
|
type_: Optional source for the Node Type. Defaults to use Generator function
|
|
205
205
|
name as the Node Type.
|
|
206
206
|
parent_type: Optional parent Node Type. Defaults to UNIVERSE_NODE
|
|
@@ -253,7 +253,7 @@ class GraphModel:
|
|
|
253
253
|
"""Decorator to Register a generator of edge payloads as a source of Graph Edges.
|
|
254
254
|
It creates an Edge generator function.
|
|
255
255
|
|
|
256
|
-
|
|
256
|
+
Args:
|
|
257
257
|
type_: Optional source for the Edge Type. Defaults to use Generator function
|
|
258
258
|
name as the Edge Type.
|
|
259
259
|
source: Source for edge source Node ID.
|
|
@@ -296,7 +296,7 @@ class GraphModel:
|
|
|
296
296
|
"""Rectify the model.
|
|
297
297
|
Add a default NodeModel in case of having just edge supplier/s and no node supplier/s.
|
|
298
298
|
|
|
299
|
-
|
|
299
|
+
Args:
|
|
300
300
|
_type
|
|
301
301
|
parent_type
|
|
302
302
|
key
|
|
@@ -29,7 +29,7 @@ def _openapi_schema(request: Request) -> ASGIApp:
|
|
|
29
29
|
"""
|
|
30
30
|
schema_data = {
|
|
31
31
|
'openapi': '3.0.0',
|
|
32
|
-
'info': {'title': 'Graphinate API', 'version': '0.8.
|
|
32
|
+
'info': {'title': 'Graphinate API', 'version': '0.8.5'},
|
|
33
33
|
'paths': {
|
|
34
34
|
'/graphql': {'get': {'responses': {200: {'description': 'GraphQL'}}}},
|
|
35
35
|
'/graphiql': {'get': {'responses': {200: {'description': 'GraphiQL UI.'}}}},
|
|
@@ -11,7 +11,7 @@ def draw(graph: nx.Graph,
|
|
|
11
11
|
"""
|
|
12
12
|
Draws the given networkx graph with optional node and edge labels.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Args:
|
|
15
15
|
graph (nx.Graph): The input graph to be drawn.
|
|
16
16
|
with_node_labels (bool): Whether to display node labels. Default is True.
|
|
17
17
|
with_edge_labels (bool): Whether to display edge labels. Default is False.
|
|
@@ -65,24 +65,6 @@
|
|
|
65
65
|
<body>
|
|
66
66
|
<div id="3d-graph"></div>
|
|
67
67
|
<script>
|
|
68
|
-
// region GraphQL
|
|
69
|
-
|
|
70
|
-
const graphQuery = `query GenericGraph{nodes{...Details} links: edges{source{...Details} target{...Details} ...Details}} fragment Details on GraphElement {id label type color}`;
|
|
71
|
-
const nodeTypesQuery = `query GraphTypes{graph{name nodeTypes: nodeTypeCounts{name count: value} edgeTypes: edgeTypeCounts{name count: value}}}`;
|
|
72
|
-
|
|
73
|
-
function fetchGraphQL(payload) {
|
|
74
|
-
return fetch(
|
|
75
|
-
'/graphql',
|
|
76
|
-
{
|
|
77
|
-
method: 'post',
|
|
78
|
-
headers: {Accept: 'application/json', 'Content-Type': 'application/json'},
|
|
79
|
-
body: JSON.stringify(payload),
|
|
80
|
-
credentials: 'include',
|
|
81
|
-
}).then((response) => response.json());
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// endregion GraphQL
|
|
85
|
-
|
|
86
68
|
// region FloatingIFramePanel
|
|
87
69
|
let highestZIndex = 0;
|
|
88
70
|
let lastPanelPosition = {top: 50, left: 50};
|
|
@@ -299,6 +281,25 @@
|
|
|
299
281
|
|
|
300
282
|
// endregion FloatingIFramePanel
|
|
301
283
|
|
|
284
|
+
// region GraphQL
|
|
285
|
+
|
|
286
|
+
const graphQuery = `query GenericGraph{nodes{...Details} links: edges{source{...Details} target{...Details} ...Details}} fragment Details on GraphElement {id label type color}`;
|
|
287
|
+
const nodeTypesQuery = `query GraphTypes{graph{name nodeTypes: nodeTypeCounts{name count: value} edgeTypes: edgeTypeCounts{name count: value}}}`;
|
|
288
|
+
|
|
289
|
+
function fetchGraphQL(payload) {
|
|
290
|
+
return fetch(
|
|
291
|
+
'/graphql',
|
|
292
|
+
{
|
|
293
|
+
method: 'post',
|
|
294
|
+
headers: {Accept: 'application/json', 'Content-Type': 'application/json'},
|
|
295
|
+
body: JSON.stringify(payload),
|
|
296
|
+
credentials: 'include',
|
|
297
|
+
}).then((response) => response.json());
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// endregion GraphQL
|
|
301
|
+
|
|
302
|
+
// region ForceGraph3D
|
|
302
303
|
const nodeTypeColor = {}
|
|
303
304
|
const nodeTypeVisibility = {};
|
|
304
305
|
let graphParams = {
|
|
@@ -659,6 +660,8 @@
|
|
|
659
660
|
createGraphControlPanel(data.graph, gData);
|
|
660
661
|
});
|
|
661
662
|
});
|
|
663
|
+
|
|
664
|
+
// endregion ForceGraph3D
|
|
662
665
|
</script>
|
|
663
666
|
</body>
|
|
664
667
|
</html>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{graphinate-0.8.4 → graphinate-0.8.5}/examples/social/cache/13/dd/73ce25face7beb30b69b64feeb77.val
RENAMED
|
File without changes
|
{graphinate-0.8.4 → graphinate-0.8.5}/examples/social/cache/21/9e/00846f323987ba16cfbe0127d8eb.val
RENAMED
|
File without changes
|
{graphinate-0.8.4 → graphinate-0.8.5}/examples/social/cache/70/b6/2aefb0269adce7fedf877fa0d267.val
RENAMED
|
File without changes
|
{graphinate-0.8.4 → graphinate-0.8.5}/examples/social/cache/87/f5/ec1739bc369e84c3fcb302bf532a.val
RENAMED
|
File without changes
|
{graphinate-0.8.4 → graphinate-0.8.5}/examples/social/cache/ba/fe/3aca7b2c38abff60e7ce5eb486a8.val
RENAMED
|
File without changes
|
{graphinate-0.8.4 → graphinate-0.8.5}/examples/social/cache/c7/9e/ce82b0288020b7152779df09bd73.val
RENAMED
|
File without changes
|
|
File without changes
|
{graphinate-0.8.4 → graphinate-0.8.5}/examples/social/cache/d2/53/3b88f2fc162561cfdbbe9abc352a.val
RENAMED
|
File without changes
|
{graphinate-0.8.4 → graphinate-0.8.5}/examples/social/cache/e2/d5/5d079f200eabf9b625b0473f6fbe.val
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{graphinate-0.8.4 → graphinate-0.8.5}/src/graphinate/server/web/static/images/network_graph.png
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|