edgegraph.output.plaintext.basic_render#
- edgegraph.output.plaintext.basic_render(uni, rfunc=None, sort=None)#
Perform a very basic rendering of a graph into a string.
This function does not do any proper graph traversals; instead, simply works down the list of vertices in the given universe.
If specified,
rfuncshould be a callable object accepting one argument and returning a string. It will be given each vertex, and expected to return the user’s choice of how they wish that vertex to be rendered. Likewise, if specified,sortshould be a callable accepting one argument and returning a comparison key for use insorted().The intended usage is as follows:
>>> from edgegraph.builder import randgraph >>> from edgegraph.output import plaintext >>> graph = randgraph.randgraph() >>> asci = plaintext.basic_render(graph) >>> print(asci, rfunc=lambda v: v.i) 7 -> 5 4 -> 6 14 -> 14, 7, 13 11 -> 1, 11, 4 8 -> 14, 8 0 -> 12 3 -> 5 5 -> 0 12 -> 3, 1 1 -> 8 9 -> 4 6 -> 7 2 -> 13 10 -> 7, 10, 8 13 -> 7
Todo
figure out what to do to make this pass doctest… if graph is randomized, graph is different every time –> test fails