🐍PyNode Next allows you to easily create beautiful graph visualisations and animations

Overview

logo

PyNode Next

A complete rewrite of PyNode for the modern era. Up to five times faster than the original PyNode.

PyNode Next allows you to easily create beautiful graph visualisations and animations. Has been tested on macOS and Linux, and should work with Windows.

demo min

Created by @ehne in 2021. Based on PyNode by @alexsocha. main

Comments
  • Support `Union` types in overloading.py

    Support `Union` types in overloading.py

    Currently overloading.py raises an error if it finds a type annotation that uses the typing.Union type. This seems to be because it is a class. (see line 76 of overloading.py)

    It would be good to add support for these "custom" types before fully type hinting the project.

    It might be as easy as replacing the isclass code with something like this from generic.py.

    opened by ehne 2
  • edge.width() returns weight, not width/thickness

    edge.width() returns weight, not width/thickness

    As described in title.

    Issue exits in edge.py, on line 122.

        def width(self):
            """Returns the thickness of the edge."""
            return self._weight
    

    Proposed solution

    Replace self._weight with self._thickness

    Also maybe make the naming more consistent? Width is called both thickness and width. And in the edge.set_width() function, the parameter is called weight which makes things confusing and might've led to this issue.

    Later today when I've got time i'll submit a pull request.

    bug 
    opened by frex-e 1
  • Refactor html code

    Refactor html code

    The html code is kinda gross, would be nice to refactor it to be less massive.

    I suspect there's a lot of styles that are unused and some the js can be cleaned up

    opened by ehne 1
  • Add new version alert

    Add new version alert

    Probably should let the user know if there is a new feature or patch version. So that they can download the new version and get whatever fix.

    Proposed solution

    Check on the localhost ui, and put a banner up if there is a new version. Probably reuse some of the code from the gh-pages branch, and how the docs have the version switcher.

    In terms of sending the installed version of PyNode Next to the client, just dispatch an event when the user connects to the socket. (through self.canvas.onmessage or something like that)

    version_dispatch_dict = {'isPyNodeNext': True, 'type': 'version', 'message': 'v1.9.1'}
    self.canvas.onmessage('getPyNodeNextVersion', lambda: self.canvas.dispatch(version_dispatch_dict))
    
    let socket = initSocket(function() { 
      canvas.message('getPyNodeNextVersion') 
    }, dispatch);
    

    And then just grab the message in the js dispatch function and handle it.

    opened by ehne 1
  • Overflowing node text becomes invisible on background.

    Overflowing node text becomes invisible on background.

    When the node's value becomes larger than the circle can contain, it becomes hard to read the text, as it is a very similar colour to the background colour.

    The original PyNode solved this by having outlines on the text. Algorithm X doesn't seem to support this kind of thing, so it might need to be implemented with external d3 stuff in ui.html.

    Alternatively, the nodes could dynamically size to fit the text in (like they do in GraphX). Although, this would most likely remove the nice circle shape and would mean that the size property would be basically useless as the nodes would not have one consistent size.

    opened by ehne 1
  • Work out positioning

    Work out positioning

    From the original PyNode:

    • node.set_position(x, y, relative=False) - Sets the static position of the node. x and y are pixel coordinates, with (0, 0) being the top-left corner of the output window (the standard size of the window is 500x400). If relative is set, x and y should instead be values between 0.0 and 1.0, specifying the node's position as a percentage of the window size.
    • node.position() - Returns a tuple with the (x, y) coordinates of the node. Should be used in asynchronous function calls.

    This was fine back then, but because we don't know what the size of the user's screen we probably are going to have to make them all relative.

    Also, AlgorithmX's coordinate system means that (0, 0) is in the middle of the screen.

    opened by ehne 1
  • fix-the-edge-weight-none-problem-ehn-17

    fix-the-edge-weight-none-problem-ehn-17

    Fixes the problem where you'd have to double set the edge's weight to None if you wanted it to be None.

    before:

    graph.add_edge('a', 'b', weight=None, directed=False)
    # doesn't show the weight 'None'
    edge.set_weight(None)
    # now it does
    

    after:

    graph.add_edge('a', 'b', weight=None, directed=False)
    # shows the weight 'None'
    

    Closes #13 and EHN-17

    opened by ehne 0
  • remove-legacy-arguments-ehn-27

    remove-legacy-arguments-ehn-27

    Removes legacy arguments from PyNode Next. (Thankfully none of them used the overloading system so the errors should be at least useful)

    Closes #26 EHN-27

    opened by ehne 0
  • Relative positions incorrect due to zoom

    Relative positions incorrect due to zoom

    The positions of the relative scale are incorrect due to the zoom done to make the nodes bigger. The zoom appears to change how AlgorithmX handles its relative positions. Not sure how to fix this one. In the worst case we can just disable the zoom.

    bug 
    opened by ehne 0
  • Node.position not defined in data method

    Node.position not defined in data method

    the node's position is not defined in the data method and doesn't move to the correct position when added after it is initialised.

    a = Node('a')
    a.set_position(1,1)
    graph.add_node(a)
    

    doesn't work, but the following does:

    a = graph.add_node('a')
    a.set_position(1,1)
    
    bug 
    opened by ehne 0
  • Remove legacy arguments

    Remove legacy arguments

    Some methods still have legacy arguments in their original locations so that it can maintain compatibility with the original PyNode. Most of the methods that have this are the style ones.

    Proposed solution

    Remove the outline kwarg from set style methods. It's in the middle of the arguments and results in issues where there is an option that does nothing before an option that actually does something. Leads to a situation where the user could expect something like node.set_value_style(13, Color.WHITE) to do one thing, but it actually does something else.

    branch: remove-legacy-arguments-ehn-27

    opened by ehne 0
  • Clean up public and private methods so it's consistent

    Clean up public and private methods so it's consistent

    Currently there is a mix of single and double underscores used for private methods. To actually get the proper python private methods these should all be double underscore.

    opened by ehne 0
  • Consider not redefining builtin `id`

    Consider not redefining builtin `id`

    A lot of the function arguments are id and redefine that builtin (hence their different colouring in highlighters). Codefactor gets really annoyed about this, although the use of id doesn't seem to have caused any problems so far.

    Consider replacing this id with something like uid or something similar. I'm not entirely sure what a good substitute would be.

    opened by ehne 0
  • Consider using custom canvas server

    Consider using custom canvas server

    Currently PyNode Next uses the default canvas server, this has some issues in how it understands where files are and what to load. This results in the slightly odd looking code in core:

    base_path = os.path.relpath(__file__)
    self.custom_ui = f"{Path(base_path).parent}/ui.html"
    

    This is due to how if you use a custom html file (like PyNode Next does) it switches to using a relative file handler, rather than an absolute one. Hence the relpath call.

    This problem results in the unfortunate side effect that we cannot package PyNode Next for PyPi, as it is unable to find a suitable relative path to work with. Meaning that users have to download a new copy of PyNode Next for every project (or move the same copy between projects). This also means that when uploading work done with PyNode Next, it will also include the PyNode Next source files. (this is both good and bad. good because it means that whatever version of PyNode Next is used in a project will be the same with the same project on a different machine, but bad for the reasons outlined before).

    If we were to use a custom implementation of AlgorithmX's CanvasServer class, we would have more control over what path could be loaded. In theory we should just be able to replace the init function of CanvasServer.

    opened by ehne 0
Releases(v2.1.2)
Owner
ehne
I make pretty neat websites and sometimes useful libraries.
ehne
GitHub English Top Charts

Help you discover excellent English projects and get rid of the interference of other spoken language.

kon9chunkit 529 Jan 02, 2023
Generate graphs with NetworkX, natively visualize with D3.js and pywebview

webview_d3 This is some PoC code to render graphs created with NetworkX natively using D3.js and pywebview. The main benifit of this approac

byt3bl33d3r 68 Aug 18, 2022
A tool to plot and execute Rossmos's Formula, that helps to catch serial criminals using mathematics

Rossmo Plotter A tool to plot and execute Rossmos's Formula using python, that helps to catch serial criminals using mathematics Author: Amlan Saha Ku

Amlan Saha Kundu 3 Aug 29, 2022
Draw interactive NetworkX graphs with Altair

nx_altair Draw NetworkX graphs with Altair nx_altair offers a similar draw API to NetworkX but returns Altair Charts instead. If you'd like to contrib

Zachary Sailer 206 Dec 12, 2022
mysql relation charts

sqlcharts 自动生成数据库关联关系图 复制settings.py.example 重命名为settings.py 将数据库配置信息填入settings.DATABASE,目前支持mysql和postgresql 执行 python build.py -b,-b是读取数据库表结构,如果只更新匹

6 Aug 22, 2022
Tools for calculating and visualizing Elo-like ratings of MLB teams using Retosheet data

Overview This project uses historical baseball games data to calculate an Elo-like rating for MLB teams based on regular season match ups. The Elo rat

Lukas Owens 0 Aug 25, 2021
This is a sorting visualizer made with Tkinter.

Sorting-Visualizer This is a sorting visualizer made with Tkinter. Make sure you've installed tkinter in your system to use this visualizer pip instal

Vishal Choubey 7 Jul 06, 2022
Script to create an animated data visualisation for categorical timeseries data - GIF choropleth map with annotations.

choropleth_ldn Simple script to create a chloropleth map of London with categorical timeseries data. The script in main.py creates a gif of the most f

1 Oct 07, 2021
Implementation of SOMs (Self-Organizing Maps) with neighborhood-based map topologies.

py-self-organizing-maps Simple implementation of self-organizing maps (SOMs) A SOM is an unsupervised method for learning a mapping from a discrete ne

Jonas Grebe 6 Nov 22, 2022
Collection of scripts for making high quality beautiful math-related posters.

Poster Collection of scripts for making high quality beautiful math-related posters. The poster can have as large printing size as 3x2 square feet wit

Nattawut Phetmak 3 Jun 09, 2022
Analytical Web Apps for Python, R, Julia, and Jupyter. No JavaScript Required.

Dash Dash is the most downloaded, trusted Python framework for building ML & data science web apps. Built on top of Plotly.js, React and Flask, Dash t

Plotly 17.9k Dec 31, 2022
Quickly and accurately render even the largest data.

Turn even the largest data into images, accurately Build Status Coverage Latest dev release Latest release Docs Support What is it? Datashader is a da

HoloViz 2.9k Dec 28, 2022
PolytopeSampler is a Matlab implementation of constrained Riemannian Hamiltonian Monte Carlo for sampling from high dimensional disributions on polytopes

PolytopeSampler PolytopeSampler is a Matlab implementation of constrained Riemannian Hamiltonian Monte Carlo for sampling from high dimensional disrib

9 Sep 26, 2022
Open-source demos hosted on Dash Gallery

Dash Sample Apps This repository hosts the code for over 100 open-source Dash apps written in Python or R. They can serve as a starting point for your

Plotly 2.7k Jan 07, 2023
These data visualizations were created as homework for my CS40 class. I hope you enjoy!

Data Visualizations These data visualizations were created as homework for my CS40 class. I hope you enjoy! Nobel Laureates by their Country of Birth

9 Sep 02, 2022
A Jupyter - Three.js bridge

pythreejs A Python / ThreeJS bridge utilizing the Jupyter widget infrastructure. Getting Started Installation Using pip: pip install pythreejs And the

Jupyter Widgets 844 Dec 27, 2022
Visualize large time-series data in plotly

plotly_resampler enables visualizing large sequential data by adding resampling functionality to Plotly figures. In this Plotly-Resampler demo over 11

PreDiCT.IDLab 604 Dec 28, 2022
An open-source tool for visual and modular block programing in python

PyFlow PyFlow is an open-source tool for modular visual programing in python ! Although for now the tool is in Beta and features are coming in bit by

1.1k Jan 06, 2023
Automatically visualize your pandas dataframe via a single print! 📊 💡

A Python API for Intelligent Visual Discovery Lux is a Python library that facilitate fast and easy data exploration by automating the visualization a

Lux 4.3k Dec 28, 2022
Compute and visualise incidence (reworking of the original incidence package)

incidence2 incidence2 is an R package that implements functions and classes to compute, handle and visualise incidence from linelist data. It refocuss

15 Nov 22, 2022