Skip to content

Commit

Permalink
Merge branch 'COG-adding_html_graph_render' of github.com:topoteretes…
Browse files Browse the repository at this point in the history
…/cognee into COG-adding_html_graph_render
  • Loading branch information
dexters1 committed Jan 8, 2025
2 parents ce4c5b1 + 3b649d1 commit 9c2c194
Show file tree
Hide file tree
Showing 4 changed files with 643 additions and 659 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/reusable_python_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11.x'
python-version: '3.12.x'

- name: Install Poetry
uses: snok/install-poetry@v1
Expand Down
17 changes: 12 additions & 5 deletions cognee/shared/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@
import tiktoken
import nltk
import base64
from bokeh.plotting import figure, from_networkx
from bokeh.models import Circle, MultiLine, HoverTool, ColumnDataSource, Range1d
from bokeh.plotting import output_file, show

from bokeh.embed import file_html
from bokeh.resources import CDN

import logging
import sys
Expand Down Expand Up @@ -364,6 +359,12 @@ def style_and_render_graph(p, G, layout_positions, node_attribute, node_colors,
"""
Apply styling and render the graph into the plot.
"""
from bokeh.plotting import figure, from_networkx
from bokeh.models import Circle, MultiLine, HoverTool, ColumnDataSource, Range1d
from bokeh.plotting import output_file, show

from bokeh.embed import file_html
from bokeh.resources import CDN
graph_renderer = from_networkx(G, layout_positions)
node_radii = [0.02 + 0.1 * centrality[node] for node in G.nodes()]
graph_renderer.node_renderer.data_source.data["radius"] = node_radii
Expand Down Expand Up @@ -397,6 +398,12 @@ async def create_cognee_style_network_with_logo(
"""
Create a Cognee-inspired network visualization with an embedded logo.
"""
from bokeh.plotting import figure, from_networkx
from bokeh.models import Circle, MultiLine, HoverTool, ColumnDataSource, Range1d
from bokeh.plotting import output_file, show

from bokeh.embed import file_html
from bokeh.resources import CDN
logging.info("Converting graph to serializable format...")
G = await convert_to_serializable_graph(G)

Expand Down
Loading

0 comments on commit 9c2c194

Please sign in to comment.