🐍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
EPViz is a tool to aid researchers in developing, validating, and reporting their predictive modeling outputs.

EPViz (EEG Prediction Visualizer) EPViz is a tool to aid researchers in developing, validating, and reporting their predictive modeling outputs. A lig

Jeff 2 Oct 19, 2022
Python module for drawing and rendering beautiful atoms and molecules using Blender.

Batoms is a Python package for editing and rendering atoms and molecules objects using blender. A Python interface that allows for automating workflows.

Xing Wang 1 Jul 06, 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
CPG represent!

CoolPandasGroup CPG represent! Arianna Brandon Enne Luan Tracie Project requirements: use Pandas to clean and format datasets use Jupyter Notebook to

Enne 3 Feb 07, 2022
Leyna's Visualizing Data With Python

Leyna's Visualizing Data Below is information on the number of bilingual students in three school districts in Massachusetts. You will also find infor

11 Oct 28, 2021
a robust room presence solution for home automation with nearly no false negatives

Argos Room Presence This project builds a room presence solution on top of Argos. Using just a cheap raspberry pi zero w (plus an attached pi camera,

Angad Singh 46 Sep 18, 2022
A Python toolbox for gaining geometric insights into high-dimensional data

"To deal with hyper-planes in a 14 dimensional space, visualize a 3D space and say 'fourteen' very loudly. Everyone does it." - Geoff Hinton Overview

Contextual Dynamics Laboratory 1.8k Dec 29, 2022
Print matplotlib colors

mplcolors Tired of searching "matplotlib colors" every week/day/hour? This simple script displays them all conveniently right in your terminal emulato

Brandon Barker 32 Dec 13, 2022
Colormaps for astronomers

cmastro: colormaps for astronomers πŸ”­ This package contains custom colormaps that have been used in various astronomical applications, similar to cmoc

Adrian Price-Whelan 12 Oct 11, 2022
Lime: Explaining the predictions of any machine learning classifier

lime This project is about explaining what machine learning classifiers (or models) are doing. At the moment, we support explaining individual predict

Marco Tulio Correia Ribeiro 10.3k Dec 29, 2022
A set of three functions, useful in geographical calculations of different sorts

GreatCircle A set of three functions, useful in geographical calculations of different sorts. Available for PHP, Python, Javascript and Ruby. Live dem

72 Sep 30, 2022
A dashboard built using Plotly-Dash for interactive visualization of Dex-connected individuals across the country.

Dashboard For The DexConnect Platform of Dexterity Global Working prototype submission for internship at Dexterity Global Group. Dashboard for real ti

Yashasvi Misra 2 Jun 15, 2021
Resources for teaching & learning practical data visualization with python.

Practical Data Visualization with Python Overview All views expressed on this site are my own and do not represent the opinions of any entity with whi

Paul Jeffries 98 Sep 24, 2022
visualize_ML is a python package made to visualize some of the steps involved while dealing with a Machine Learning problem

visualize_ML visualize_ML is a python package made to visualize some of the steps involved while dealing with a Machine Learning problem. It is build

Ayush Singh 164 Dec 12, 2022
Python scripts to manage Chia plots and drive space, providing full reports. Also monitors the number of chia coins you have.

Chia Plot, Drive Manager & Coin Monitor (V0.5 - April 20th, 2021) Multi Server Chia Plot and Drive Management Solution Be sure to ⭐ my repo so you can

338 Nov 25, 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
Fast visualization of radar_scenes based on oleschum/radar_scenes

RadarScenes Tools About This python package provides fast visualization for the RadarScenes dataset. The Open GL based visualizer is smoother than ole

Henrik SΓΆderlund 2 Dec 09, 2021
With Holoviews, your data visualizes itself.

HoloViews Stop plotting your data - annotate your data and let it visualize itself. HoloViews is an open-source Python library designed to make data a

HoloViz 2.3k Jan 04, 2023
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
https://there.oughta.be/a/macro-keyboard

inkkeys Details and instructions can be found on https://there.oughta.be/a/macro-keyboard In contrast to most of my other projects, I decided to put t

Sebastian Staacks 209 Dec 21, 2022