🐍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
Data parsing and validation using Python type hints

pydantic Data validation and settings management using Python type hinting. Fast and extensible, pydantic plays nicely with your linters/IDE/brain. De

Samuel Colvin 12.1k Jan 06, 2023
An interactive UMAP visualization of the MNIST data set.

Code for an interactive UMAP visualization of the MNIST data set. Demo at https://grantcuster.github.io/umap-explorer/. You can read more about the de

grant 70 Dec 27, 2022
A simple, fast, extensible python library for data validation.

Validr A simple, fast, extensible python library for data validation. Simple and readable schema 10X faster than jsonschema, 40X faster than schematic

kk 209 Sep 19, 2022
A guide for using Bootstrap 5 classes in Dash Bootstrap Components V1

dash-bootstrap-cheatsheet This handy interactive cheatsheet makes it easy to use the Bootstrap 5 classes with your Dash app made with the latest versi

10 Dec 22, 2022
Minimal Ethereum fee data viewer for the terminal, contained in a single python script.

Minimal Ethereum fee data viewer for the terminal, contained in a single python script. Connects to your node and displays some metrics in real-time.

48 Dec 05, 2022
Open-questions - Open questions for Bellingcat technical contributors

Open questions for Bellingcat technical contributors These are difficult, long-term projects that would contribute to open source investigations at Be

Bellingcat 234 Dec 31, 2022
Schema validation for Xarray objects

xarray-schema Schema validation for Xarray installation This package is in the early stages of development. Install it from source: pip install git+gi

carbonplan 22 Oct 31, 2022
A streamlit component for bi-directional communication with bokeh plots.

Streamlit Bokeh Events A streamlit component for bi-directional communication with bokeh plots. Its just a workaround till streamlit team releases sup

Ashish Shukla 123 Dec 25, 2022
Attractors is a package for simulation and visualization of strange attractors.

attractors Attractors is a package for simulation and visualization of strange attractors. Installation The simplest way to install the module is via

Vignesh M 45 Jul 31, 2022
Tweets your monthly GitHub Contributions as Wordle grid

Tweets your monthly GitHub Contributions as Wordle grid

Venu Vardhan Reddy Tekula 5 Feb 16, 2022
Curvipy - The Python package for visualizing curves and linear transformations in a super simple way

Curvipy - The Python package for visualizing curves and linear transformations in a super simple way

Dylan Tintenfich 55 Dec 28, 2022
daily report of @arkinvest ETF activity + data collection

ark_invest daily weekday report of @arkinvest ETF activity + data collection This script was created to: Extract and save daily csv's from ARKInvest's

T D 27 Jan 02, 2023
Fast scatter density plots for Matplotlib

About Plotting millions of points can be slow. Real slow... 😴 So why not use density maps? ⚑ The mpl-scatter-density mini-package provides functional

Thomas Robitaille 473 Dec 12, 2022
A small collection of tools made by me, that you can use to visualize atomic orbitals in both 2D and 3D in different aspects.

Orbitals in Python A small collection of tools made by me, that you can use to visualize atomic orbitals in both 2D and 3D in different aspects, and o

Prakrisht Dahiya 1 Nov 25, 2021
Library for exploring and validating machine learning data

TensorFlow Data Validation TensorFlow Data Validation (TFDV) is a library for exploring and validating machine learning data. It is designed to be hig

688 Jan 03, 2023
Because trello only have payed options to generate a RunUp chart, this solves that!

Trello Runup Chart Generator The basic concept of the project is that Corello is pay-to-use and want to use Trello To-Do/Doing/Done automation with gi

RΓ΄mulo Schiavon 1 Dec 21, 2021
DrawBot lets you draw images taken from the internet on Skribbl.io, Gartic Phone and Paint

DrawBot You don't speak french? No worries, english translation is over here. C'est quoi ? DrawBot est un logiciel codΓ© par V2F qui va prendre possess

V2F 205 Jan 01, 2023
Practical-statistics-for-data-scientists - Code repository for O'Reilly book

Code repository Practical Statistics for Data Scientists: 50+ Essential Concepts Using R and Python by Peter Bruce, Andrew Bruce, and Peter Gedeck Pub

1.7k Jan 04, 2023
An(other) implementation of JSON Schema for Python

jsonschema jsonschema is an implementation of JSON Schema for Python. from jsonschema import validate # A sample schema, like what we'd get f

Julian Berman 4k Jan 04, 2023
demir.ai Dataset Operations

demir.ai Dataset Operations With this application, you can have the empty values (nan/null) deleted or filled before giving your dataset to machine le

Ahmet Furkan DEMIR 8 Nov 01, 2022