🐍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
A python visualization of the A* path finding algorithm

A python visualization of the A* path finding algorithm. It allows you to pick your start, end location and make obstacles and then view the process of finding the shortest path. You can also choose

Kimeon 4 Aug 02, 2022
Python package to visualize and cluster partial dependence.

partial_dependence A python library for plotting partial dependence patterns of machine learning classifiers. The technique is a black box approach to

NYU Visualization Lab 25 Nov 14, 2022
A Python Binder that merge 2 files with any extension by creating a new python file and compiling it to exe which runs both payloads.

Update ! ANONFILE MIGHT NOT WORK ! About A Python Binder that merge 2 files with any extension by creating a new python file and compiling it to exe w

Vesper 15 Oct 12, 2022
🎨 Python Echarts Plotting Library

pyecharts Python ❤️ ECharts = pyecharts English README 📣 简介 Apache ECharts (incubating) 是一个由百度开源的数据可视化,凭借着良好的交互性,精巧的图表设计,得到了众多开发者的认可。而 Python 是一门富有表达

pyecharts 13.1k Jan 03, 2023
This is a super simple visualization toolbox (script) for transformer attention visualization ✌

Trans_attention_vis This is a super simple visualization toolbox (script) for transformer attention visualization ✌ 1. How to prepare your attention m

Mingyu Wang 3 Jul 09, 2022
SummVis is an interactive visualization tool for text summarization.

SummVis is an interactive visualization tool for analyzing abstractive summarization model outputs and datasets.

Robustness Gym 246 Dec 08, 2022
Painlessly create beautiful matplotlib plots.

Announcement Thank you to everyone who has used prettyplotlib and made it what it is today! Unfortunately, I no longer have the bandwidth to maintain

Olga Botvinnik 1.6k Jan 06, 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
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
Tools for exploratory data analysis in Python

Dora Exploratory data analysis toolkit for Python. Contents Summary Setup Usage Reading Data & Configuration Cleaning Feature Selection & Extraction V

Nathan Epstein 599 Dec 25, 2022
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
Manim is an animation engine for explanatory math videos.

A community-maintained Python framework for creating mathematical animations.

12.4k Dec 30, 2022
HM02: Visualizing Interesting Datasets

HM02: Visualizing Interesting Datasets This is a homework assignment for CSCI 40 class at Claremont McKenna College. Go to the project page to learn m

Qiaoling Chen 11 Oct 26, 2021
A python script editor for napari based on PyQode.

napari-script-editor A python script editor for napari based on PyQode. This napari plugin was generated with Cookiecutter using with @napari's cookie

Robert Haase 9 Sep 20, 2022
Write python locally, execute SQL in your data warehouse

RasgoQL Write python locally, execute SQL in your data warehouse ≪ Read the Docs · Join Our Slack » RasgoQL is a Python package that enables you to ea

Rasgo 265 Nov 21, 2022
Project coded in Python using Pandas to look at changes in chase% for batters facing a pitcher first time through the order vs. thrid time

Project coded in Python using Pandas to look at changes in chase% for batters facing a pitcher first time through the order vs. thrid time

Jason Kraynak 1 Jan 07, 2022
Data visualization using matplotlib

Data visualization using matplotlib project instructions Top 5 Most Common Coffee Origins In this visualization I used data from Ankur Chavda on Kaggl

13 Oct 27, 2021
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
PanGraphViewer -- show panenome graph in an easy way

PanGraphViewer -- show panenome graph in an easy way Table of Contents Versions and dependences Desktop-based panGraphViewer Library installation for

16 Dec 17, 2022