Repository navigation
Issue #89 - upgrade graphLib to match EAPS 5.1.0.0 - #113
Conversation
…parameters and return types (e.g. graph flags, embed flags, edge direction, DFS mode). Created workaround so that `__seed_rng()` function can still be called when one imports `planarity`, but use name mangling to ensure that library users can't `import planarity` or `from planarity import *` and access this private function. Updated sphinx docs generation so that we no longer include `__reduce_cython__()`, `__setstate_cython__()`, nor `__seed_rng()`; it turns out this was likely a `napoleon` extension issue with `napoleon_include_special_with_doc` (but I also set `napoleon_include_private_with_doc` to `False` as well). Also fixed issue with `unsigned` type not being recognized by sphinx (i.e. `nitpicky` config option was highlighting issue), so I added `nitpicky_ignore`. Now exposes `G6WriteIterator`'s `g6_SetOutputErrorFlag()` (which should be used if an error occurs during processing so that we clean up the .g6 output file upon freeing the writer, even if the issue wasn't with the writer itself), as well as `Graph`'s `gp_DynamicInsertEdge()`, `gp_ClearEdgeDirectionFlags()`, `gp_TransposeDirectedGraph()`, `gp_CountConnectedComponents()`, `gp_GetVisitedIndex()`, `gp_GetEmbedFlags()`, and `gp_GetObstructionMinorType()`. Also addressed `FIXME`s in `gp_IsDFSTreeRoot()`, `gp_IsNotDFSTreeRoot()`, and `gp_GetVertexFromBicompRoot()` now that the underlying macros don't rely on a private macro, `gp_GetVertexParent()`. Confirmed `pytest` ran, and that `examples\full\demo_specific_graph.py` worked for `nauty_example.g6` and `Petersen.0-based.txt`.
…df documentation. * Fully enumerate options returned by `gp_GetGraphFlags()`. * Fixed latexpdf build error due to unordered list depth * Fixed reference error (i.e. :py:meth:`mapping` should be :py:meth:`~planarity.express.planarity.PGraph.mapping`). * Updated unordered lists to use `-` rather than `*`, and use `:` instead of `-` within list items for further descriptions. * Changed some line lengths for comments. * Fixed some whitespace issues and issue with `#` comment not followed by a space highlighted by `cython-lint`. * Fixed some cross-references by searching for "See". * Added external link to planarity Issue #91 in docstring for `PGraph.draw()` I've noticed some issues rendering `make latexpdf`, namely that the first line of some list items is bolded, and noticed some issues with line breaks in `make html` output.
…, since we don't need to expose this function to users, and calling `srand()` from within `graphLib` module works to seed the random number generator at module initialization (only occurs once upon import).
Confirmed by:
- Running `examples/full/demo_random_int.py`
- In separate IDLE sessions:
- when I `import planarity` and then call `print(planarity.gp_GetRandomNumber(1, 10))` multiple times, the numbers are all different and don't follow a pattern
- when I call `from planarity import *` and call `print(gp_GetRandomNumber(1, 10))` multiple times, the numbers are all different and don't follow a pattern
john-boyer-phd
left a comment
There was a problem hiding this comment.
Looking great. Just a few minor changes. Most notable is need to add the face lister function.
|
Per discussion with @john-boyer-phd , flags should be considered as
(Note Also, all references in docstrings will have to be updated, and In EAPS, an upcoming issue will be created to change the types for
NOTE: Since This is all because Python doesn't natively have a notion of an unsigned integer (without using EDIT: Updates to |
…int` rather than `unsigned`/`unsigned int`/`uint`
…f constants surfaced from `graphPlanarity.h` to match header order.
… including incorrect signature in module docstring, removing unused imports, moving output directory creation until after successful embedding operation, and `graph_output_mode` shadowed scope warning.
…bed()` has not yet been called, so removing this TODO item.
john-boyer-phd
left a comment
There was a problem hiding this comment.
Looking great, all set!
Resolves #89
Co-authored with @john-boyer-phd
Type of change
Please check only relevant options:
Changes
Added
examples/full/demo_embedding_facelister.py- Demonstrates how to obtain the YAML representation of planar embedding's face list.Updated
doc/source/conf.pynapoleon_include_private_with_docandnapoleon_include_special_with_docset toFalseso that we no longer include magic methods coming from Cython compilation (e.g.__setstate_cython__(),__reduce_cython__()) nor private methods without docstrings.make latexpdfdue to max depth of unordered lists (i.e. addedlatex_elementsconfig formaxlistdepth, which must be at least 7 currently).planarity/__init__.pySplit out exposing
planarity.full.graphLib.gp_GetRandomNumber()fromplanarity.full.graphLib.gp_GetQuietMode()andplanarity.full.graphLib.gp_SetQuietMode(), since they're not conceptually related.Surfaced constants:
GRAPHFLAGS_DIRECTEDEDGEDETECTEDEDGE_TYPE_CROSSDFSUTILS_NAMEGRAPHFLAGS_EXTENDEDWITH_DFSUTILSGRAPHFLAGS_DFSNUMBEREDGRAPHFLAGS_SORTEDBYDFIGRAPHFLAGS_LOWPOINTSCOMPUTEDGRAPHFLAGS_DFSNUMBERED_DIRECTEDDFSMODE_UNDIRECTEDDFSMODE_DIRECTEDNOTE: @john-boyer-phd confirms that we will not surface
EMBEDFLAGS_SEARCHFORK5,EMBEDFLAGS_SEARCHFORK5MINOR,EMBEDFLAGS_MAXIMALPLANARSUBGRAPH,EMBEDFLAGS_PROJECTIVEPLANAR, norEMBEDFLAGS_TOROIDALat this timeRemoved call to "private"
planarity.full.graphLib.__seed_rng()(which has been removed), sincesrand()should now be called upongraphLibmodule initialization when users import (from)planaritypackage.Logs demonstrating efficacy of seeding the random number generator on graphLib module initialization
planarity/express/planarity.pyx-rather than*, and use:instead of-within list items for further descriptions.:py:meth:`mapping`should be:py:meth:`~planarity.express.planarity.PGraph.mapping`).doc/source/conf.py,latexpdfbuild error due to unordered list depth stemming fromPGraph.draw()docstring has been fixed.to end ofReturnsstatement forPGraph.ascii()docstringplanarity_functions.py-rather than*, and use:instead of-within list items for further descriptions.planarity/full/cgraphLib.pxdgp_DynamicInsertEdge()gp_ClearEdgeDirectionFlags()gp_TransposeDirectedGraph()g6_SetOutputErrorFlag()gp_DepthFirstSearchEx()(made sure signature expectsunsigned int)gp_CountConnectedComponents()gp_GetVisitedIndex()gp_IsDFSTreeRoot()(added now that this macro calls publicgp_GetParent()rather than privategp_GetVertexParent())gp_IsNotDFSTreeRoot()(see preceding)gp_GetVertexFromBicompRoot()(ditto)gp_CountEmbeddingFaces()gp_CreateEmbeddingFaceList()unsigned intor that returnunsigned int:gp_IsNeighborDirected()gp_FindDirectedEdge()gp_GetGraphFlags()gp_Embed()gp_GetObstructionMinorType()GRAPHFLAGS_DIRECTEDEDGEDETECTEDEDGE_TYPE_CROSSGRAPHFLAGS_LOWPOINTSCOMPUTEDGRAPHFLAGS_DFSNUMBERED_DIRECTEDDFSMODE_UNDIRECTEDDFSMODE_DIRECTEDgraphLibheadersgraphLib.pyx__seed_rng()function since we don't need to expose this function to users, andimport random+ callingsrand()from withingraphLibmodule works to seed the random number generator at module initialization (only occurs once upon import).cgraphLib.pxddefinition file:GRAPHFLAGS_DIRECTEDEDGEDETECTEDEDGE_TYPE_CROSSGRAPHFLAGS_LOWPOINTSCOMPUTEDGRAPHFLAGS_DFSNUMBERED_DIRECTEDDFSMODE_UNDIRECTEDDFSMODE_DIRECTEDgp_DynamicInsertEdge()gp_ClearEdgeDirectionFlags()gp_TransposeDirectedGraph()g6_SetOutputErrorFlag()gp_DepthFirstSearchEx()gp_CountConnectedComponents()gp_GetVisitedIndex()gp_IsDFSTreeRoot()gp_IsNotDFSTreeRoot()gp_GetVertexFromBicompRoot()gp_CountEmbeddingFaces()gp_CreateEmbeddingFaceList()unsigned intor that returnunsigned int:gp_IsNeighborDirected()gp_FindDirectedEdge()gp_Embed()gp_GetObstructionMinorType()graphLib.pxdgraph.pyxandg6IterationUtils.pyx):gp_DynamicInsertEdge()gp_ClearEdgeDirectionFlags()gp_TransposeDirectedGraph()g6_SetOutputErrorFlag()gp_DepthFirstSearchEx()gp_CountConnectedComponents()gp_GetVisitedIndex()gp_IsDFSTreeRoot()gp_IsNotDFSTreeRoot()gp_GetVertexFromBicompRoot()gp_CountEmbeddingFaces()gp_CreateEmbeddingFaceList()unsigned intor that returnunsigned int:gp_IsNeighborDirected()gp_FindDirectedEdge()gp_Embed()gp_GetObstructionMinorType()g6IterationUtils.pyx- added methodg6_SetOutputErrorFlag()to callgraphLib.pyxwrapper function (removed reference to EAPS PR #313 made using appropriate RST syntax within docstring due to this feedback).graph.pyxgraphLib.pyx(so that we don't have to reference them bygraphLib.XXXXwithin the module):GRAPHFLAGS_DIRECTEDEDGEDETECTEDVERTEX_VISITED_MASKVERTEX_MARKED_MASKEDGE_VISITED_MASKEDGE_MARKED_MASKEDGE_TYPE_MASKEDGE_TYPE_CROSSEDGEFLAG_INVERTED_MASKEDGEFLAG_DIRECTION_MASKDEFAULT_EDGE_CAPACITY_FACTORGRAPHFLAGS_ZEROBASEDIODFSUTILS_NAMEGRAPHFLAGS_EXTENDEDWITH_DFSUTILSGRAPHFLAGS_DFSNUMBEREDGRAPHFLAGS_SORTEDBYDFIGRAPHFLAGS_LOWPOINTSCOMPUTEDDFSMODE_UNDIRECTEDDFSMODE_DIRECTEDGRAPHFLAGS_DFSNUMBERED_DIRECTEDPLANARITY_NAMEGRAPHFLAGS_EXTENDEDWITH_PLANARITYMINORTYPE_NONEMINORTYPE_AMINORTYPE_BMINORTYPE_CMINORTYPE_DMINORTYPE_EMINORTYPE_E1MINORTYPE_E2MINORTYPE_E3MINORTYPE_E4MINORTYPE_E5MINORTYPE_E6MINORTYPE_E7OUTERPLANARITY_NAMEGRAPHFLAGS_EXTENDEDWITH_OUTERPLANARITYDRAWPLANAR_NAMEK23SEARCH_NAMEK33SEARCH_NAMEK4SEARCH_NAMEGraphclass ofgraphLib.pyxwrapper functions for C-layer functions with the same names, plus sensible docstrings:gp_DynamicInsertEdge()gp_ClearEdgeDirectionFlags()gp_TransposeDirectedGraph()g6_SetOutputErrorFlag()gp_DepthFirstSearchEx()gp_CountConnectedComponents()gp_GetVisitedIndex()gp_CountEmbeddingFaces()gp_CreateEmbeddingFaceList()gp_GetEmbedFlags()gp_GetObstructionMinorType()gp_IsDFSTreeRoot()gp_IsNotDFSTreeRoot()gp_GetVertexFromBicompRoot()unsigned intor that returnunsigned int:gp_IsNeighborDirected()gp_FindDirectedEdge()gp_Embed()gp_GetGraphFlags()to fully enumerate return values.EDGE_TYPE_CROSSas valid return type or parameter value forgp_GetEdgeType(),gp_SetEdgeType(),gp_ResetEdgeType()Fixed some whitespace issues and issue with
#comment not followed by a space highlighted bycython-lint.Across docstrings in all modules, fixed missing cross-references by searching for "See" (e.g.
gp_HideEdge(),gp_DepthFirstSearch())Tried to fixup
Raisesdocstring sections so that each possible way a given exception type can be raised is individually enumerated (e.ggp_WriteToString())NOTE: I've noticed some issues rendering
make latexpdf, namely that the first line of some list items is bolded, and noticed some issues with line breaks inmake htmloutput.Removed
Testing
__seed_rng()function fromplanarity.full.graphLibmodule, preferencing callingsrand()upon module initialization by:examples/full/demo_random_int.pyimport planarityand then callprint(planarity.gp_GetRandomNumber(1, 10))multiple times, the numbers are all different and don't follow a patternfrom planarity import *and callprint(gp_GetRandomNumber(1, 10))multiple times, the numbers are all different and don't follow a patternOutput from running examples/full/demo_embedding_facelister.py
Petersen.0-based.p.out.txt
nauty_example.face-list.yaml
nauty_example.p.out.txt
drawExample.face-list.yaml
drawExample.p.out.txt