PyNode Next

A complete rewrite of PyNode for the modern era.

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

Getting started

To get started, download the latest version of PyNode Next and place the folder in your project’s directory.

Note PyNode Next requires AlgorithmX, so you might need to install that if you haven’t done so previously. This can usually be done by running the following in your terminal.$ python3 -m pip install algorithmx

Then all you need to do is create a new python file that looks like this and you can start writing code for PyNode Next.

from pynode_next import *

def run():
    # put your python code here.
    # here is an example of what you could do:
    graph.add_node("a")
    graph.add_node("b")

    graph.add_edge("a", "b")

begin_pynode_next(run)

demo min

Migrating from PyNode

PyNode Next has been designed to maintain the vast majority of all of the functions from the previous version of PyNode.

Switching to PyNode Next should be as simple as replacing from pynode.main import * with from pynode_next import *. And adding a _next to the begin_pynode function call.

PyNode PyNode Next
from pynode.main import * def run() # code graph.add_node("a") begin_pynode(run) from pynode_next import * def run() # code graph.add_node("a") begin_pynode_next(run)

Differences from the original PyNode

  • Certain methods are strongly typed. Meaning that they only accept input of specific types. This is due to how the overloading system works, and will be documented whenever it pops up.
  • Keyword arguments (that’s stuff like the id= in add_node(id="a")) might be broken in some methods due to the overloading system.
  • outline options on methods don’t exist any more. Text no longer has any outlines.
  • You can no longer compare nodes with other nodes like NodeA > NodeB. To do this now, you need to specify the priority: NodeA.priority() > NodeB.priority()
  • The above also applies to edges.
  • graph.random() has been drastically simplified to just take order and size arguments.
  • node.position() has not been implemented yet. (The rendering library PyNode Next uses has a different coordinate system to that of the original PyNode)

Documentation

The docs have been moved to docs/documentation.adoc


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

GitHub

https://github.com/ehne/PyNode-Next