Releases: opusonesolutions/asciigraf
ascii_string graph attribute
To provide useful error handling, asciigraf
generates error messages that hightlight bad edges using colour (see the highlight_bad_edge_characters
function).
For libraries that use asciigraf
, there may at times be value in being able to generate similar highlighting to provide more specific feedback related to the use-case (e.g. if a library has specific rules about how to name nodes and what the names imply, it would be useful to highlight invalid ones in an error message).
Including the ascii string as a graph attribute makes this functionality easier to build, since the calling code can reproduce the input text just by having the graph object produced by asciigraf
. Libraries can do things like defining a function to produce highlighting:
def highlight_node(asciigraf_obj: networkx.Graph, node: str) -> str:
...
def highlight_edge(asciigraf_obj: networkx.Graph, edge: Tuple[str, str]) -> str:
...
These functions can find the positions of node
or edge
using node / edge attributes on the input graph, and can reconstruct a highlighted textual version of the source asciigram. Without the change here, we would need to pass the ascii string separately.
Fix build
Version 1
Support for networkx 3.0
In version 2.6, networkx
deprecated OrderedGraph
since python dictionaries are ordered as of python 3.7, and thus Graph
already guarantees order in its implementation. In order to provide compatibility with networkx 3.0, when OrderedGraph
will not be available, we stop using OrderedGraph
for python versions newer than 3.7.
In addition, we switch from travis CI (RIP 💀 ) to Github Actions
More Node Characters
This release adds support for a much larger range of node characters; you can now use any character that isn't already recognized by asciigraf
as an edge character (\
, /
, -
), including single white-space characters.
Bob is my *favourite* friend--------------------------Betty isn't my friend at all
\
\
what is your name, 'frank' or something?
Add points to edges
Each edge now gets an extra edge attribute 'points' which contains the position of edge characters in it
- edge characters are always ordered from
n1
->n2
, wheren1
is in lower lexical position thenn2
if you read the asciigram left-right, top-bottom - the positions of any label characters that intersect the line are included
** for a horizontal label, all the characters will appear in the line
** for a vertical label, only the one that intersects with the edge will be included
One other change is that the data attached in 'positions' attribute for nodes and 'points' attribute for edges is no longer a special asciigraf
points object; it is just an (x, y) tuple. This is safer because it means that users of asciigraf won't accidentally depend on the functionality of this tuple, which is specifically designed to make parsing asciigrams easier.
Rewrite edge exploration to support all configurations
This release includes a complete rewrite of the edge exploring algorithm.
The rewrite adds support for edges like:
-----n2
|
n1
Fix vertical label bug
Bugs fixed:
- one character vertical labels not detected
Support for more corner types
Adds support for some extra corner configurations that were not handled before:
1-|
|
2
1
|
|--2
1
|
---2
networkx 2.x support
- Adds networkx 2.x support
- Implements release-from-tag functionality using travis ci