{ "info": { "author": "Harald Ujc", "author_email": "harald.ujc@screenpopsoftware.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 3.7", "Topic :: Scientific/Engineering :: Mathematics", "Topic :: Scientific/Engineering :: Physics", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# pyladder\n\nHarald Ujc - Screenpop Software Inc.\n\nA python library for planarity testing and rendering of ladder type graphs. Built with Visual Studio Code and Python 3.7.0 32-bit, 3.7.4 64-bit Conda on Windows 10 and Python 3.7.3 64-bit, 3.7.3 64-bit Conda on Mac OS X.\n\nThe algorithm is sourced from 'Efficient Planarity Testing' by John Hopcroft and Robert Tarjan\n\n## Background\n\npyladder is an exercise in translating an ANSI 'C' program to a python class. The program will take a list of nodes representing a connected graph in the plane. It will then attempt to generate a visual display of the graph, and advise if the graph is planar or not.\n\nNote that as this is a learning exercise, some of the style used will not adhere to generally accepted python patterns. \n\nThere is an upper limit on the number of connections and nodes. This is not a limitation of the algorithm, rather due to the original 'C' program being a proof-of-concept and there was no appetite for dynamic memory management and fixed arrays were used instead.\n\n## Practical applications\n\n### Programmable logic controllers (PLC)\n\nThe pyladder package can be used to display a ladder representing protective interlock logic.\n\n### Gaming\n\nThe pyladder package can be used to render a maze or connected points in space in real time from a list of coordinates. This is much more portable, space saving and dynamic as opposed to a fixed graphical representation in files or memory.\n\n### Planarity testing\n\nThe input node list could represent a list of electronic parts and the output could then be used to create an circuit board etch where the requirement is that the connecting edges cannot cross, for obvious reasons.\n\nNote: The pyladder package is available at the Python Package Index.\nAll examples below require installation of the pyladder package via:\n\n pip install pyladder\n\n## Calling and usage convention 1\n\nA python dictionary describing the ladder as follows:\nThe key-value pair is\nkey = a string label identifying the node\nvalue = a list of nodes to which this node connects. The first element of each list is the node key, and the subsequent items are the keys of the nodes to which this node connects\nExample :\n\n import pyladder.pyladder as pylad\n my_ladder = pylad.Pyladder()\n ladder_input = {'Part 10' : [10,20,30,40,50], 'Part 20' : [20,30,40,50], 'Part 30' : [30,40], 'Part 40' : [40,50], 'Finish' : [50]}\n if not my_ladder.display_graph_plot('dictionary input example', 'ladder step', ladder_input, True):\n print('Ladder is not planar')\n\nThe above code will return true or false according to the ladder planarity and will display as per below (see pyladder_client_dict_example.py for a full implementation example):\n\n
\n
\n
\n
\n
\n
\n