🐍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
Tidy data structures, summaries, and visualisations for missing data

naniar naniar provides principled, tidy ways to summarise, visualise, and manipulate missing data with minimal deviations from the workflows in ggplot

Nicholas Tierney 611 Dec 22, 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 6, 2023
Plotly Dash Command Line Tools - Easily create and deploy Plotly Dash projects from templates

??️ dash-tools - Create and Deploy Plotly Dash Apps from Command Line | | | | | Create a templated multi-page Plotly Dash app with CLI in less than 7

Andrew Hossack 50 Dec 30, 2022
This package creates clean and beautiful matplotlib plots that work on light and dark backgrounds

This package creates clean and beautiful matplotlib plots that work on light and dark backgrounds. Inspired by the work of Edward Tufte.

Nico Schlömer 205 Jan 7, 2023
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 6, 2022
finds grocery stores and stuff next to route (gpx)

Route-Report Route report is a command-line utility that can be used to locate points-of-interest near your planned route (gpx). The results are based

Clemens Mosig 5 Oct 10, 2022
Profile and test to gain insights into the performance of your beautiful Python code

Profile and test to gain insights into the performance of your beautiful Python code View Demo - Report Bug - Request Feature QuickPotato in a nutshel

Joey Hendricks 138 Dec 6, 2022
Bar Chart of the number of Senators from each party who are up for election in the next three General Elections

Congress-Analysis Bar Chart of the number of Senators from each party who are up for election in the next three General Elections This bar chart shows

null 11 Oct 26, 2021
UNMAINTAINED! Renders beautiful SVG maps in Python.

Kartograph is not maintained anymore As you probably already guessed from the commit history in this repo, Kartograph.py is not maintained, which mean

null 1k Dec 9, 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 9, 2022
I'm doing Genuary, an aritifiacilly generated month to build code that make beautiful things

Genuary 2022 I'm doing Genuary, an aritifiacilly generated month to build code that make beautiful things. Every day there is a new prompt for making

Joaquín Feltes 1 Jan 10, 2022
An application that allows you to design and test your own stock trading algorithms in an attempt to beat the market.

StockBot is a Python application for designing and testing your own daily stock trading algorithms. Installation Use the

Ryan Cullen 280 Dec 19, 2022
BrowZen correlates your emotional states with the web sites you visit to give you actionable insights about how you spend your time browsing the web.

BrowZen BrowZen correlates your emotional states with the web sites you visit to give you actionable insights about how you spend your time browsing t

Nick Bild 36 Sep 28, 2022
In-memory Graph Database and Knowledge Graph with Natural Language Interface, compatible with Pandas

CogniPy for Pandas - In-memory Graph Database and Knowledge Graph with Natural Language Interface Whats in the box Reasoning, exploration of RDF/OWL,

Cognitum Octopus 34 Dec 13, 2022
A programming language built on top of Python to easily allow Swahili speakers to get started with programming without ever knowing English

pyswahili A programming language built over Python to easily allow swahili speakers to get started with programming without ever knowing english pyswa

Jordan Kalebu 72 Dec 15, 2022
Easily convert matplotlib plots from Python into interactive Leaflet web maps.

mplleaflet mplleaflet is a Python library that converts a matplotlib plot into a webpage containing a pannable, zoomable Leaflet map. It can also embe

Jacob Wasserman 502 Dec 28, 2022
Process dataframe in a easily way.

Popanda Written by Shengxuan Wang at OSU. Used for processing dataframe, especially for machine learning. The name is from "Po" in the movie Kung Fu P

ShawnWang 1 Dec 24, 2021
Functions for easily making publication-quality figures with matplotlib.

Data-viz utils ?? Functions for data visualization in matplotlib ?? API Can be installed using pip install dvu and then imported with import dvu. You

Chandan Singh 16 Sep 15, 2022
Lumen provides a framework for visual analytics, which allows users to build data-driven dashboards from a simple yaml specification

Lumen project provides a framework for visual analytics, which allows users to build data-driven dashboards from a simple yaml specification

HoloViz 120 Jan 4, 2023