diff --git a/planarity/c/graphLib/extensionSystem/graphExtensions.c b/planarity/c/graphLib/extensionSystem/graphExtensions.c index 97cfa1e..2ea71c9 100644 --- a/planarity/c/graphLib/extensionSystem/graphExtensions.c +++ b/planarity/c/graphLib/extensionSystem/graphExtensions.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -108,31 +108,26 @@ static int moduleIDGenerator = 0; the graph, vertex or edge levels, then an overload of fpInitGraph() will be needed. - b) If any data must be associated with primary and virtual vertices, - then an overload of fpInitVertexRec() is needed. If data must be - associated only with primary vertices (0 to N-1), then one can - overload fpInitVertexInfo() instead. - The overload function should be named _Feature_InitVertexRec() - or _Feature_InitVertexInfo(). - It will invoke the base fpInitVertexRec() or fpInitVertexInfo() - but then also invoke a second function named _InitFeatureVertexRec() - or _InitFeatureVertexInfo() thatinitializes the custom VertexRec - or VertexInfo data members. - - c) If any data must be associated with the edges, then an overload - of fpInitEdgeRec() is needed. - This overload function should be named _Feature_InitEdgeRec(). - It will invoke the base fpInitEdgeRec() and also invoke - a second function named_InitFeatureEdgeRec() that - initializes the custom EdgeRec data members + b) If any data must be associated with vertices and virtual vertices, + then it is necessary to perform initialization parallel to the + initialization of anyTypeVertexRec instances. Similarly, if data + must be associated only with vertices (and not virtual vertices), + then initialization parallel to VertexInfo initialization is + required. At this time, there do not exist overloadable functions + for fpInitAnyTypeVertexRec() and fpInitVertexInfo(). + Instead, overload fpInitGraph() and fpReinitializeGraph(). Also + if an extension must delete an edge, it should have its own + + c) If any data must be associated with the edges, then the extension + creates a parallel array that is initialized and reinitialized + in overloads of fpInitGraph() and fpReinitializeGraph(). + Also, if the extension deletes edges, then the extension provides + its own _Feature_DeleteEdge() that initializes its edge + extension data along with calling gp_DeleteEdge(). d) If any graph-level data structures are needed, then an overload of fpReinitializeGraph() will also be needed, not just the - overload of fpInitGraph(). However, if only vertex-level and/or - edge level data members are needed, then the overloads of - fpInitVertexRec(), fpInitVertexInfo() and/or fpInitEdgeRec() are - invoked by the basic fpReinitializeGraph without needing to overload - it as well. + overload of fpInitGraph(). e) If any data must be persisted in the file format, then overloads of fpReadPostprocess() and fpWritePostprocess() are needed. @@ -154,15 +149,15 @@ static int moduleIDGenerator = 0; list collection, should be created _and_ initialized. c) The _Feature_InitStructures() should invoke just the functions - needed to initialize the custom VertexRec, VertexInfo and EdgeRec - data members, if any. + needed to initialize the custom AnyTypeVertexRec, VertexInfo and + EdgeRec data members, if any. 8) Define a function gp_DetachFeature() that invokes gp_RemoveExtension() This should be done for consistency, so that users of a feature do not attach it with gp_AttachFeature() and remove it with gp_RemoveExtension(). However, it may sometimes be necessary to run more code than just gp_RemoveExtension() when detaching a feature, - e.g. some final result values of a feature may be saved to data + e.g., some final result values of a feature may be saved to data available in the core graph or in other features. ********************************************************************/ diff --git a/planarity/c/graphLib/extensionSystem/graphExtensions.h b/planarity/c/graphLib/extensionSystem/graphExtensions.h index 21dc720..e6d1121 100644 --- a/planarity/c/graphLib/extensionSystem/graphExtensions.h +++ b/planarity/c/graphLib/extensionSystem/graphExtensions.h @@ -2,7 +2,7 @@ #define GRAPH_EXTENSIONS_H /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ diff --git a/planarity/c/graphLib/extensionSystem/graphExtensions.private.h b/planarity/c/graphLib/extensionSystem/graphExtensions.private.h index dc1e89d..b5afd2e 100644 --- a/planarity/c/graphLib/extensionSystem/graphExtensions.private.h +++ b/planarity/c/graphLib/extensionSystem/graphExtensions.private.h @@ -2,7 +2,7 @@ #define GRAPH_EXTENSIONS_PRIVATE_H /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ diff --git a/planarity/c/graphLib/extensionSystem/graphFunctionTable.h b/planarity/c/graphLib/extensionSystem/graphFunctionTable.h index bbc37df..c260205 100644 --- a/planarity/c/graphLib/extensionSystem/graphFunctionTable.h +++ b/planarity/c/graphLib/extensionSystem/graphFunctionTable.h @@ -2,7 +2,7 @@ #define GRAPHFUNCTIONTABLE_H /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ diff --git a/planarity/c/graphLib/graph.h b/planarity/c/graphLib/graph.h index 7ee07d7..984da37 100644 --- a/planarity/c/graphLib/graph.h +++ b/planarity/c/graphLib/graph.h @@ -2,7 +2,7 @@ #define GRAPH_H /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -62,12 +62,12 @@ extern "C" int gp_DynamicAddEdge(graphP theGraph, int u, int ulink, int v, int vlink); int gp_InsertEdge(graphP theGraph, int u, int e_u, int e_ulink, int v, int e_v, int e_vlink); + int gp_DeleteEdge(graphP theGraph, int e); void gp_HideEdge(graphP theGraph, int e); void gp_RestoreEdge(graphP theGraph, int e); int gp_HideVertex(graphP theGraph, int vertex); int gp_RestoreVertex(graphP theGraph); - int gp_DeleteEdge(graphP theGraph, int e, int nextLink); int gp_ContractEdge(graphP theGraph, int e); int gp_IdentifyVertices(graphP theGraph, int u, int v, int eBefore); @@ -77,13 +77,13 @@ extern "C" int gp_SortVertices(graphP theGraph); int gp_LowpointAndLeastAncestor(graphP theGraph); int gp_LeastAncestor(graphP theGraph); - int gp_PreprocessForEmbedding(graphP theGraph); int gp_Embed(graphP theGraph, int embedFlags); int gp_TestEmbedResultIntegrity(graphP theGraph, graphP origGraph, int embedResult); - /* Possible Flags for gp_Embed. The planar and outerplanar settings are supported - natively. The rest require extension modules. */ + /* Possible graph embedFlags for gp_Embed. + The planar and outerplanar settings are supported natively + The rest are supported via extension modules. */ #define EMBEDFLAGS_PLANAR 1 #define EMBEDFLAGS_OUTERPLANAR 2 @@ -94,8 +94,8 @@ extern "C" #define EMBEDFLAGS_SEARCHFORK4 (32 | EMBEDFLAGS_OUTERPLANAR) #define EMBEDFLAGS_SEARCHFORK33 (64 | EMBEDFLAGS_PLANAR) +// Reserved for the future possible extension modules #define EMBEDFLAGS_SEARCHFORK5 (128 | EMBEDFLAGS_PLANAR) - #define EMBEDFLAGS_MAXIMALPLANARSUBGRAPH 256 #define EMBEDFLAGS_PROJECTIVEPLANAR 512 #define EMBEDFLAGS_TOROIDAL 1024 diff --git a/planarity/c/graphLib/graphDFSUtils.c b/planarity/c/graphLib/graphDFSUtils.c index cd0677e..ac5b902 100644 --- a/planarity/c/graphLib/graphDFSUtils.c +++ b/planarity/c/graphLib/graphDFSUtils.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -12,7 +12,7 @@ See the LICENSE.TXT file for licensing information. int _SortVertices(graphP theGraph); // Imported methods -extern void _ClearVertexVisitedFlags(graphP theGraph, int); +extern void _ClearAnyTypeVertexVisitedFlags(graphP theGraph, int); /******************************************************************** gp_CreateDFSTree @@ -59,12 +59,12 @@ int gp_CreateDFSTree(graphP theGraph) sp_ClearStack(theStack); - _ClearVertexVisitedFlags(theGraph, FALSE); + _ClearAnyTypeVertexVisitedFlags(theGraph, FALSE); /* This outer loop causes the connected subgraphs of a disconnected graph to be numbered */ - for (DFI = v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, DFI); v++) + for (DFI = v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, DFI); v++) { if (gp_IsNotDFSTreeRoot(theGraph, v)) continue; @@ -73,16 +73,16 @@ int gp_CreateDFSTree(graphP theGraph) while (sp_NonEmpty(theStack)) { sp_Pop2(theStack, uparent, e); - u = gp_IsNotVertex(uparent) ? v : gp_GetNeighbor(theGraph, e); + u = gp_IsNotVertex(theGraph, uparent) ? v : gp_GetNeighbor(theGraph, e); - if (!gp_GetVertexVisited(theGraph, u)) + if (!gp_GetVisited(theGraph, u)) { gp_LogLine(gp_MakeLogStr3("V=%d, DFI=%d, Parent=%d", u, DFI, uparent)); - gp_SetVertexVisited(theGraph, u); - gp_SetVertexIndex(theGraph, u, DFI++); + gp_SetVisited(theGraph, u); + gp_SetIndex(theGraph, u, DFI++); gp_SetVertexParent(theGraph, u, uparent); - if (gp_IsArc(e)) + if (gp_IsArc(theGraph, e)) { gp_SetEdgeType(theGraph, e, EDGE_TYPE_CHILD); gp_SetEdgeType(theGraph, gp_GetTwinArc(theGraph, e), EDGE_TYPE_PARENT); @@ -92,9 +92,9 @@ int gp_CreateDFSTree(graphP theGraph) tree edges to children or forward arcs of back edges */ e = gp_GetFirstArc(theGraph, u); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { - if (!gp_GetVertexVisited(theGraph, gp_GetNeighbor(theGraph, e))) + if (!gp_GetVisited(theGraph, gp_GetNeighbor(theGraph, e))) sp_Push2(theStack, u, e); e = gp_GetNextArc(theGraph, e); } @@ -139,6 +139,9 @@ int gp_CreateDFSTree(graphP theGraph) int gp_SortVertices(graphP theGraph) { + if (theGraph == NULL) + return NOTOK; + return theGraph->functions.fpSortVertices(theGraph); } @@ -163,21 +166,21 @@ int _SortVertices(graphP theGraph) Also, if any links go back to locations 0 to n-1, then they need to be changed because we are reordering the vertices */ - EsizeOccupied = gp_EdgeInUseIndexBound(theGraph); + EsizeOccupied = gp_EdgeInUseArraySize(theGraph); for (e = gp_GetFirstEdge(theGraph); e < EsizeOccupied; e += 2) { if (gp_EdgeInUse(theGraph, e)) { - gp_SetNeighbor(theGraph, e, gp_GetVertexIndex(theGraph, gp_GetNeighbor(theGraph, e))); - gp_SetNeighbor(theGraph, e + 1, gp_GetVertexIndex(theGraph, gp_GetNeighbor(theGraph, e + 1))); + gp_SetNeighbor(theGraph, e, gp_GetIndex(theGraph, gp_GetNeighbor(theGraph, e))); + gp_SetNeighbor(theGraph, e + 1, gp_GetIndex(theGraph, gp_GetNeighbor(theGraph, e + 1))); } } /* Convert DFSParent from v to DFI(v) or vice versa */ - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) if (gp_IsNotDFSTreeRoot(theGraph, v)) - gp_SetVertexParent(theGraph, v, gp_GetVertexIndex(theGraph, gp_GetVertexParent(theGraph, v))); + gp_SetVertexParent(theGraph, v, gp_GetIndex(theGraph, gp_GetVertexParent(theGraph, v))); /* Sort by 'v using constant time random access. Move each vertex to its destination 'v', and store its source location in 'v'. */ @@ -187,7 +190,7 @@ int _SortVertices(graphP theGraph) location, so we cannot use index==v as a test for whether the correct vertex is in location 'index'. */ - _ClearVertexVisitedFlags(theGraph, FALSE); + _ClearAnyTypeVertexVisitedFlags(theGraph, FALSE); /* We visit each vertex location, skipping those marked as visited since we've already moved the correct vertex into that location. The @@ -196,18 +199,18 @@ int _SortVertices(graphP theGraph) location as visited, then sets its index to be the location from whence we obtained the vertex record. */ - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) { srcPos = v; - while (!gp_GetVertexVisited(theGraph, v)) + while (!gp_GetVisited(theGraph, v)) { - dstPos = gp_GetVertexIndex(theGraph, v); + dstPos = gp_GetIndex(theGraph, v); - gp_SwapVertexRec(theGraph, dstPos, theGraph, v); + gp_SwapAnyTypeVertexRec(theGraph, dstPos, theGraph, v); gp_SwapVertexInfo(theGraph, dstPos, theGraph, v); - gp_SetVertexVisited(theGraph, dstPos); - gp_SetVertexIndex(theGraph, dstPos, srcPos); + gp_SetVisited(theGraph, dstPos); + gp_SetIndex(theGraph, dstPos, srcPos); srcPos = dstPos; } @@ -254,12 +257,14 @@ int _SortVertices(graphP theGraph) int gp_LowpointAndLeastAncestor(graphP theGraph) { - stackP theStack = theGraph->theStack; + stackP theStack = NULL; int v, u, uneighbor, e, L, leastAncestor; if (theGraph == NULL) return NOTOK; + theStack = theGraph->theStack; + if (!(theGraph->internalFlags & FLAGS_DFSNUMBERED)) if (gp_CreateDFSTree(theGraph) != OK) return NOTOK; @@ -282,12 +287,12 @@ int gp_LowpointAndLeastAncestor(graphP theGraph) sp_ClearStack(theStack); - _ClearVertexVisitedFlags(theGraph, FALSE); + _ClearAnyTypeVertexVisitedFlags(theGraph, FALSE); // This outer loop causes the connected subgraphs of a disconnected graph to be processed - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v);) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v);) { - if (gp_GetVertexVisited(theGraph, v)) + if (gp_GetVisited(theGraph, v)) { ++v; continue; @@ -299,16 +304,16 @@ int gp_LowpointAndLeastAncestor(graphP theGraph) sp_Pop(theStack, u); // If not visited, then we're on the pre-order visitation, so push u and its DFS children - if (!gp_GetVertexVisited(theGraph, u)) + if (!gp_GetVisited(theGraph, u)) { // Mark u as visited, then push it back on the stack - gp_SetVertexVisited(theGraph, u); + gp_SetVisited(theGraph, u); ++v; sp_Push(theStack, u); // Push the DFS children of u e = gp_GetFirstArc(theGraph, u); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) { @@ -327,7 +332,7 @@ int gp_LowpointAndLeastAncestor(graphP theGraph) // Compute leastAncestor and L, the least lowpoint from the DFS children e = gp_GetFirstArc(theGraph, u); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { uneighbor = gp_GetNeighbor(theGraph, e); if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) @@ -377,12 +382,14 @@ int gp_LowpointAndLeastAncestor(graphP theGraph) int gp_LeastAncestor(graphP theGraph) { - stackP theStack = theGraph->theStack; + stackP theStack = NULL; int v, u, uneighbor, e, leastAncestor; if (theGraph == NULL) return NOTOK; + theStack = theGraph->theStack; + if (!(theGraph->internalFlags & FLAGS_DFSNUMBERED)) if (gp_CreateDFSTree(theGraph) != OK) return NOTOK; @@ -405,9 +412,9 @@ int gp_LeastAncestor(graphP theGraph) sp_ClearStack(theStack); // This outer loop causes the connected subgraphs of a disconnected graph to be processed - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v);) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v);) { - if (gp_GetVertexVisited(theGraph, v)) + if (gp_GetVisited(theGraph, v)) { ++v; continue; @@ -418,14 +425,14 @@ int gp_LeastAncestor(graphP theGraph) { sp_Pop(theStack, u); - if (!gp_GetVertexVisited(theGraph, u)) + if (!gp_GetVisited(theGraph, u)) { - gp_SetVertexVisited(theGraph, u); + gp_SetVisited(theGraph, u); ++v; leastAncestor = u; e = gp_GetFirstArc(theGraph, u); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { uneighbor = gp_GetNeighbor(theGraph, e); if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) diff --git a/planarity/c/graphLib/graphLib.h b/planarity/c/graphLib/graphLib.h index dfd5daf..608ef3b 100644 --- a/planarity/c/graphLib/graphLib.h +++ b/planarity/c/graphLib/graphLib.h @@ -2,7 +2,7 @@ #define GRAPHLIB_H /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -37,7 +37,7 @@ extern "C" #define GP_PROJECTVERSION_MAJOR 4 #define GP_PROJECTVERSION_MINOR 0 -#define GP_PROJECTVERSION_MAINT 1 +#define GP_PROJECTVERSION_MAINT 2 #define GP_PROJECTVERSION_TWEAK 0 char *gp_GetProjectVersionFull(void); @@ -46,9 +46,9 @@ extern "C" // shared library version numbers below. // // See configure.ac for how to update these version numbers -#define GP_LIBPLANARITYVERSION_CURRENT 3 +#define GP_LIBPLANARITYVERSION_CURRENT 4 #define GP_LIBPLANARITYVERSION_REVISION 0 -#define GP_LIBPLANARITYVERSION_AGE 1 +#define GP_LIBPLANARITYVERSION_AGE 0 char *gp_GetLibPlanarityVersionFull(void); diff --git a/planarity/c/graphLib/graphStructures.h b/planarity/c/graphLib/graphStructures.h index 9ccbbad..0e5cda7 100644 --- a/planarity/c/graphLib/graphStructures.h +++ b/planarity/c/graphLib/graphStructures.h @@ -2,7 +2,7 @@ #define GRAPHSTRUCTURE_H /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -65,19 +65,42 @@ extern "C" typedef edgeRec *edgeRecP; #ifdef USE_FASTER_1BASEDARRAYS -#define gp_IsArc(e) (e) -#define gp_IsNotArc(e) (!(e)) + +#ifndef DEBUG +#define gp_IsArc(theGraph, e) (e) +#else +#define gp_IsArc(theGraph, e) \ + ((e) == NIL \ + ? 0 \ + : ((e) < gp_GetFirstEdge(theGraph) || (e) >= gp_EdgeArraySize(theGraph) \ + ? (NOTOK, 0) \ + : 1)) +#endif + +#define gp_IsNotArc(theGraph, e) (!(e)) #define gp_GetFirstEdge(theGraph) (2) + +#else // When using slower 0-based Arrays + +#ifndef DEBUG +#define gp_IsArc(theGraph, e) ((e) != NIL) #else -#define gp_IsArc(e) ((e) != NIL) -#define gp_IsNotArc(e) ((e) == NIL) +#define gp_IsArc(theGraph, e) \ + ((e) == NIL \ + ? 0 \ + : ((e) < gp_GetFirstEdge(theGraph) || (e) >= gp_EdgeArraySize(theGraph) \ + ? (NOTOK, 0) \ + : 1)) +#endif + +#define gp_IsNotArc(theGraph, e) ((e) == NIL) #define gp_GetFirstEdge(theGraph) (0) #endif -#define gp_EdgeInUse(theGraph, e) (gp_IsVertex(gp_GetNeighbor(theGraph, e))) -#define gp_EdgeNotInUse(theGraph, e) (gp_IsNotVertex(gp_GetNeighbor(theGraph, e))) -#define gp_EdgeIndexBound(theGraph) (gp_GetFirstEdge(theGraph) + (theGraph)->arcCapacity) -#define gp_EdgeInUseIndexBound(theGraph) (gp_GetFirstEdge(theGraph) + (((theGraph)->M + sp_GetCurrentSize((theGraph)->edgeHoles)) << 1)) +#define gp_EdgeInUse(theGraph, e) (gp_IsAnyTypeVertex(theGraph, gp_GetNeighbor(theGraph, e))) +#define gp_EdgeNotInUse(theGraph, e) (gp_IsNotAnyTypeVertex(theGraph, gp_GetNeighbor(theGraph, e))) +#define gp_EdgeArraySize(theGraph) (gp_GetFirstEdge(theGraph) + (theGraph)->arcCapacity) +#define gp_EdgeInUseArraySize(theGraph) (gp_GetFirstEdge(theGraph) + (((theGraph)->M + sp_GetCurrentSize((theGraph)->edgeHoles)) << 1)) // An edge is represented by two consecutive edge records (arcs) in the edge array E. // If an even number, xor 1 will add one; if an odd number, xor 1 will subtract 1 @@ -113,6 +136,7 @@ extern "C" // EDGE_TYPE_FORWARD - edge record is an arc to a DFS descendant, not a DFS child // EDGE_TYPE_PARENT - edge record is an arc to the DFS parent // EDGE_TYPE_BACK - edge record is an arc to a DFS ancestor, not the DFS parent +// NOTE: A parent/child tree arcs have bit 2 (4) set, forward/back arcs do not #define EDGE_TYPE_CHILD 14 #define EDGE_TYPE_FORWARD 10 #define EDGE_TYPE_PARENT 6 @@ -163,10 +187,19 @@ extern "C" } \ } +// Definition and accessors for the edge marked flag +// Essentially, this is a second visitation flag that can help applications that +// must visit all edges to analyze and mark the ones important for some purpose. +#define EDGE_MARKED_MASK 128 +#define gp_GetEdgeMarked(theGraph, e) (theGraph->E[e].flags & EDGE_MARKED_MASK) +#define gp_ClearEdgeMarked(theGraph, e) (theGraph->E[e].flags &= ~EDGE_MARKED_MASK) +#define gp_SetEdgeMarked(theGraph, e) (theGraph->E[e].flags |= EDGE_MARKED_MASK) + +// Fast utility routine for copying edge records #define gp_CopyEdgeRec(dstGraph, edst, srcGraph, esrc) (dstGraph->E[edst] = srcGraph->E[esrc]) /******************************************************************** - Vertex Record Definition + Vertex Record Definition (Any Type of Vertex) This record definition provides the data members needed for the core structural information for both vertices and virtual vertices. @@ -175,8 +208,8 @@ extern "C" The vertices of a graph are stored in the first N locations of array V. Virtual vertices are secondary vertices used to help represent the - main vertices in substructural components of a graph (e.g. biconnected - components). + main vertices in substructural components of a graph (such as in + biconnected components). link[2]: the first and last edge records (arcs) in the adjacency list of the vertex. @@ -204,11 +237,13 @@ extern "C" int link[2]; int index; unsigned flags; - } vertexRec; + } anyTypeVertexRec; - typedef vertexRec *vertexRecP; + typedef anyTypeVertexRec *anyTypeVertexRecP; +//////////////////////////////////////////// // Accessors for vertex adjacency list links +//////////////////////////////////////////// #define gp_GetFirstArc(theGraph, v) (theGraph->V[v].link[0]) #define gp_GetLastArc(theGraph, v) (theGraph->V[v].link[1]) #define gp_GetArc(theGraph, v, theLink) (theGraph->V[v].link[theLink]) @@ -217,104 +252,209 @@ extern "C" #define gp_SetLastArc(theGraph, v, newLastArc) (theGraph->V[v].link[1] = newLastArc) #define gp_SetArc(theGraph, v, theLink, newArc) (theGraph->V[v].link[theLink] = newArc) -// Vertex conversions and iteration +/////////////////////////////////// +// Vertex iteration-related methods +/////////////////////////////////// #ifdef USE_FASTER_1BASEDARRAYS -#define gp_IsVertex(v) (v) -#define gp_IsNotVertex(v) (!(v)) + + // The use of *Vertex* alone consistently refers to the initial N vertices. + // The use of *VirtualVertex* refers to vertex array locations after the first N. + // The use of *AnyTypeVertex* refers to any non-virtual or virtual vertex #define gp_GetFirstVertex(theGraph) (1) #define gp_GetLastVertex(theGraph) ((theGraph)->N) -#define gp_VertexInRange(theGraph, v) ((v) <= (theGraph)->N) -#define gp_VertexInRangeDescending(theGraph, v) (v) -#define gp_PrimaryVertexIndexBound(theGraph) (gp_GetFirstVertex(theGraph) + (theGraph)->N) -#define gp_VertexIndexBound(theGraph) (gp_PrimaryVertexIndexBound(theGraph) + (theGraph)->N) +#define gp_GetFirstVirtualVertex(theGraph) ((theGraph)->N + 1) +#define gp_GetLastVirtualVertex(theGraph) ((theGraph)->N + (theGraph)->NV) -#define gp_IsVirtualVertex(theGraph, v) ((v) > theGraph->N) -#define gp_IsNotVirtualVertex(theGraph, v) ((v) <= theGraph->N) -#define gp_VirtualVertexInUse(theGraph, virtualVertex) (gp_IsArc(gp_GetFirstArc(theGraph, virtualVertex))) -#define gp_VirtualVertexNotInUse(theGraph, virtualVertex) (gp_IsNotArc(gp_GetFirstArc(theGraph, virtualVertex))) -#define gp_GetFirstVirtualVertex(theGraph) (theGraph->N + 1) -#define gp_GetLastVirtualVertex(theGraph) (theGraph->N + theGraph->NV) -#define gp_VirtualVertexInRange(theGraph, v) ((v) <= theGraph->N + theGraph->NV) +#define gp_GetFirstAnyTypeVertex(theGraph) (gp_GetFirstVertex(theGraph)) +#define gp_GetLastAnyTypeVertex(theGraph) (gp_GetLastVirtualVertex(theGraph)) + +#ifndef DEBUG +#define gp_IsVertex(theGraph, v) (v) +#define gp_IsVirtualVertex(theGraph, v) ((v) > (theGraph)->N) +#define gp_IsAnyTypeVertex(theGraph, v) (v) #else -#define gp_IsVertex(v) ((v) != NIL) -#define gp_IsNotVertex(v) ((v) == NIL) +#define gp_IsVertex(theGraph, v) \ + ((v) == NIL ? 0 : ((v) < gp_GetFirstVertex(theGraph) ? (NOTOK, 0) : ((v) > gp_GetLastVertex(theGraph) ? (NOTOK, 0) : 1))) + +// NOTE: gp_IsVirtualVertex() is sometimes called to distinguish between +// an existing non-virtual and a virtual +#define gp_IsVirtualVertex(theGraph, v) \ + ((v) == NIL \ + ? 0 \ + : ((v) < gp_GetFirstVirtualVertex(theGraph) \ + ? ((v) < gp_GetFirstVertex(theGraph) ? (NOTOK, 0) : 0) \ + : ((v) > gp_GetLastVirtualVertex(theGraph) ? (NOTOK, 0) : 1))) + +#define gp_IsAnyTypeVertex(theGraph, v) \ + ((v) == NIL \ + ? 0 \ + : ((v) < gp_GetFirstAnyTypeVertex(theGraph) \ + ? (NOTOK, 0) \ + : ((v) > gp_GetLastAnyTypeVertex(theGraph) ? (NOTOK, 0) : 1))) + +#endif + +#define gp_IsNotVertex(theGraph, v) (!(gp_IsVertex(theGraph, v))) +#define gp_IsNotVirtualVertex(theGraph, v) (!(gp_IsVirtualVertex(theGraph, v))) +#define gp_IsNotAnyTypeVertex(theGraph, v) (!(gp_IsAnyTypeVertex(theGraph, v))) + +#define gp_VertexInRangeAscending(theGraph, v) ((v) <= (theGraph)->N) +#define gp_VertexInRangeDescending(theGraph, v) (v) + +#define gp_VirtualVertexInRangeAscending(theGraph, v) ((v) <= (theGraph)->N + (theGraph)->NV) +#define gp_VirtualVertexInRangeDescending(theGraph, v) ((v) > (theGraph)->N) + +#define gp_AnyTypeVertexInRangeAscending(theGraph, v) (gp_VirtualVertexInRangeAscending(theGraph, v)) +#define gp_AnyTypeVertexInRangeDescending(theGraph, v) (gp_VirtualVertexInRangeDescending(theGraph, v)) + +#define gp_VertexArraySize(theGraph) (gp_GetFirstVertex(theGraph) + (theGraph)->N) +#define gp_AnyTypeVertexArraySize(theGraph) (gp_VertexArraySize(theGraph) + (theGraph)->NV) + +#define gp_VirtualVertexInUse(theGraph, virtualVertex) (gp_IsArc(theGraph, gp_GetFirstArc(theGraph, virtualVertex))) +#define gp_VirtualVertexNotInUse(theGraph, virtualVertex) (gp_IsNotArc(theGraph, gp_GetFirstArc(theGraph, virtualVertex))) + +#else // Using Slower 0-based Arrays #define gp_GetFirstVertex(theGraph) (0) #define gp_GetLastVertex(theGraph) ((theGraph)->N - 1) -#define gp_VertexInRange(theGraph, v) ((v) < (theGraph)->N) -#define gp_VertexInRangeDescending(theGraph, v) ((v) >= 0) -#define gp_PrimaryVertexIndexBound(theGraph) (gp_GetFirstVertex(theGraph) + (theGraph)->N) -#define gp_VertexIndexBound(theGraph) (gp_PrimaryVertexIndexBound(theGraph) + (theGraph)->N) +#define gp_GetFirstVirtualVertex(theGraph) ((theGraph)->N) +#define gp_GetLastVirtualVertex(theGraph) ((theGraph)->N + (theGraph)->NV - 1) + +#define gp_GetFirstAnyTypeVertex(theGraph) (gp_GetFirstVertex(theGraph)) +#define gp_GetLastAnyTypeVertex(theGraph) (gp_GetLastVirtualVertex(theGraph)) -#define gp_IsVirtualVertex(theGraph, v) ((v) >= theGraph->N) -#define gp_IsNotVirtualVertex(theGraph, v) ((v) < theGraph->N) -#define gp_VirtualVertexInUse(theGraph, virtualVertex) (gp_IsArc(gp_GetFirstArc(theGraph, virtualVertex))) -#define gp_VirtualVertexNotInUse(theGraph, virtualVertex) (gp_IsNotArc(gp_GetFirstArc(theGraph, virtualVertex))) -#define gp_GetFirstVirtualVertex(theGraph) (theGraph->N) -#define gp_GetLastVirtualVertex(theGraph) (theGraph->N + theGraph->NV - 1) -#define gp_VirtualVertexInRange(theGraph, v) ((v) < theGraph->N + theGraph->NV) +#ifndef DEBUG +#define gp_IsVertex(theGraph, v) ((v) != NIL) +#define gp_IsVirtualVertex(theGraph, v) ((v) >= (theGraph)->N) +#define gp_IsAnyTypeVertex(theGraph, v) ((v) != NIL) +#else +#define gp_IsVertex(theGraph, v) \ + ((v) == NIL ? 0 : ((v) < gp_GetFirstVertex(theGraph) ? (NOTOK, 0) : ((v) > gp_GetLastVertex(theGraph) ? (NOTOK, 0) : 1))) + +#define gp_IsVirtualVertex(theGraph, v) \ + ((v) == NIL \ + ? 0 \ + : ((v) < gp_GetFirstVirtualVertex(theGraph) \ + ? ((v) < gp_GetFirstVertex(theGraph) ? (NOTOK, 0) : 0) \ + : ((v) > gp_GetLastVirtualVertex(theGraph) ? (NOTOK, 0) : 1))) + +#define gp_IsAnyTypeVertex(theGraph, v) \ + ((v) == NIL ? 0 : ((v) < gp_GetFirstAnyTypeVertex(theGraph) ? (NOTOK, 0) : ((v) > gp_GetLastAnyTypeVertex(theGraph) ? (NOTOK, 0) : 1))) #endif -#define gp_GetRootFromDFSChild(theGraph, c) ((c) + theGraph->N) -#define gp_GetDFSChildFromRoot(theGraph, R) ((R) - theGraph->N) -#define gp_GetPrimaryVertexFromRoot(theGraph, R) gp_GetVertexParent(theGraph, gp_GetDFSChildFromRoot(theGraph, R)) - -#define gp_IsSeparatedDFSChild(theGraph, theChild) (gp_VirtualVertexInUse(theGraph, gp_GetRootFromDFSChild(theGraph, theChild))) -#define gp_IsNotSeparatedDFSChild(theGraph, theChild) (gp_VirtualVertexNotInUse(theGraph, gp_GetRootFromDFSChild(theGraph, theChild))) - -#define gp_IsDFSTreeRoot(theGraph, v) gp_IsNotVertex(gp_GetVertexParent(theGraph, v)) -#define gp_IsNotDFSTreeRoot(theGraph, v) gp_IsVertex(gp_GetVertexParent(theGraph, v)) - -// Accessors for vertex index -#define gp_GetVertexIndex(theGraph, v) (theGraph->V[v].index) -#define gp_SetVertexIndex(theGraph, v, theIndex) (theGraph->V[v].index = theIndex) - -// Initializer for vertex flags -#define gp_InitVertexFlags(theGraph, v) (theGraph->V[v].flags = 0) - -// Definitions and accessors for vertex flags -#define VERTEX_VISITED_MASK 1 -#define gp_GetVertexVisited(theGraph, v) (theGraph->V[v].flags & VERTEX_VISITED_MASK) -#define gp_ClearVertexVisited(theGraph, v) (theGraph->V[v].flags &= ~VERTEX_VISITED_MASK) -#define gp_SetVertexVisited(theGraph, v) (theGraph->V[v].flags |= VERTEX_VISITED_MASK) - -// The obstruction type is defined by bits 1-3, 2+4+8=14 -// Bit 1 - 2 if type set, 0 if not -// Bit 2 - 4 if Y side, 0 if X side -// Bit 3 - 8 if high, 0 if low -#define VERTEX_OBSTRUCTIONTYPE_MASK 14 - -// Call gp_GetVertexObstructionType, then compare to one of these four possibilities -// VERTEX_OBSTRUCTIONTYPE_HIGH_RXW - On the external face path between vertices R and X -// VERTEX_OBSTRUCTIONTYPE_LOW_RXW - X or on the external face path between vertices X and W -// VERTEX_OBSTRUCTIONTYPE_HIGH_RYW - On the external face path between vertices R and Y -// VERTEX_OBSTRUCTIONTYPE_LOW_RYW - Y or on the external face path between vertices Y and W -// VERTEX_OBSTRUCTIONTYPE_UNKNOWN - corresponds to all three bits off -#define VERTEX_OBSTRUCTIONTYPE_HIGH_RXW 10 -#define VERTEX_OBSTRUCTIONTYPE_LOW_RXW 2 -#define VERTEX_OBSTRUCTIONTYPE_HIGH_RYW 14 -#define VERTEX_OBSTRUCTIONTYPE_LOW_RYW 6 -#define VERTEX_OBSTRUCTIONTYPE_UNKNOWN 0 - -#define VERTEX_OBSTRUCTIONTYPE_MARKED 2 -#define VERTEX_OBSTRUCTIONTYPE_UNMARKED 0 - -#define gp_GetVertexObstructionType(theGraph, v) (theGraph->V[v].flags & VERTEX_OBSTRUCTIONTYPE_MASK) -#define gp_ClearVertexObstructionType(theGraph, v) (theGraph->V[v].flags &= ~VERTEX_OBSTRUCTIONTYPE_MASK) -#define gp_SetVertexObstructionType(theGraph, v, type) (theGraph->V[v].flags |= type) -#define gp_ResetVertexObstructionType(theGraph, v, type) \ - (theGraph->V[v].flags = (theGraph->V[v].flags & ~VERTEX_OBSTRUCTIONTYPE_MASK) | type) - -#define gp_CopyVertexRec(dstGraph, vdst, srcGraph, vsrc) (dstGraph->V[vdst] = srcGraph->V[vsrc]) - -#define gp_SwapVertexRec(dstGraph, vdst, srcGraph, vsrc) \ - { \ - vertexRec tempV = dstGraph->V[vdst]; \ - dstGraph->V[vdst] = srcGraph->V[vsrc]; \ - srcGraph->V[vsrc] = tempV; \ +#define gp_IsNotVertex(theGraph, v) (!(gp_IsVertex(theGraph, v))) +#define gp_IsNotVirtualVertex(theGraph, v) (!(gp_IsVirtualVertex(theGraph, v))) +#define gp_IsNotAnyTypeVertex(theGraph, v) (!(gp_IsAnyTypeVertex(theGraph, v))) + +#define gp_VertexInRangeAscending(theGraph, v) ((v) < (theGraph)->N) +#define gp_VertexInRangeDescending(theGraph, v) ((v) >= 0) + +#define gp_VirtualVertexInRangeAscending(theGraph, v) ((v) < (theGraph)->N + (theGraph)->NV) +#define gp_VirtualVertexInRangeDescending(theGraph, v) ((v) >= (theGraph)->N) + +#define gp_AnyTypeVertexInRangeAscending(theGraph, v) (gp_VirtualVertexInRangeAscending(theGraph, v)) +#define gp_AnyTypeVertexInRangeDescending(theGraph, v) (gp_VirtualVertexInRangeDescending(theGraph, v)) + +#define gp_VertexArraySize(theGraph) (gp_GetFirstVertex(theGraph) + (theGraph)->N) +#define gp_AnyTypeVertexArraySize(theGraph) (gp_VertexArraySize(theGraph) + (theGraph)->NV) + +#define gp_VirtualVertexInUse(theGraph, virtualVertex) (gp_IsArc(theGraph, gp_GetFirstArc(theGraph, virtualVertex))) +#define gp_VirtualVertexNotInUse(theGraph, virtualVertex) (gp_IsNotArc(theGraph, gp_GetFirstArc(theGraph, virtualVertex))) + +#endif + /////////////////////////////////////////// + // End of Vertex iteration-related methods + ////////////////////////////////////////// + +// Mapping between bicomp roots and virtual vertex locations used to store them. +// A cut vertex v separates one or more of its DFS children, say c1 and c2, from +// the DFS parent and ancesstors of v. Because a DFS tree contains only tree edges +// and back edges, there are no cross edges connecting vertices in the DFS subtree +// rooted by c1, T(c1), with vertices in the DFS subtree rooted by c2, T(c2). +// We say that v is a cut vertex because the only paths that go from vertices in +// T(c1) to vertices in T(c2) are paths that contain v. +// Therefore, bicomp root copies of v, say R1 and R2, can be created at locations +// c1 and c2 in virtual vertex space, in other words at locations N+c1 and N+c2. +// The bicomps rooted by R1 and R2 are called child bicomps of v, and they contain, +// respectively, c1 and c2 as well as possibly more vertices from, respectively, +// T(c1) and T(c2), depending on what back edges may exist in the graph between +// pairs of vertices in, respectively, T(c1) and T(c2). +#define gp_GetBicompRootFromDFSChild(theGraph, c) ((c) + theGraph->N) +#define gp_GetDFSChildFromBicompRoot(theGraph, R) ((R) - theGraph->N) +#define gp_GetVertexFromBicompRoot(theGraph, R) gp_GetVertexParent(theGraph, gp_GetDFSChildFromBicompRoot(theGraph, R)) + +// If a vertex v is a cut vertex that separates one of its DFS children, say c, +// from the DFS ancestors and other children of v, then when the graph has been +// separated into bicomps, there will be a root copy of v in virtual vertex space +// at location c+N that will have at least one edge connecting it to c. +// These macros detect whether or not that is the case for a given DFS child. +#define gp_IsSeparatedDFSChild(theGraph, theChild) (gp_VirtualVertexInUse(theGraph, gp_GetBicompRootFromDFSChild(theGraph, theChild))) +#define gp_IsNotSeparatedDFSChild(theGraph, theChild) (gp_VirtualVertexNotInUse(theGraph, gp_GetBicompRootFromDFSChild(theGraph, theChild))) + +// A DFS tree root is one that has no DFS parent. There is one DFS tree root +// per connected component of a graph (connected, not biconnected; component, not bicomp) +#define gp_IsDFSTreeRoot(theGraph, v) gp_IsNotVertex(theGraph, gp_GetVertexParent(theGraph, v)) +#define gp_IsNotDFSTreeRoot(theGraph, v) gp_IsVertex(theGraph, gp_GetVertexParent(theGraph, v)) + +// Accessors for "any type" vertex index +#define gp_GetIndex(theGraph, v) (theGraph->V[v].index) +#define gp_SetIndex(theGraph, v, theIndex) (theGraph->V[v].index = theIndex) + +// Initializer for "any type" vertex flags +#define gp_InitFlags(theGraph, v) (theGraph->V[v].flags = 0) + +// Definition and accessors for the "any type" vertex visited flag +#define ANYTYPEVERTEX_VISITED_MASK 1 +#define gp_GetVisited(theGraph, v) (theGraph->V[v].flags & ANYTYPEVERTEX_VISITED_MASK) +#define gp_ClearVisited(theGraph, v) (theGraph->V[v].flags &= ~ANYTYPEVERTEX_VISITED_MASK) +#define gp_SetVisited(theGraph, v) (theGraph->V[v].flags |= ANYTYPEVERTEX_VISITED_MASK) + +// Definition and accessors for the "any type" vertex marked flag +// Essentially, this is a second visitation flag that can help applications that +// must visit all vertices to analyze and mark the ones important for some purpose. +#define ANYTYPEVERTEX_MARKED_MASK 2 +#define gp_GetMarked(theGraph, v) (theGraph->V[v].flags & ANYTYPEVERTEX_MARKED_MASK) +#define gp_ClearMarked(theGraph, v) (theGraph->V[v].flags &= ~ANYTYPEVERTEX_MARKED_MASK) +#define gp_SetMarked(theGraph, v) (theGraph->V[v].flags |= ANYTYPEVERTEX_MARKED_MASK) + +// The ANYVERTEX_OBSTRUCTIONMARK_MASK bits are bits 2-4, 4+8+16=28 +// They are used by planarity-related algorithms to identify the four +// regions of the external face cycle of a bicomp, relative to an +// XY-path in the bicomp. +// Bit 2 - 4 if the OBSTRUCTIONMARK is set, 0 if not +// Bit 3 - 8 if the OBSTRUCTIONMARK indicates Y side, 0 if X side +// Bit 4 - 16 if the OBSTRUCTIONMARK indicates high, 0 if low +#define ANYVERTEX_OBSTRUCTIONMARK_MASK 28 + +// Call gp_GetObstructionMark, then compare to one of these four possibilities +// ANYVERTEX_OBSTRUCTIONMARK_HIGH_RXW - On the external face path between vertices R and X +// ANYVERTEX_OBSTRUCTIONMARK_LOW_RXW - X or on the external face path between vertices X and W +// ANYVERTEX_OBSTRUCTIONMARK_HIGH_RYW - On the external face path between vertices R and Y +// ANYVERTEX_OBSTRUCTIONMARK_LOW_RYW - Y or on the external face path between vertices Y and W +// ANYVERTEX_OBSTRUCTIONMARK_UNMARKED - corresponds to all three bits off +#define ANYVERTEX_OBSTRUCTIONMARK_HIGH_RXW 20 +#define ANYVERTEX_OBSTRUCTIONMARK_LOW_RXW 4 +#define ANYVERTEX_OBSTRUCTIONMARK_HIGH_RYW 28 +#define ANYVERTEX_OBSTRUCTIONMARK_LOW_RYW 12 +#define ANYVERTEX_OBSTRUCTIONMARK_UNMARKED 0 + +#define gp_GetObstructionMark(theGraph, v) (theGraph->V[v].flags & ANYVERTEX_OBSTRUCTIONMARK_MASK) +#define gp_ClearObstructionMark(theGraph, v) (theGraph->V[v].flags &= ~ANYVERTEX_OBSTRUCTIONMARK_MASK) +#define gp_SetObstructionMark(theGraph, v, type) (theGraph->V[v].flags |= type) +#define gp_ResetObstructionMark(theGraph, v, type) \ + (theGraph->V[v].flags = (theGraph->V[v].flags & ~ANYVERTEX_OBSTRUCTIONMARK_MASK) | type) + +// Fast utility routines for "any type" vertex records +#define gp_CopyAnyTypeVertexRec(dstGraph, vdst, srcGraph, vsrc) (dstGraph->V[vdst] = srcGraph->V[vsrc]) + +#define gp_SwapAnyTypeVertexRec(dstGraph, vdst, srcGraph, vsrc) \ + { \ + anyTypeVertexRec tempV = dstGraph->V[vdst]; \ + dstGraph->V[vdst] = srcGraph->V[vsrc]; \ + srcGraph->V[vsrc] = tempV; \ } /******************************************************************** @@ -343,7 +483,7 @@ extern "C" /******************************************************************** Vertex Info Structure Definition. - This structure equips the primary (non-virtual) vertices with additional + This structure equips the non-virtual vertices with additional information needed for lowpoint and planarity-related algorithms. parent: The DFI of the DFS tree parent of this vertex @@ -420,31 +560,37 @@ extern "C" #define gp_GetVertexPertinentRootsList(theGraph, v) (theGraph->VI[v].pertinentRoots) #define gp_SetVertexPertinentRootsList(theGraph, v, pertinentRootsHead) (theGraph->VI[v].pertinentRoots = pertinentRootsHead) -#define gp_GetVertexFirstPertinentRoot(theGraph, v) gp_GetRootFromDFSChild(theGraph, theGraph->VI[v].pertinentRoots) +#define gp_GetVertexFirstPertinentRoot(theGraph, v) gp_GetBicompRootFromDFSChild(theGraph, theGraph->VI[v].pertinentRoots) #define gp_GetVertexFirstPertinentRootChild(theGraph, v) (theGraph->VI[v].pertinentRoots) -#define gp_GetVertexLastPertinentRoot(theGraph, v) gp_GetRootFromDFSChild(theGraph, LCGetPrev(theGraph->BicompRootLists, theGraph->VI[v].pertinentRoots, NIL)) +#define gp_GetVertexLastPertinentRoot(theGraph, v) gp_GetBicompRootFromDFSChild(theGraph, LCGetPrev(theGraph->BicompRootLists, theGraph->VI[v].pertinentRoots, NIL)) #define gp_GetVertexLastPertinentRootChild(theGraph, v) LCGetPrev(theGraph->BicompRootLists, theGraph->VI[v].pertinentRoots, NIL) -#define gp_DeleteVertexPertinentRoot(theGraph, v, R) \ - gp_SetVertexPertinentRootsList(theGraph, v, \ - LCDelete(theGraph->BicompRootLists, gp_GetVertexPertinentRootsList(theGraph, v), gp_GetDFSChildFromRoot(theGraph, R))) +#define gp_DeleteVertexPertinentRoot(theGraph, v, R) \ + gp_SetVertexPertinentRootsList(theGraph, v, \ + LCDelete(theGraph->BicompRootLists, \ + gp_GetVertexPertinentRootsList(theGraph, v), \ + gp_GetDFSChildFromBicompRoot(theGraph, R))) -#define gp_PrependVertexPertinentRoot(theGraph, v, R) \ - gp_SetVertexPertinentRootsList(theGraph, v, \ - LCPrepend(theGraph->BicompRootLists, gp_GetVertexPertinentRootsList(theGraph, v), gp_GetDFSChildFromRoot(theGraph, R))) +#define gp_PrependVertexPertinentRoot(theGraph, v, R) \ + gp_SetVertexPertinentRootsList(theGraph, v, \ + LCPrepend(theGraph->BicompRootLists, \ + gp_GetVertexPertinentRootsList(theGraph, v), \ + gp_GetDFSChildFromBicompRoot(theGraph, R))) -#define gp_AppendVertexPertinentRoot(theGraph, v, R) \ - gp_SetVertexPertinentRootsList(theGraph, v, \ - LCAppend(theGraph->BicompRootLists, gp_GetVertexPertinentRootsList(theGraph, v), gp_GetDFSChildFromRoot(theGraph, R))) +#define gp_AppendVertexPertinentRoot(theGraph, v, R) \ + gp_SetVertexPertinentRootsList(theGraph, v, \ + LCAppend(theGraph->BicompRootLists, \ + gp_GetVertexPertinentRootsList(theGraph, v), \ + gp_GetDFSChildFromBicompRoot(theGraph, R))) #define gp_GetVertexFuturePertinentChild(theGraph, v) (theGraph->VI[v].futurePertinentChild) #define gp_SetVertexFuturePertinentChild(theGraph, v, theFuturePertinentChild) (theGraph->VI[v].futurePertinentChild = theFuturePertinentChild) // Used to advance futurePertinentChild of w to the next separated DFS child with a lowpoint less than v // Once futurePertinentChild advances past a child, no future planarity operation could make that child -// relevant to future pertinence +// relevant to future pertinence. #define gp_UpdateVertexFuturePertinentChild(theGraph, w, v) \ - while (gp_IsVertex(theGraph->VI[w].futurePertinentChild)) \ + while (gp_IsVertex(theGraph, theGraph->VI[w].futurePertinentChild)) \ { \ /* Skip children that 1) aren't future pertinent, 2) have been merged into the bicomp with w */ \ if (gp_GetVertexLowpoint(theGraph, theGraph->VI[w].futurePertinentChild) >= v || \ @@ -523,7 +669,7 @@ extern "C" Graph structure definition V : Array of vertex records (allocated size N + NV) VI: Array of additional vertexInfo structures (allocated size N) - N : Number of primary vertices (the "order" of the graph) + N : Number of non-virtual vertices (the "order" of the graph) NV: Number of virtual vertices (currently always equal to N) E : Array of edge records (edge records come in pairs and represent half edges, or arcs) @@ -548,7 +694,7 @@ extern "C" struct baseGraphStructure { - vertexRecP V; + anyTypeVertexRecP V; vertexInfoP VI; int N, NV; @@ -570,25 +716,20 @@ extern "C" typedef struct baseGraphStructure baseGraphStructure; typedef baseGraphStructure *graphP; -#define gp_getN(theGraph) ((theGraph)->N) +#define gp_GetN(theGraph) ((theGraph)->N) - /* Flags for graph: + /* Internal Flags for graph: FLAGS_DFSNUMBERED is set if DFSNumber() has succeeded for the graph FLAGS_SORTEDBYDFI records whether the graph is in original vertex order or sorted by depth first index. Successive calls to SortVertices() toggle this bit. - FLAGS_OBSTRUCTIONFOUND is set by gp_Embed() if an embedding obstruction - was isolated in the graph returned. It is cleared by gp_Embed() - if an obstruction was not found. The flag is used by - gp_TestEmbedResultIntegrity() to decide what integrity tests to run. FLAGS_ZEROBASEDIO is typically set by gp_Read() to indicate that the adjacency list representation began with index 0. */ #define FLAGS_DFSNUMBERED 1 #define FLAGS_SORTEDBYDFI 2 -#define FLAGS_OBSTRUCTIONFOUND 4 -#define FLAGS_ZEROBASEDIO 8 +#define FLAGS_ZEROBASEDIO 4 /******************************************************************** More link structure accessors/manipulators @@ -597,11 +738,15 @@ extern "C" // Definitions that enable getting the next or previous arc // as if the adjacency list were circular, i.e. that the // first arc and last arc were linked -#define gp_GetNextArcCircular(theGraph, e) \ - (gp_IsArc(gp_GetNextArc(theGraph, e)) ? gp_GetNextArc(theGraph, e) : gp_GetFirstArc(theGraph, theGraph->E[gp_GetTwinArc(theGraph, e)].neighbor)) +#define gp_GetNextArcCircular(theGraph, e) \ + (gp_IsArc(theGraph, gp_GetNextArc(theGraph, e)) \ + ? gp_GetNextArc(theGraph, e) \ + : gp_GetFirstArc(theGraph, theGraph->E[gp_GetTwinArc(theGraph, e)].neighbor)) -#define gp_GetPrevArcCircular(theGraph, e) \ - (gp_IsArc(gp_GetPrevArc(theGraph, e)) ? gp_GetPrevArc(theGraph, e) : gp_GetLastArc(theGraph, theGraph->E[gp_GetTwinArc(theGraph, e)].neighbor)) +#define gp_GetPrevArcCircular(theGraph, e) \ + (gp_IsArc(theGraph, gp_GetPrevArc(theGraph, e)) \ + ? gp_GetPrevArc(theGraph, e) \ + : gp_GetLastArc(theGraph, theGraph->E[gp_GetTwinArc(theGraph, e)].neighbor)) // Definitions that make the cross-link binding between a vertex and an arc // The old first or last arc should be bound to this arc by separate calls, @@ -621,7 +766,7 @@ extern "C" // Attaches an arc between the current binding between a vertex and its first arc #define gp_AttachFirstArc(theGraph, v, arc) \ { \ - if (gp_IsArc(gp_GetFirstArc(theGraph, v))) \ + if (gp_IsArc(theGraph, gp_GetFirstArc(theGraph, v))) \ { \ gp_SetNextArc(theGraph, arc, gp_GetFirstArc(theGraph, v)); \ gp_SetPrevArc(theGraph, gp_GetFirstArc(theGraph, v), arc); \ @@ -634,7 +779,7 @@ extern "C" // Attaches an arc between the current binding between a vertex and its last arc #define gp_AttachLastArc(theGraph, v, arc) \ { \ - if (gp_IsArc(gp_GetLastArc(theGraph, v))) \ + if (gp_IsArc(theGraph, gp_GetLastArc(theGraph, v))) \ { \ gp_SetPrevArc(theGraph, arc, gp_GetLastArc(theGraph, v)); \ gp_SetNextArc(theGraph, gp_GetLastArc(theGraph, v), arc); \ @@ -715,15 +860,18 @@ extern "C" Pertinence is a dynamic property that can change for a vertex after each edge addition. In other words, a vertex can become non-pertinent during step v as more back edges to v are embedded. + + NOTE: Pertinent roots are stored using the DFS children with which + they are associated, so we test 'is vertex' (rather than virtual). ********************************************************************/ -#define PERTINENT(theGraph, theVertex) \ - (gp_IsArc(gp_GetVertexPertinentEdge(theGraph, theVertex)) || \ - gp_IsVertex(gp_GetVertexPertinentRootsList(theGraph, theVertex))) +#define PERTINENT(theGraph, theVertex) \ + (gp_IsArc(theGraph, gp_GetVertexPertinentEdge(theGraph, theVertex)) || \ + gp_IsVertex(theGraph, gp_GetVertexPertinentRootsList(theGraph, theVertex))) -#define NOTPERTINENT(theGraph, theVertex) \ - (gp_IsNotArc(gp_GetVertexPertinentEdge(theGraph, theVertex)) && \ - gp_IsNotVertex(gp_GetVertexPertinentRootsList(theGraph, theVertex))) +#define NOTPERTINENT(theGraph, theVertex) \ + (gp_IsNotArc(theGraph, gp_GetVertexPertinentEdge(theGraph, theVertex)) && \ + gp_IsNotVertex(theGraph, gp_GetVertexPertinentRootsList(theGraph, theVertex))) /******************************************************************** FUTUREPERTINENT() @@ -756,21 +904,21 @@ extern "C" compiler extensions not assumed by this code). ********************************************************************/ -#define FUTUREPERTINENT(theGraph, theVertex, v) \ - (theGraph->VI[theVertex].leastAncestor < v || \ - (gp_IsVertex(theGraph->VI[theVertex].futurePertinentChild) && \ +#define FUTUREPERTINENT(theGraph, theVertex, v) \ + (theGraph->VI[theVertex].leastAncestor < v || \ + (gp_IsVertex(theGraph, theGraph->VI[theVertex].futurePertinentChild) && \ theGraph->VI[theGraph->VI[theVertex].futurePertinentChild].lowpoint < v)) -#define NOTFUTUREPERTINENT(theGraph, theVertex, v) \ - (theGraph->VI[theVertex].leastAncestor >= v && \ - (gp_IsNotVertex(theGraph->VI[theVertex].futurePertinentChild) || \ +#define NOTFUTUREPERTINENT(theGraph, theVertex, v) \ + (theGraph->VI[theVertex].leastAncestor >= v && \ + (gp_IsNotVertex(theGraph, theGraph->VI[theVertex].futurePertinentChild) || \ theGraph->VI[theGraph->VI[theVertex].futurePertinentChild].lowpoint >= v)) // This is the definition that would be preferable if a while loop could be a void expression // #define FUTUREPERTINENT(theGraph, theVertex, v) // ( theGraph->VI[theVertex].leastAncestor < v || // ((gp_UpdateVertexFuturePertinentChild(theGraph, theVertex, v), - // gp_IsArc(theGraph->VI[theVertex].futurePertinentChild)) && + // gp_IsArc(theGraph, theGraph->VI[theVertex].futurePertinentChild)) && // theGraph->VI[theGraph->VI[theVertex].futurePertinentChild].lowpoint < v) ) /******************************************************************** diff --git a/planarity/c/graphLib/graphUtils.c b/planarity/c/graphLib/graphUtils.c index 3d44464..ebf2699 100644 --- a/planarity/c/graphLib/graphUtils.c +++ b/planarity/c/graphLib/graphUtils.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -40,17 +40,17 @@ int _RestoreVertex(graphP theGraph); ********************************************************************/ void _InitIsolatorContext(graphP theGraph); -void _ClearVisitedFlags(graphP theGraph); -void _ClearVertexVisitedFlags(graphP theGraph, int); +void _ClearAllVisitedFlagsInGraph(graphP theGraph); +void _ClearAnyTypeVertexVisitedFlags(graphP theGraph, int includeVirtualVertices); void _ClearEdgeVisitedFlags(graphP theGraph); -int _ClearVisitedFlagsInBicomp(graphP theGraph, int BicompRoot); -int _ClearVisitedFlagsInOtherBicomps(graphP theGraph, int BicompRoot); -void _ClearVisitedFlagsInUnembeddedEdges(graphP theGraph); +int _ClearAllVisitedFlagsInBicomp(graphP theGraph, int BicompRoot); +int _ClearAllVisitedFlagsInOtherBicomps(graphP theGraph, int BicompRoot); +void _ClearEdgeVisitedFlagsInUnembeddedEdges(graphP theGraph); int _FillVertexVisitedInfoInBicomp(graphP theGraph, int BicompRoot, int FillValue); -int _ClearVertexTypeInBicomp(graphP theGraph, int BicompRoot); +int _ClearObstructionMarkInBicomp(graphP theGraph, int BicompRoot); -int _ClearVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x); -int _SetVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x); +int _ClearAllVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x); +int _SetAllVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x); int _ComputeArcType(graphP theGraph, int a, int b, int edgeType); int _SetEdgeType(graphP theGraph, int u, int v); @@ -88,7 +88,7 @@ void _RestoreArc(graphP theGraph, int arc); /* Private functions for which there are FUNCTION POINTERS */ -void _InitVertexRec(graphP theGraph, int v); +void _InitAnyTypeVertexRec(graphP theGraph, int v); void _InitVertexInfo(graphP theGraph, int v); void _InitEdgeRec(graphP theGraph, int e); @@ -254,16 +254,16 @@ int _InitGraph(graphP theGraph, int N) theGraph->N = N; theGraph->NV = N; theGraph->arcCapacity = theGraph->arcCapacity > 0 ? theGraph->arcCapacity : 2 * DEFAULT_EDGE_LIMIT * N; - VIsize = gp_PrimaryVertexIndexBound(theGraph); - Vsize = gp_VertexIndexBound(theGraph); - Esize = gp_EdgeIndexBound(theGraph); + VIsize = gp_VertexArraySize(theGraph); + Vsize = gp_AnyTypeVertexArraySize(theGraph); + Esize = gp_EdgeArraySize(theGraph); // Stack size is 2 integers per arc, or 6 integers per vertex in case of small arcCapacity stackSize = 2 * Esize; stackSize = stackSize < 6 * N ? 6 * N : stackSize; // Allocate memory as described above - if ((theGraph->V = (vertexRecP)calloc(Vsize, sizeof(vertexRec))) == NULL || + if ((theGraph->V = (anyTypeVertexRecP)calloc(Vsize, sizeof(anyTypeVertexRec))) == NULL || (theGraph->VI = (vertexInfoP)calloc(VIsize, sizeof(vertexInfo))) == NULL || (theGraph->E = (edgeRecP)calloc(Esize, sizeof(edgeRec))) == NULL || (theGraph->BicompRootLists = LCNew(VIsize)) == NULL || @@ -291,35 +291,35 @@ int _InitGraph(graphP theGraph, int N) void _InitVertices(graphP theGraph) { #ifdef USE_FASTER_1BASEDARRAYS - memset(theGraph->V, NIL_CHAR, gp_VertexIndexBound(theGraph) * sizeof(vertexRec)); - memset(theGraph->VI, NIL_CHAR, gp_PrimaryVertexIndexBound(theGraph) * sizeof(vertexInfo)); - memset(theGraph->extFace, NIL_CHAR, gp_VertexIndexBound(theGraph) * sizeof(extFaceLinkRec)); + memset(theGraph->V, NIL_CHAR, gp_AnyTypeVertexArraySize(theGraph) * sizeof(anyTypeVertexRec)); + memset(theGraph->VI, NIL_CHAR, gp_VertexArraySize(theGraph) * sizeof(vertexInfo)); + memset(theGraph->extFace, NIL_CHAR, gp_AnyTypeVertexArraySize(theGraph) * sizeof(extFaceLinkRec)); #else int v; - memset(theGraph->V, NIL_CHAR, gp_VertexIndexBound(theGraph) * sizeof(vertexRec)); - memset(theGraph->VI, NIL_CHAR, gp_PrimaryVertexIndexBound(theGraph) * sizeof(vertexInfo)); - memset(theGraph->extFace, NIL_CHAR, gp_VertexIndexBound(theGraph) * sizeof(extFaceLinkRec)); + memset(theGraph->V, NIL_CHAR, gp_AnyTypeVertexArraySize(theGraph) * sizeof(anyTypeVertexRec)); + memset(theGraph->VI, NIL_CHAR, gp_VertexArraySize(theGraph) * sizeof(vertexInfo)); + memset(theGraph->extFace, NIL_CHAR, gp_AnyTypeVertexArraySize(theGraph) * sizeof(extFaceLinkRec)); - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) - gp_InitVertexFlags(theGraph, v); + for (v = gp_GetFirstVertex(theGraph); gp_AnyTypeVertexInRangeAscending(theGraph, v); v++) + gp_InitFlags(theGraph, v); #endif // N.B. This is the legacy API-based approach to initializing the vertices // int v; - // // Initialize primary vertices - // for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + // // Initialize the vertices (non-virtual vertices) + // for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) // { - // _InitVertexRec(theGraph, v); + // _InitAnyTypeVertexRec(theGraph, v); // _InitVertexInfo(theGraph, v); // gp_SetExtFaceVertex(theGraph, v, 0, NIL); // gp_SetExtFaceVertex(theGraph, v, 1, NIL); // } // // Initialize virtual vertices - // for (v = gp_GetFirstVirtualVertex(theGraph); gp_VirtualVertexInRange(theGraph, v); v++) + // for (v = gp_GetFirstVirtualVertex(theGraph); gp_VirtualVertexInRangeAscending(theGraph, v); v++) // { - // _InitVertexRec(theGraph, v); + // _InitAnyTypeVertexRec(theGraph, v); // gp_SetExtFaceVertex(theGraph, v, 0, NIL); // gp_SetExtFaceVertex(theGraph, v, 1, NIL); // } @@ -331,20 +331,20 @@ void _InitVertices(graphP theGraph) void _InitEdges(graphP theGraph) { #ifdef USE_FASTER_1BASEDARRAYS - memset(theGraph->E, NIL_CHAR, gp_EdgeIndexBound(theGraph) * sizeof(edgeRec)); + memset(theGraph->E, NIL_CHAR, gp_EdgeArraySize(theGraph) * sizeof(edgeRec)); #else int e, Esize; - memset(theGraph->E, NIL_CHAR, gp_EdgeIndexBound(theGraph) * sizeof(edgeRec)); + memset(theGraph->E, NIL_CHAR, gp_EdgeArraySize(theGraph) * sizeof(edgeRec)); - Esize = gp_EdgeIndexBound(theGraph); + Esize = gp_EdgeArraySize(theGraph); for (e = gp_GetFirstEdge(theGraph); e < Esize; e++) gp_InitEdgeFlags(theGraph, e); #endif // N.B. This is the legacy API-based approach to initializing the edges // int e, Esize; - // Esize = gp_EdgeIndexBound(theGraph); + // Esize = gp_EdgeArraySize(theGraph); // for (e = gp_GetFirstEdge(theGraph); e < Esize; e++) // _InitEdgeRec(theGraph, e); } @@ -385,7 +385,7 @@ void _ReinitializeGraph(graphP theGraph) ********************************************************************/ int gp_GetArcCapacity(graphP theGraph) { - return theGraph->arcCapacity - gp_GetFirstEdge(theGraph); + return theGraph == NULL ? 0 : (theGraph->arcCapacity - gp_GetFirstEdge(theGraph)); } /******************************************************************** @@ -468,7 +468,7 @@ int gp_EnsureArcCapacity(graphP theGraph, int requiredArcCapacity) int _EnsureArcCapacity(graphP theGraph, int requiredArcCapacity) { stackP newStack; - int e, Esize = gp_EdgeIndexBound(theGraph), + int e, Esize = gp_EdgeArraySize(theGraph), newEsize = gp_GetFirstEdge(theGraph) + requiredArcCapacity; // If the new size is less than or equal to the old size, then @@ -525,16 +525,16 @@ int _EnsureArcCapacity(graphP theGraph, int requiredArcCapacity) } /******************************************************************** - _InitVertexRec() + _InitAnyTypeVertexRec() Sets the fields in a single vertex record to initial values ********************************************************************/ -void _InitVertexRec(graphP theGraph, int v) +void _InitAnyTypeVertexRec(graphP theGraph, int v) { gp_SetFirstArc(theGraph, v, NIL); gp_SetLastArc(theGraph, v, NIL); - gp_SetVertexIndex(theGraph, v, NIL); - gp_InitVertexFlags(theGraph, v); + gp_SetIndex(theGraph, v, NIL); + gp_InitFlags(theGraph, v); } /******************************************************************** @@ -583,29 +583,31 @@ void _InitIsolatorContext(graphP theGraph) } /******************************************************************** - _ClearVisitedFlags() + _ClearAllVisitedFlagsInGraph() ********************************************************************/ -void _ClearVisitedFlags(graphP theGraph) +void _ClearAllVisitedFlagsInGraph(graphP theGraph) { - _ClearVertexVisitedFlags(theGraph, TRUE); + _ClearAnyTypeVertexVisitedFlags(theGraph, TRUE); _ClearEdgeVisitedFlags(theGraph); } /******************************************************************** - _ClearVertexVisitedFlags() + _ClearAnyTypeVertexVisitedFlags() + Clears the visited flags of vertices, and if the second parameter + is truthy, also clears the visited flags of virtual vertices. ********************************************************************/ -void _ClearVertexVisitedFlags(graphP theGraph, int includeVirtualVertices) +void _ClearAnyTypeVertexVisitedFlags(graphP theGraph, int includeVirtualVertices) { int v; - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) - gp_ClearVertexVisited(theGraph, v); + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) + gp_ClearVisited(theGraph, v); if (includeVirtualVertices) - for (v = gp_GetFirstVirtualVertex(theGraph); gp_VirtualVertexInRange(theGraph, v); v++) - gp_ClearVertexVisited(theGraph, v); + for (v = gp_GetFirstVirtualVertex(theGraph); gp_VirtualVertexInRangeAscending(theGraph, v); v++) + gp_ClearVisited(theGraph, v); } /******************************************************************** @@ -616,13 +618,13 @@ void _ClearEdgeVisitedFlags(graphP theGraph) { int e, EsizeOccupied; - EsizeOccupied = gp_EdgeInUseIndexBound(theGraph); + EsizeOccupied = gp_EdgeInUseArraySize(theGraph); for (e = gp_GetFirstEdge(theGraph); e < EsizeOccupied; e++) gp_ClearEdgeVisited(theGraph, e); } /******************************************************************** - _ClearVisitedFlagsInBicomp() + _ClearAllVisitedFlagsInBicomp() Clears the visited flag of the vertices and arcs in the bicomp rooted by BicompRoot. @@ -634,7 +636,7 @@ void _ClearEdgeVisitedFlags(graphP theGraph) Returns OK on success, NOTOK on implementation failure. ********************************************************************/ -int _ClearVisitedFlagsInBicomp(graphP theGraph, int BicompRoot) +int _ClearAllVisitedFlagsInBicomp(graphP theGraph, int BicompRoot) { int stackBottom = sp_GetCurrentSize(theGraph->theStack); int v, e; @@ -643,10 +645,10 @@ int _ClearVisitedFlagsInBicomp(graphP theGraph, int BicompRoot) while (sp_GetCurrentSize(theGraph->theStack) > stackBottom) { sp_Pop(theGraph->theStack, v); - gp_ClearVertexVisited(theGraph, v); + gp_ClearVisited(theGraph, v); e = gp_GetFirstArc(theGraph, v); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { gp_ClearEdgeVisited(theGraph, e); @@ -660,11 +662,11 @@ int _ClearVisitedFlagsInBicomp(graphP theGraph, int BicompRoot) } /******************************************************************** - _ClearVisitedFlagsInOtherBicomps() + _ClearAllVisitedFlagsInOtherBicomps() Typically, we want to clear all visited flags in the graph (see _ClearVisitedFlags). However, in some algorithms this would be too costly, so it is necessary to clear the visited flags only - in one bicomp (see _ClearVisitedFlagsInBicomp), then do some processing + in one bicomp (see _ClearAllVisitedFlagsInBicomp), then do some processing that sets some of the flags then performs some tests. If the tests are positive, then we can clear all the visited flags in the other bicomps (the processing may have set the visited flags in the @@ -672,15 +674,15 @@ int _ClearVisitedFlagsInBicomp(graphP theGraph, int BicompRoot) the given bicomp). ********************************************************************/ -int _ClearVisitedFlagsInOtherBicomps(graphP theGraph, int BicompRoot) +int _ClearAllVisitedFlagsInOtherBicomps(graphP theGraph, int BicompRoot) { int R; - for (R = gp_GetFirstVirtualVertex(theGraph); gp_VirtualVertexInRange(theGraph, R); R++) + for (R = gp_GetFirstVirtualVertex(theGraph); gp_VirtualVertexInRangeAscending(theGraph, R); R++) { if (R != BicompRoot && gp_VirtualVertexInUse(theGraph, R)) { - if (_ClearVisitedFlagsInBicomp(theGraph, R) != OK) + if (_ClearAllVisitedFlagsInBicomp(theGraph, R) != OK) return NOTOK; } } @@ -688,19 +690,19 @@ int _ClearVisitedFlagsInOtherBicomps(graphP theGraph, int BicompRoot) } /******************************************************************** - _ClearVisitedFlagsInUnembeddedEdges() + _ClearEdgeVisitedFlagsInUnembeddedEdges() Unembedded edges aren't part of any bicomp yet, but it may be necessary to clear their visited flags. ********************************************************************/ -void _ClearVisitedFlagsInUnembeddedEdges(graphP theGraph) +void _ClearEdgeVisitedFlagsInUnembeddedEdges(graphP theGraph) { int v, e; - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) { e = gp_GetVertexFwdArcList(theGraph, v); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { gp_ClearEdgeVisited(theGraph, e); gp_ClearEdgeVisited(theGraph, gp_GetTwinArc(theGraph, e)); @@ -713,7 +715,7 @@ void _ClearVisitedFlagsInUnembeddedEdges(graphP theGraph) } /**************************************************************************** - _ClearVisitedFlagsOnPath() + _ClearAllVisitedFlagsOnPath() This method clears the visited flags on the vertices and edges on the path (u, v, ..., w, x) in which all vertices except the endpoints u and x are degree 2. This method avoids performing more than constant work at the @@ -722,14 +724,14 @@ void _ClearVisitedFlagsInUnembeddedEdges(graphP theGraph) Returns OK on success, NOTOK on internal failure ****************************************************************************/ -int _ClearVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x) +int _ClearAllVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x) { int e, eTwin; // We want to exit u from e, but we get eTwin first here in order to avoid // work, in case the degree of u is greater than 2. eTwin = gp_GetNeighborEdgeRecord(theGraph, v, u); - if (gp_IsNotArc(eTwin)) + if (gp_IsNotArc(theGraph, eTwin)) return NOTOK; e = gp_GetTwinArc(theGraph, eTwin); @@ -738,7 +740,7 @@ int _ClearVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x) do { // Mark the vertex and the exiting edge - gp_ClearVertexVisited(theGraph, v); + gp_ClearVisited(theGraph, v); gp_ClearEdgeVisited(theGraph, e); gp_ClearEdgeVisited(theGraph, eTwin); @@ -749,13 +751,13 @@ int _ClearVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x) } while (v != x); // Mark the last vertex with 'visited' - gp_ClearVertexVisited(theGraph, x); + gp_ClearVisited(theGraph, x); return OK; } /**************************************************************************** - _SetVisitedFlagsOnPath() + _SetAllVisitedFlagsOnPath() This method sets the visited flags on the vertices and edges on the path (u, v, ..., w, x) in which all vertices except the endpoints u and x are degree 2. This method avoids performing more than constant work at the @@ -764,14 +766,14 @@ int _ClearVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x) Returns OK on success, NOTOK on internal failure ****************************************************************************/ -int _SetVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x) +int _SetAllVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x) { int e, eTwin; // We want to exit u from e, but we get eTwin first here in order to avoid // work, in case the degree of u is greater than 2. eTwin = gp_GetNeighborEdgeRecord(theGraph, v, u); - if (gp_IsNotArc(eTwin)) + if (gp_IsNotArc(theGraph, eTwin)) return NOTOK; e = gp_GetTwinArc(theGraph, eTwin); @@ -780,7 +782,7 @@ int _SetVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x) do { // Mark the vertex and the exiting edge - gp_SetVertexVisited(theGraph, v); + gp_SetVisited(theGraph, v); gp_SetEdgeVisited(theGraph, e); gp_SetEdgeVisited(theGraph, eTwin); @@ -791,7 +793,7 @@ int _SetVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x) } while (v != x); // Mark the last vertex with 'visited' - gp_SetVertexVisited(theGraph, x); + gp_SetVisited(theGraph, x); return OK; } @@ -823,7 +825,7 @@ int _FillVertexVisitedInfoInBicomp(graphP theGraph, int BicompRoot, int FillValu gp_SetVertexVisitedInfo(theGraph, v, FillValue); e = gp_GetFirstArc(theGraph, v); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) sp_Push(theGraph->theStack, gp_GetNeighbor(theGraph, e)); @@ -835,7 +837,7 @@ int _FillVertexVisitedInfoInBicomp(graphP theGraph, int BicompRoot, int FillValu } /******************************************************************** - _ClearVertexTypeInBicomp() + _ClearObstructionMarkInBicomp() Clears the 'obstruction type' bits for each vertex in the bicomp rooted by BicompRoot. @@ -847,7 +849,7 @@ int _FillVertexVisitedInfoInBicomp(graphP theGraph, int BicompRoot, int FillValu Returns OK on success, NOTOK on implementation failure. ********************************************************************/ -int _ClearVertexTypeInBicomp(graphP theGraph, int BicompRoot) +int _ClearObstructionMarkInBicomp(graphP theGraph, int BicompRoot) { int V, e; int stackBottom = sp_GetCurrentSize(theGraph->theStack); @@ -856,10 +858,10 @@ int _ClearVertexTypeInBicomp(graphP theGraph, int BicompRoot) while (sp_GetCurrentSize(theGraph->theStack) > stackBottom) { sp_Pop(theGraph->theStack, V); - gp_ClearVertexObstructionType(theGraph, V); + gp_ClearObstructionMark(theGraph, V); e = gp_GetFirstArc(theGraph, V); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) sp_Push(theGraph->theStack, gp_GetNeighbor(theGraph, e)); @@ -921,8 +923,8 @@ void _ClearGraph(graphP theGraph) /******************************************************************** gp_Free() - Frees G and V, then the graph record. Then sets your pointer to NULL - (so you must pass the address of your pointer). + Frees G and V, then the graph record. Then sets the caller's graph + pointer to NULL (caller must pass the address of a graphP variable). ********************************************************************/ void gp_Free(graphP *pGraph) @@ -964,14 +966,14 @@ int gp_CopyAdjacencyLists(graphP dstGraph, graphP srcGraph) return NOTOK; // Copy the links that hook each owning vertex to its adjacency list - for (v = gp_GetFirstVertex(srcGraph); gp_VertexInRange(srcGraph, v); v++) + for (v = gp_GetFirstVertex(srcGraph); gp_VertexInRangeAscending(srcGraph, v); v++) { gp_SetFirstArc(dstGraph, v, gp_GetFirstArc(srcGraph, v)); gp_SetLastArc(dstGraph, v, gp_GetLastArc(srcGraph, v)); } // Copy the adjacency links and neighbor pointers for each arc - EsizeOccupied = gp_EdgeInUseIndexBound(srcGraph); + EsizeOccupied = gp_EdgeInUseArraySize(srcGraph); for (e = gp_GetFirstEdge(theGraph); e < EsizeOccupied; e++) { gp_SetNeighbor(dstGraph, e, gp_GetNeighbor(srcGraph, e)); @@ -988,9 +990,15 @@ int gp_CopyAdjacencyLists(graphP dstGraph, graphP srcGraph) /******************************************************************** gp_CopyGraph() - Copies the content of the srcGraph into the dstGraph. The dstGraph - must have been previously initialized with the same number of - vertices as the srcGraph (e.g. gp_InitGraph(dstGraph, srcGraph->N). + + Copies the content of the srcGraph into the dstGraph. + + The dstGraph must have been previously initialized with the same + number of vertices as the srcGraph. + + Also, if the dstGraph has a higher arc capacity than the srcGraph, + then this call will fail unless the caller first ensures that the + arc capacity of the srcGraph is increased to match the dstGraph. Returns OK for success, NOTOK for failure. ********************************************************************/ @@ -1019,11 +1027,25 @@ int gp_CopyGraph(graphP dstGraph, graphP srcGraph) return NOTOK; } - // Copy the primary vertices. Augmentations to vertices created + // If the dstGraph has a larger arc capacity than the srcGraph + // then we report failure because the code below only gives + // valid values to arcs up to the arc capacity of the srcGraph + // It would be possible to invoke _InitEdgeRec() on the + // additional arcs in dstGraph, but we do not support this + // currently because we would need to have and currently do + // not have a way to reinitialize the edge record extensions + // (gp_CopyExtensions() only copies the content in extension + // content up to the size of data structures in srcGraph). + if (dstGraph->arcCapacity > srcGraph->arcCapacity) + { + return NOTOK; + } + + // Copy the vertices (non-virtual only). Augmentations to vertices created // by extensions are copied below by gp_CopyExtensions() - for (v = gp_GetFirstVertex(srcGraph); gp_VertexInRange(srcGraph, v); v++) + for (v = gp_GetFirstVertex(srcGraph); gp_VertexInRangeAscending(srcGraph, v); v++) { - gp_CopyVertexRec(dstGraph, v, srcGraph, v); + gp_CopyAnyTypeVertexRec(dstGraph, v, srcGraph, v); gp_CopyVertexInfo(dstGraph, v, srcGraph, v); gp_SetExtFaceVertex(dstGraph, v, 0, gp_GetExtFaceVertex(srcGraph, v, 0)); gp_SetExtFaceVertex(dstGraph, v, 1, gp_GetExtFaceVertex(srcGraph, v, 1)); @@ -1031,16 +1053,16 @@ int gp_CopyGraph(graphP dstGraph, graphP srcGraph) // Copy the virtual vertices. Augmentations to virtual vertices created // by extensions are copied below by gp_CopyExtensions() - for (v = gp_GetFirstVirtualVertex(srcGraph); gp_VirtualVertexInRange(srcGraph, v); v++) + for (v = gp_GetFirstVirtualVertex(srcGraph); gp_VirtualVertexInRangeAscending(srcGraph, v); v++) { - gp_CopyVertexRec(dstGraph, v, srcGraph, v); + gp_CopyAnyTypeVertexRec(dstGraph, v, srcGraph, v); gp_SetExtFaceVertex(dstGraph, v, 0, gp_GetExtFaceVertex(srcGraph, v, 0)); gp_SetExtFaceVertex(dstGraph, v, 1, gp_GetExtFaceVertex(srcGraph, v, 1)); } // Copy the basic EdgeRec structures. Augmentations to the edgeRec structure // created by extensions are copied below by gp_CopyExtensions() - Esize = gp_EdgeIndexBound(srcGraph); + Esize = gp_EdgeArraySize(srcGraph); for (e = gp_GetFirstEdge(theGraph); e < Esize; e++) gp_CopyEdgeRec(dstGraph, e, srcGraph, e); @@ -1086,7 +1108,7 @@ int gp_CopyGraph(graphP dstGraph, graphP srcGraph) graphP gp_DupGraph(graphP theGraph) { - graphP result; + graphP result = NULL; if ((result = gp_New()) == NULL) return NULL; @@ -1125,7 +1147,7 @@ int gp_CreateRandomGraph(graphP theGraph) Also, we are not generating the DFS tree but rather a tree that simply ensures the resulting random graph is connected. */ - for (v = gp_GetFirstVertex(theGraph) + 1; gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph) + 1; gp_VertexInRangeAscending(theGraph, v); v++) { u = _GetRandomNumber(gp_GetFirstVertex(theGraph), v - 1); if (gp_AddEdge(theGraph, u, 0, v, 0) != OK) @@ -1279,7 +1301,7 @@ int gp_CreateRandomGraphEx(graphP theGraph, int numEdges) /* Generate a random tree. */ - for (v = gp_GetFirstVertex(theGraph) + 1; gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph) + 1; gp_VertexInRangeAscending(theGraph, v); v++) { u = _GetRandomNumber(gp_GetFirstVertex(theGraph), v - 1); if (gp_AddEdge(theGraph, u, 0, v, 0) != OK) @@ -1306,7 +1328,7 @@ int gp_CreateRandomGraphEx(graphP theGraph, int numEdges) { c = _getUnprocessedChild(theGraph, v); - if (gp_IsVertex(c)) + if (gp_IsVertex(theGraph, c)) { if (last != v) { @@ -1323,18 +1345,18 @@ int gp_CreateRandomGraphEx(graphP theGraph, int numEdges) else { p = gp_GetVertexParent(theGraph, v); - while (gp_IsVertex(p) && gp_IsNotVertex(c = _getUnprocessedChild(theGraph, p))) + while (gp_IsVertex(theGraph, p) && gp_IsNotVertex(theGraph, (c = _getUnprocessedChild(theGraph, p)))) { v = p; p = gp_GetVertexParent(theGraph, v); - if (gp_IsVertex(p) && p != root) + if (gp_IsVertex(theGraph, p) && p != root) { if (gp_AddEdge(theGraph, last, 1, p, 1) != OK) return NOTOK; } } - if (gp_IsVertex(p)) + if (gp_IsVertex(theGraph, p)) { if (p == root) { @@ -1379,7 +1401,7 @@ int gp_CreateRandomGraphEx(graphP theGraph, int numEdges) /* Clear the edge types back to 'unknown' */ - EsizeOccupied = gp_EdgeInUseIndexBound(theGraph); + EsizeOccupied = gp_EdgeInUseArraySize(theGraph); for (e = 0; e < EsizeOccupied; e++) { gp_ClearEdgeType(theGraph, e); @@ -1388,7 +1410,7 @@ int gp_CreateRandomGraphEx(graphP theGraph, int numEdges) /* Put all DFSParent indicators back to NIL */ - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) gp_SetVertexParent(theGraph, v, NIL); return OK; @@ -1407,9 +1429,20 @@ int gp_CreateRandomGraphEx(graphP theGraph, int numEdges) int gp_IsNeighbor(graphP theGraph, int u, int v) { - int e = gp_GetFirstArc(theGraph, u); + int e = NIL; - while (gp_IsArc(e)) + if (theGraph == NULL || + u < gp_GetFirstVertex(theGraph) || u >= gp_AnyTypeVertexArraySize(theGraph) || + v < gp_GetFirstVertex(theGraph) || v >= gp_AnyTypeVertexArraySize(theGraph)) + { +#ifdef DEBUG + NOTOK; +#endif + return FALSE; + } + + e = gp_GetFirstArc(theGraph, u); + while (gp_IsArc(theGraph, e)) { if (gp_GetNeighbor(theGraph, e) == v) { @@ -1438,13 +1471,21 @@ int gp_IsNeighbor(graphP theGraph, int u, int v) int gp_GetNeighborEdgeRecord(graphP theGraph, int u, int v) { - int e; + int e = NIL; + + if (theGraph == NULL || + u < gp_GetFirstVertex(theGraph) || u >= gp_AnyTypeVertexArraySize(theGraph) || + v < gp_GetFirstVertex(theGraph) || v >= gp_AnyTypeVertexArraySize(theGraph)) + { +#ifdef DEBUG + NOTOK; +#endif - if (gp_IsNotVertex(u) || gp_IsNotVertex(v)) - return NIL + NOTOK - NOTOK; + return NIL; + } e = gp_GetFirstArc(theGraph, u); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (gp_GetNeighbor(theGraph, e) == v) return e; @@ -1474,13 +1515,21 @@ int gp_GetVertexDegree(graphP theGraph, int v) { int e, degree; - if (theGraph == NULL || gp_IsNotVertex(v)) - return 0 + NOTOK - NOTOK; + if (theGraph == NULL || + v < gp_GetFirstVertex(theGraph) || v >= gp_AnyTypeVertexArraySize(theGraph)) + { +#ifdef DEBUG + NOTOK; + ; +#endif + + return 0; + } degree = 0; e = gp_GetFirstArc(theGraph, v); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { degree++; e = gp_GetNextArc(theGraph, e); @@ -1506,13 +1555,20 @@ int gp_GetVertexInDegree(graphP theGraph, int v) { int e, degree; - if (theGraph == NULL || gp_IsNotVertex(v)) - return 0 + NOTOK - NOTOK; + if (theGraph == NULL || + v < gp_GetFirstVertex(theGraph) || v >= gp_AnyTypeVertexArraySize(theGraph)) + { +#ifdef DEBUG + NOTOK; +#endif + + return 0; + } degree = 0; e = gp_GetFirstArc(theGraph, v); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (gp_GetDirection(theGraph, e) != EDGEFLAG_DIRECTION_OUTONLY) degree++; @@ -1539,13 +1595,20 @@ int gp_GetVertexOutDegree(graphP theGraph, int v) { int e, degree; - if (theGraph == NULL || gp_IsNotVertex(v)) - return 0 + NOTOK - NOTOK; + if (theGraph == NULL || + v < gp_GetFirstVertex(theGraph) || v >= gp_AnyTypeVertexArraySize(theGraph)) + { +#ifdef DEBUG + NOTOK; +#endif + + return 0; + } degree = 0; e = gp_GetFirstArc(theGraph, v); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (gp_GetDirection(theGraph, e) != EDGEFLAG_DIRECTION_INONLY) degree++; @@ -1577,7 +1640,7 @@ int gp_GetVertexOutDegree(graphP theGraph, int v) void gp_AttachArc(graphP theGraph, int v, int e, int link, int newArc) { - if (gp_IsArc(e)) + if (gp_IsArc(theGraph, e)) { int e2 = gp_GetAdjacentArc(theGraph, e, link); @@ -1589,7 +1652,7 @@ void gp_AttachArc(graphP theGraph, int v, int e, int link, int newArc) gp_SetAdjacentArc(theGraph, newArc, link, e2); // if e2 is an arc, then e2's 1^link is newArc, else v's 1^link is newArc - if (gp_IsArc(e2)) + if (gp_IsArc(theGraph, e2)) gp_SetAdjacentArc(theGraph, e2, 1 ^ link, newArc); else gp_SetArc(theGraph, v, 1 ^ link, newArc); @@ -1606,7 +1669,7 @@ void gp_AttachArc(graphP theGraph, int v, int e, int link, int newArc) gp_SetAdjacentArc(theGraph, newArc, link, e2); // if e2 is an arc, then e2's 1^link is newArc, else v's 1^link is newArc - if (gp_IsArc(e2)) + if (gp_IsArc(theGraph, e2)) gp_SetAdjacentArc(theGraph, e2, 1 ^ link, newArc); else gp_SetArc(theGraph, v, 1 ^ link, newArc); @@ -1638,12 +1701,12 @@ void gp_DetachArc(graphP theGraph, int arc) int nextArc = gp_GetNextArc(theGraph, arc), prevArc = gp_GetPrevArc(theGraph, arc); - if (gp_IsArc(nextArc)) + if (gp_IsArc(theGraph, nextArc)) gp_SetPrevArc(theGraph, nextArc, prevArc); else gp_SetLastArc(theGraph, gp_GetNeighbor(theGraph, gp_GetTwinArc(theGraph, arc)), prevArc); - if (gp_IsArc(prevArc)) + if (gp_IsArc(theGraph, prevArc)) gp_SetNextArc(theGraph, prevArc, nextArc); else gp_SetFirstArc(theGraph, gp_GetNeighbor(theGraph, gp_GetTwinArc(theGraph, arc)), nextArc); @@ -1651,6 +1714,7 @@ void gp_DetachArc(graphP theGraph, int arc) /******************************************************************** gp_AddEdge() + Adds the undirected edge (u,v) to the graph by placing edge records representing u into v's circular edge record list and v into u's circular edge record list. @@ -1664,6 +1728,24 @@ void gp_DetachArc(graphP theGraph, int arc) vlink (0|1) indicates whether the edge record to u in v's list should become adjacent to v by its 0 or 1 link, i.e. v[vlink] == upos. + NOTE: Only the neighbor and link pointer data members are modified in + the arc records. The arc records are otherwise assumed to be in + initial state, either from graph initialization/reinitialization, + or from edge record reinitialization during gp_DeleteEdge(), if + the new edge is filling an edge hole in the edge array.This + expectation of being in initial state includes data stored in + parallel edge record extension arrays. + + NOTE: This method does not forbid the addition of duplicate and loop + edges. Use with care because other API endpoints do not all + support nor check for and eliminate duplicates and loops. The + caller can guard against these conditions by pre-testing that + u != v and that gp_GetNeighborEdgeRecord() returns NIL. + + Returns OK on success, NOTOK on failure, NONEMBEDDABLE if adding the + edge would exceed the graph's arc capacity (the caller can + invoke gp_DynamicAddEdge() to avoid the NONEMBEDDABLE result). + ********************************************************************/ int gp_AddEdge(graphP theGraph, int u, int ulink, int v, int vlink) @@ -1671,7 +1753,7 @@ int gp_AddEdge(graphP theGraph, int u, int ulink, int v, int vlink) int upos, vpos; if (theGraph == NULL || u < gp_GetFirstVertex(theGraph) || v < gp_GetFirstVertex(theGraph) || - !gp_VirtualVertexInRange(theGraph, u) || !gp_VirtualVertexInRange(theGraph, v)) + !gp_VirtualVertexInRangeAscending(theGraph, u) || !gp_VirtualVertexInRangeAscending(theGraph, v)) return NOTOK; /* We enforce the edge limit */ @@ -1684,7 +1766,7 @@ int gp_AddEdge(graphP theGraph, int u, int ulink, int v, int vlink) sp_Pop(theGraph->edgeHoles, vpos); } else - vpos = gp_EdgeInUseIndexBound(theGraph); + vpos = gp_EdgeInUseArraySize(theGraph); upos = gp_GetTwinArc(theGraph, vpos); @@ -1702,17 +1784,14 @@ int gp_AddEdge(graphP theGraph, int u, int ulink, int v, int vlink) Refer to documentation for gp_AddEdge for parameter description. Tries to call gp_AddEdge; if NONEMBEDDABLE, doubles the arc - capacity (up to a max of (N * (N-1))) using gp_EnsureArcCapacity, - then retries gp_AddEdge. + capacity using gp_EnsureArcCapacity, then retries gp_AddEdge. + + Returns OK on success, NOTOK on failure. ********************************************************************/ int gp_DynamicAddEdge(graphP theGraph, int u, int ulink, int v, int vlink) { int Result = OK; - if (theGraph == NULL || u < gp_GetFirstVertex(theGraph) || v < gp_GetFirstVertex(theGraph) || - !gp_VirtualVertexInRange(theGraph, u) || !gp_VirtualVertexInRange(theGraph, v)) - return NOTOK; - Result = gp_AddEdge(theGraph, u, ulink, v, vlink); if (Result == NONEMBEDDABLE) @@ -1720,6 +1799,15 @@ int gp_DynamicAddEdge(graphP theGraph, int u, int ulink, int v, int vlink) int candidateArcCapacity = gp_GetArcCapacity(theGraph) * 2; int N = theGraph->N; int newArcCapacity = (candidateArcCapacity > (N * (N - 1))) ? (N * (N - 1)) : candidateArcCapacity; + + // We first give it a try at the maximum arc capacity for a + // simple undirected graph. However, if the arc capacity is + // already at or above that limit, then we assume the caller + // knows what they are doing and double the arc capacity + // beyond the simple undirected graph limit. + if (newArcCapacity <= gp_GetArcCapacity(theGraph)) + newArcCapacity = candidateArcCapacity; + Result = gp_EnsureArcCapacity(theGraph, newArcCapacity); if (Result != OK) @@ -1741,21 +1829,33 @@ int gp_DynamicAddEdge(graphP theGraph, int u, int ulink, int v, int vlink) for e_v. Specifically, the new edge will be comprised of two arcs, n_u and n_v. In u's (v's) adjacency list, n_u (n_v) will be added so that it is indicated by e_u's (e_v's) e_ulink (e_vlink). + If e_u (or e_v) is not an arc, then e_ulink (e_vlink) indicates whether to prepend or append to the adjacency list for u (v). + + NOTE: See notes on gp_AddEdge(). + + Returns OK on success, NOTOK on failure, NONEMBEDDABLE if adding the + edge would exceed the graph's arc capacity (the caller can + invoke gp_EnsureArcCapacity() ahead of time to avoid the + NONEMBEDDABLE result). ********************************************************************/ int gp_InsertEdge(graphP theGraph, int u, int e_u, int e_ulink, int v, int e_v, int e_vlink) { - int vertMax = gp_GetLastVirtualVertex(theGraph), - edgeMax = gp_EdgeInUseIndexBound(theGraph) - 1, - upos, vpos; + int vertMax, edgeMax, upos, vpos; - if (theGraph == NULL || u < gp_GetFirstVertex(theGraph) || v < gp_GetFirstVertex(theGraph) || - u > vertMax || v > vertMax || - e_u > edgeMax || (e_u < gp_GetFirstEdge(theGraph) && gp_IsArc(e_u)) || - e_v > edgeMax || (e_v < gp_GetFirstEdge(theGraph) && gp_IsArc(e_v)) || + if (theGraph == NULL) + return NOTOK; + + vertMax = gp_GetLastVirtualVertex(theGraph); + edgeMax = gp_EdgeInUseArraySize(theGraph) - 1; + + if (u < gp_GetFirstVertex(theGraph) || u > vertMax || + v < gp_GetFirstVertex(theGraph) || v > vertMax || + e_u > edgeMax || (e_u < gp_GetFirstEdge(theGraph) && gp_IsArc(theGraph, e_u)) || + e_v > edgeMax || (e_v < gp_GetFirstEdge(theGraph) && gp_IsArc(theGraph, e_v)) || e_ulink < 0 || e_ulink > 1 || e_vlink < 0 || e_vlink > 1) return NOTOK; @@ -1767,7 +1867,14 @@ int gp_InsertEdge(graphP theGraph, int u, int e_u, int e_ulink, sp_Pop(theGraph->edgeHoles, vpos); } else - vpos = gp_EdgeInUseIndexBound(theGraph); + vpos = gp_EdgeInUseArraySize(theGraph); + + // NOTE: We do not _InitEdgeRec() nor gp_InitEdgeFlags() here because + // the vpos edge location is expected to be in initialized state, + // either from graph initialization/reinitialization, or from + // edge record reinitialization during gp_DeleteEdge, if vpos was + // an edge hole. This expectation includes edge record extensions + // in graph extensions. upos = gp_GetTwinArc(theGraph, vpos); @@ -1787,17 +1894,23 @@ int gp_InsertEdge(graphP theGraph, int u, int e_u, int e_ulink, This function deletes the given edge record e and its twin, reducing the number of edges M in the graph. - Before the e^th record is deleted, its 'nextLink' adjacency list neighbor - is collected as the return result. This is useful when iterating through - an edge list and making deletions because the nextLink arc is the 'next' - arc in the iteration, but it is hard to obtain *after* deleting e. + + NOTE: This method reinitializes the edge records for e and its twin arc + in the base graph data structure. Extensions having parallel + edge record extension data elements must implement and use their + own edge deletion methods, which must then call gp_DeleteEdge(). + Calling gp_DeleteEdge() does not currently clear data in extension + data structures. + + Returns OK on success, NOTOK on failure ****************************************************************************/ -int gp_DeleteEdge(graphP theGraph, int e, int nextLink) +int gp_DeleteEdge(graphP theGraph, int e) { - // Calculate the nextArc after e so that, when e is deleted, the return result - // informs a calling loop of the next edge to be processed. - int nextArc = gp_GetAdjacentArc(theGraph, e, nextLink); + if (theGraph == NULL || + e < gp_GetFirstEdge(theGraph) || e >= gp_EdgeInUseArraySize(theGraph) || + gp_EdgeNotInUse(theGraph, e)) + return NOTOK; // Delete the edge records e and eTwin from their adjacency lists. gp_DetachArc(theGraph, e); @@ -1817,13 +1930,16 @@ int gp_DeleteEdge(graphP theGraph, int e, int nextLink) // If records e and eTwin were not the last in the edge record array, // then record a new hole in the edge array. */ - if (e < gp_EdgeInUseIndexBound(theGraph)) + if (e < gp_EdgeInUseArraySize(theGraph)) { + if (theGraph->edgeHoles->size + 1 >= theGraph->edgeHoles->capacity) + return NOTOK; + sp_Push(theGraph->edgeHoles, e); } // Return the previously calculated successor of e. - return nextArc; + return OK; } /******************************************************************** @@ -1842,12 +1958,12 @@ void _RestoreArc(graphP theGraph, int arc) int nextArc = gp_GetNextArc(theGraph, arc), prevArc = gp_GetPrevArc(theGraph, arc); - if (gp_IsArc(nextArc)) + if (gp_IsArc(theGraph, nextArc)) gp_SetPrevArc(theGraph, nextArc, arc); else gp_SetLastArc(theGraph, gp_GetNeighbor(theGraph, gp_GetTwinArc(theGraph, arc)), arc); - if (gp_IsArc(prevArc)) + if (gp_IsArc(theGraph, prevArc)) gp_SetNextArc(theGraph, prevArc, arc); else gp_SetFirstArc(theGraph, gp_GetNeighbor(theGraph, gp_GetTwinArc(theGraph, arc)), arc); @@ -1870,6 +1986,16 @@ void _RestoreArc(graphP theGraph, int arc) void gp_HideEdge(graphP theGraph, int e) { + if (theGraph == NULL || + e < gp_GetFirstEdge(theGraph) || e >= gp_EdgeInUseArraySize(theGraph) || + gp_EdgeNotInUse(theGraph, e)) + { +#ifdef DEBUG + NOTOK; +#endif + return; + } + theGraph->functions.fpHideEdge(theGraph, e); } @@ -1881,7 +2007,7 @@ void _HideEdge(graphP theGraph, int e) /******************************************************************** gp_RestoreEdge() - This routine reinserts two two arcs of an edge into the adjacency + This routine reinserts two arcs of an edge into the adjacency lists of the edge's endpoints, the arcs having been previously removed by gp_HideEdge(). @@ -1898,6 +2024,16 @@ void _HideEdge(graphP theGraph, int e) void gp_RestoreEdge(graphP theGraph, int e) { + if (theGraph == NULL || + e < gp_GetFirstEdge(theGraph) || e >= gp_EdgeInUseArraySize(theGraph) || + gp_EdgeNotInUse(theGraph, e)) + { +#ifdef DEBUG + NOTOK; +#endif + return; + } + theGraph->functions.fpRestoreEdge(theGraph, e); } @@ -1973,7 +2109,7 @@ int _RestoreHiddenEdges(graphP theGraph, int stackBottom) while (sp_GetCurrentSize(theGraph->theStack) > stackBottom) { sp_Pop(theGraph->theStack, e); - if (gp_IsNotArc(e)) + if (gp_IsNotArc(theGraph, e)) return NOTOK; gp_RestoreEdge(theGraph, e); } @@ -1994,8 +2130,11 @@ int _RestoreHiddenEdges(graphP theGraph, int stackBottom) int gp_HideVertex(graphP theGraph, int vertex) { - if (gp_IsNotVertex(vertex)) + if (theGraph == NULL || + vertex < gp_GetFirstVertex(theGraph) || vertex >= gp_AnyTypeVertexArraySize(theGraph)) + { return NOTOK; + } return theGraph->functions.fpHideVertex(theGraph, vertex); } @@ -2006,7 +2145,7 @@ int _HideVertex(graphP theGraph, int vertex) int e = gp_GetFirstArc(theGraph, vertex); // Cycle through all the edges, pushing and hiding each - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { sp_Push(theGraph->theStack, e); gp_HideEdge(theGraph, e); @@ -2037,8 +2176,12 @@ int _HideVertex(graphP theGraph, int vertex) int gp_ContractEdge(graphP theGraph, int e) { - if (gp_IsNotArc(e)) + if (theGraph == NULL || + e < gp_GetFirstEdge(theGraph) || e >= gp_EdgeInUseArraySize(theGraph) || + gp_EdgeNotInUse(theGraph, e)) + { return NOTOK; + } return theGraph->functions.fpContractEdge(theGraph, e); } @@ -2047,7 +2190,7 @@ int _ContractEdge(graphP theGraph, int e) { int eBefore, u, v; - if (gp_IsNotArc(e)) + if (gp_IsNotArc(theGraph, e)) return NOTOK; u = gp_GetNeighbor(theGraph, gp_GetTwinArc(theGraph, e)); @@ -2097,6 +2240,16 @@ int _ContractEdge(graphP theGraph, int e) int gp_IdentifyVertices(graphP theGraph, int u, int v, int eBefore) { + if (theGraph == NULL || + u < gp_GetFirstVertex(theGraph) || u >= gp_AnyTypeVertexArraySize(theGraph) || + v < gp_GetFirstVertex(theGraph) || v >= gp_AnyTypeVertexArraySize(theGraph) || + (eBefore != NIL && eBefore < gp_GetFirstEdge(theGraph)) || + eBefore >= gp_EdgeInUseArraySize(theGraph) || + (eBefore != NIL && gp_EdgeNotInUse(theGraph, eBefore))) + { + return NOTOK; + } + return theGraph->functions.fpIdentifyVertices(theGraph, u, v, eBefore); } @@ -2107,7 +2260,7 @@ int _IdentifyVertices(graphP theGraph, int u, int v, int eBefore) // If the vertices are adjacent, then the identification is // essentially an edge contraction with a bit of fixup. - if (gp_IsArc(e)) + if (gp_IsArc(theGraph, e)) { int result = gp_ContractEdge(theGraph, e); @@ -2137,21 +2290,21 @@ int _IdentifyVertices(graphP theGraph, int u, int v, int eBefore) // Mark as visited all neighbors of u e = gp_GetFirstArc(theGraph, u); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { - if (gp_GetVertexVisited(theGraph, gp_GetNeighbor(theGraph, e))) + if (gp_GetVisited(theGraph, gp_GetNeighbor(theGraph, e))) return NOTOK; - gp_SetVertexVisited(theGraph, gp_GetNeighbor(theGraph, e)); + gp_SetVisited(theGraph, gp_GetNeighbor(theGraph, e)); e = gp_GetNextArc(theGraph, e); } // For each edge record of v, if the neighbor is visited, then // push and hide the edge. e = gp_GetFirstArc(theGraph, v); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { - if (gp_GetVertexVisited(theGraph, gp_GetNeighbor(theGraph, e))) + if (gp_GetVisited(theGraph, gp_GetNeighbor(theGraph, e))) { sp_Push(theGraph->theStack, e); gp_HideEdge(theGraph, e); @@ -2161,9 +2314,9 @@ int _IdentifyVertices(graphP theGraph, int u, int v, int eBefore) // Mark as unvisited all neighbors of u e = gp_GetFirstArc(theGraph, u); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { - gp_ClearVertexVisited(theGraph, gp_GetNeighbor(theGraph, e)); + gp_ClearVisited(theGraph, gp_GetNeighbor(theGraph, e)); e = gp_GetNextArc(theGraph, e); } @@ -2174,7 +2327,7 @@ int _IdentifyVertices(graphP theGraph, int u, int v, int eBefore) // Moving v's adjacency list to u is aided by knowing the predecessor // of u's eBefore (the edge record in u's list before which the // edge records of v will be added). - eBeforePred = gp_IsArc(eBefore) + eBeforePred = gp_IsArc(theGraph, eBefore) ? gp_GetPrevArc(theGraph, eBefore) : gp_GetLastArc(theGraph, u); @@ -2190,19 +2343,19 @@ int _IdentifyVertices(graphP theGraph, int u, int v, int eBefore) // For the remaining edge records of v, reassign the 'v' member // of each twin arc to indicate u rather than v. e = gp_GetFirstArc(theGraph, v); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { gp_SetNeighbor(theGraph, gp_GetTwinArc(theGraph, e), u); e = gp_GetNextArc(theGraph, e); } // If v has any edges left after hiding edges, indicating common neighbors with u, ... - if (gp_IsArc(gp_GetFirstArc(theGraph, v))) + if (gp_IsArc(theGraph, gp_GetFirstArc(theGraph, v))) { // Then perform the list union of v into u between eBeforePred and eBefore - if (gp_IsArc(eBeforePred)) + if (gp_IsArc(theGraph, eBeforePred)) { - if (gp_IsArc(gp_GetFirstArc(theGraph, v))) + if (gp_IsArc(theGraph, gp_GetFirstArc(theGraph, v))) { gp_SetNextArc(theGraph, eBeforePred, gp_GetFirstArc(theGraph, v)); gp_SetPrevArc(theGraph, gp_GetFirstArc(theGraph, v), eBeforePred); @@ -2213,9 +2366,9 @@ int _IdentifyVertices(graphP theGraph, int u, int v, int eBefore) gp_SetFirstArc(theGraph, u, gp_GetFirstArc(theGraph, v)); } - if (gp_IsArc(eBefore)) + if (gp_IsArc(theGraph, eBefore)) { - if (gp_IsArc(gp_GetLastArc(theGraph, v))) + if (gp_IsArc(theGraph, gp_GetLastArc(theGraph, v))) { gp_SetNextArc(theGraph, gp_GetLastArc(theGraph, v), eBefore); gp_SetPrevArc(theGraph, eBefore, gp_GetLastArc(theGraph, v)); @@ -2277,6 +2430,9 @@ int _IdentifyVertices(graphP theGraph, int u, int v, int eBefore) int gp_RestoreVertex(graphP theGraph) { + if (theGraph == NULL) + return NOTOK; + return theGraph->functions.fpRestoreVertex(theGraph); } @@ -2296,20 +2452,20 @@ int _RestoreVertex(graphP theGraph) // If u is not NIL, then vertex v was identified with u. Otherwise, v was // simply hidden, so we skip to restoring the hidden edges. - if (gp_IsVertex(u)) + if (gp_IsVertex(theGraph, u)) { // Remove v's adjacency list from u, including accounting for degree 0 case - if (gp_IsArc(e_u_pred)) + if (gp_IsArc(theGraph, e_u_pred)) { gp_SetNextArc(theGraph, e_u_pred, e_u_succ); // If the successor edge exists, link it to the predecessor, // otherwise the predecessor is the new last arc - if (gp_IsArc(e_u_succ)) + if (gp_IsArc(theGraph, e_u_succ)) gp_SetPrevArc(theGraph, e_u_succ, e_u_pred); else gp_SetLastArc(theGraph, u, e_u_pred); } - else if (gp_IsArc(e_u_succ)) + else if (gp_IsArc(theGraph, e_u_succ)) { // The successor arc exists, but not the predecessor, // so the successor is the new first arc @@ -2326,15 +2482,15 @@ int _RestoreVertex(graphP theGraph) // Place v's adjacency list into v, including accounting for degree 0 case gp_SetFirstArc(theGraph, v, e_v_first); gp_SetLastArc(theGraph, v, e_v_last); - if (gp_IsArc(e_v_first)) + if (gp_IsArc(theGraph, e_v_first)) gp_SetPrevArc(theGraph, e_v_first, NIL); - if (gp_IsArc(e_v_last)) + if (gp_IsArc(theGraph, e_v_last)) gp_SetPrevArc(theGraph, e_v_last, NIL); // For each edge record restored to v's adjacency list, reassign the 'v' member // of each twin arc to indicate v rather than u. e = e_v_first; - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { gp_SetNeighbor(theGraph, gp_GetTwinArc(theGraph, e), v); e = (e == e_v_last ? NIL : gp_GetNextArc(theGraph, e)); @@ -2362,6 +2518,9 @@ int _RestoreVertex(graphP theGraph) int gp_RestoreVertices(graphP theGraph) { + if (theGraph == NULL) + return NOTOK; + while (sp_NonEmpty(theGraph->theStack)) { if (gp_RestoreVertex(theGraph) != OK) @@ -2388,8 +2547,8 @@ int gp_RestoreVertices(graphP theGraph) int _ComputeArcType(graphP theGraph, int a, int b, int edgeType) { - a = gp_IsVirtualVertex(theGraph, a) ? gp_GetPrimaryVertexFromRoot(theGraph, a) : a; - b = gp_IsVirtualVertex(theGraph, b) ? gp_GetPrimaryVertexFromRoot(theGraph, b) : b; + a = gp_IsVirtualVertex(theGraph, a) ? gp_GetVertexFromBicompRoot(theGraph, a) : a; + b = gp_IsVirtualVertex(theGraph, b) ? gp_GetVertexFromBicompRoot(theGraph, b) : b; if (a < b) return edgeType == EDGE_TYPE_PARENT || edgeType == EDGE_TYPE_CHILD ? EDGE_TYPE_CHILD : EDGE_TYPE_FORWARD; @@ -2411,8 +2570,8 @@ int _SetEdgeType(graphP theGraph, int u, int v) int e, eTwin, u_orig, v_orig; // If u or v is a virtual vertex (a root copy), then get the non-virtual counterpart. - u_orig = gp_IsVirtualVertex(theGraph, u) ? (gp_GetPrimaryVertexFromRoot(theGraph, u)) : u; - v_orig = gp_IsVirtualVertex(theGraph, v) ? (gp_GetPrimaryVertexFromRoot(theGraph, v)) : v; + u_orig = gp_IsVirtualVertex(theGraph, u) ? (gp_GetVertexFromBicompRoot(theGraph, u)) : u; + v_orig = gp_IsVirtualVertex(theGraph, v) ? (gp_GetVertexFromBicompRoot(theGraph, v)) : v; // Get the edge for which we will set the type @@ -2470,7 +2629,7 @@ int _SetEdgeType(graphP theGraph, int u, int v) int _DeleteUnmarkedEdgesInBicomp(graphP theGraph, int BicompRoot) { - int V, e; + int V, e, eNext; int stackBottom = sp_GetCurrentSize(theGraph->theStack); sp_Push(theGraph->theStack, BicompRoot); @@ -2479,12 +2638,15 @@ int _DeleteUnmarkedEdgesInBicomp(graphP theGraph, int BicompRoot) sp_Pop(theGraph->theStack, V); e = gp_GetFirstArc(theGraph, V); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) sp_Push(theGraph->theStack, gp_GetNeighbor(theGraph, e)); - e = gp_GetEdgeVisited(theGraph, e) ? gp_GetNextArc(theGraph, e) : gp_DeleteEdge(theGraph, e, 0); + eNext = gp_GetNextArc(theGraph, e); + if (!gp_GetEdgeVisited(theGraph, e)) + gp_DeleteEdge(theGraph, e); + e = eNext; } } return OK; @@ -2514,7 +2676,7 @@ int _ClearInvertedFlagsInBicomp(graphP theGraph, int BicompRoot) sp_Pop(theGraph->theStack, V); e = gp_GetFirstArc(theGraph, V); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) { @@ -2552,7 +2714,7 @@ int _GetBicompSize(graphP theGraph, int BicompRoot) sp_Pop(theGraph->theStack, V); theSize++; e = gp_GetFirstArc(theGraph, V); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) sp_Push(theGraph->theStack, gp_GetNeighbor(theGraph, e)); diff --git a/planarity/c/graphLib/homeomorphSearch/graphK23Search.c b/planarity/c/graphLib/homeomorphSearch/graphK23Search.c index 05dcd2a..c4bda81 100644 --- a/planarity/c/graphLib/homeomorphSearch/graphK23Search.c +++ b/planarity/c/graphLib/homeomorphSearch/graphK23Search.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -8,7 +8,7 @@ See the LICENSE.TXT file for licensing information. /* Imported functions */ -extern void _ClearVisitedFlags(graphP); +extern void _ClearAllVisitedFlagsInGraph(graphP); extern int _GetNeighborOnExtFace(graphP theGraph, int curVertex, int *pPrevLink); extern int _OrientVerticesInBicomp(graphP theGraph, int BicompRoot, int PreserveSigns); @@ -55,7 +55,7 @@ int _SearchForK23InBicomp(graphP theGraph, int v, int R) if (theGraph->IC.minorType & (MINORTYPE_A | MINORTYPE_B)) { - _ClearVisitedFlags(theGraph); + _ClearAllVisitedFlagsInGraph(theGraph); if (theGraph->IC.minorType & MINORTYPE_A) { @@ -97,7 +97,7 @@ int _SearchForK23InBicomp(graphP theGraph, int v, int R) if (IC->w != _GetNeighborOnExtFace(theGraph, X, &XPrevLink) || IC->w != _GetNeighborOnExtFace(theGraph, Y, &YPrevLink)) { - _ClearVisitedFlags(theGraph); + _ClearAllVisitedFlagsInGraph(theGraph); if (_IsolateOuterplanarityObstructionE1orE2(theGraph) != OK) return NOTOK; @@ -121,7 +121,7 @@ int _SearchForK23InBicomp(graphP theGraph, int v, int R) FUTUREPERTINENT(theGraph, Y, v) || FUTUREPERTINENT(theGraph, IC->w, v)) { - _ClearVisitedFlags(theGraph); + _ClearAllVisitedFlagsInGraph(theGraph); if (_IsolateOuterplanarityObstructionE3orE4(theGraph) != OK) return NOTOK; diff --git a/planarity/c/graphLib/homeomorphSearch/graphK23Search.h b/planarity/c/graphLib/homeomorphSearch/graphK23Search.h index d7941a9..dab2562 100644 --- a/planarity/c/graphLib/homeomorphSearch/graphK23Search.h +++ b/planarity/c/graphLib/homeomorphSearch/graphK23Search.h @@ -2,7 +2,7 @@ #define GRAPH_K23SEARCH_H /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ diff --git a/planarity/c/graphLib/homeomorphSearch/graphK23Search.private.h b/planarity/c/graphLib/homeomorphSearch/graphK23Search.private.h index 3aee68c..fd7714b 100644 --- a/planarity/c/graphLib/homeomorphSearch/graphK23Search.private.h +++ b/planarity/c/graphLib/homeomorphSearch/graphK23Search.private.h @@ -2,7 +2,7 @@ #define GRAPH_K23SEARCH_PRIVATE_H /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ diff --git a/planarity/c/graphLib/homeomorphSearch/graphK23Search_Extensions.c b/planarity/c/graphLib/homeomorphSearch/graphK23Search_Extensions.c index 00bf153..b505c17 100644 --- a/planarity/c/graphLib/homeomorphSearch/graphK23Search_Extensions.c +++ b/planarity/c/graphLib/homeomorphSearch/graphK23Search_Extensions.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -79,6 +79,8 @@ int gp_AttachK23Search(graphP theGraph) &context->functions) != OK) { _K23Search_FreeContext(context); + context = NULL; + return NOTOK; } diff --git a/planarity/c/graphLib/homeomorphSearch/graphK33Search.c b/planarity/c/graphLib/homeomorphSearch/graphK33Search.c index b49b408..a7b1103 100644 --- a/planarity/c/graphLib/homeomorphSearch/graphK33Search.c +++ b/planarity/c/graphLib/homeomorphSearch/graphK33Search.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -13,10 +13,10 @@ See the LICENSE.TXT file for licensing information. /* Imported functions */ -// extern void _ClearVisitedFlags(graphP); -extern int _ClearVisitedFlagsInBicomp(graphP theGraph, int BicompRoot); -extern int _ClearVisitedFlagsInOtherBicomps(graphP theGraph, int BicompRoot); -extern void _ClearVisitedFlagsInUnembeddedEdges(graphP theGraph); +// extern void _ClearAllVisitedFlagsInGraph(graphP); +extern int _ClearAllVisitedFlagsInBicomp(graphP theGraph, int BicompRoot); +extern int _ClearAllVisitedFlagsInOtherBicomps(graphP theGraph, int BicompRoot); +extern void _ClearEdgeVisitedFlagsInUnembeddedEdges(graphP theGraph); extern int _FillVertexVisitedInfoInBicomp(graphP theGraph, int BicompRoot, int FillValue); // extern int _GetBicompSize(graphP theGraph, int BicompRoot); @@ -31,8 +31,8 @@ extern int _JoinBicomps(graphP theGraph); extern int _OrientVerticesInBicomp(graphP theGraph, int BicompRoot, int PreserveSigns); extern int _OrientVerticesInEmbedding(graphP theGraph); // extern void _InvertVertex(graphP theGraph, int V); -extern int _ClearVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x); -extern int _SetVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x); +extern int _ClearAllVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x); +extern int _SetAllVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x); extern int _OrientExternalFacePath(graphP theGraph, int u, int v, int w, int x); extern int _ChooseTypeOfNonplanarityMinor(graphP theGraph, int v, int R); @@ -82,7 +82,7 @@ int _FindK33WithMergeBlocker(graphP theGraph, K33SearchContext *context, int v, int _TestForZtoWPath(graphP theGraph); int _TestForStraddlingBridge(graphP theGraph, K33SearchContext *context, int u_max); int _K33Search_DeleteUnmarkedEdgesInBicomp(graphP theGraph, K33SearchContext *context, int BicompRoot); -int _K33Search_DeleteEdge(graphP theGraph, K33SearchContext *context, int e, int nextLink); +int _K33Search_DeleteEdge(graphP theGraph, K33SearchContext *context, int e); int _ReduceBicomp(graphP theGraph, K33SearchContext *context, int R); int _ReduceExternalFacePathToEdge(graphP theGraph, K33SearchContext *context, int u, int x, int edgeType); int _ReduceXYPathToEdge(graphP theGraph, K33SearchContext *context, int u, int x, int edgeType); @@ -360,7 +360,7 @@ int _RunExtraK33Tests(graphP theGraph, K33SearchContext *context) // x-y path, so we need to clear the visited flags of that path before marking // instead the x-y path with the lowest attachment points (those closest to W // along the external face). - if (_ClearVisitedFlagsInBicomp(theGraph, IC->r) != OK) + if (_ClearAllVisitedFlagsInBicomp(theGraph, IC->r) != OK) return NOTOK; // Now mark the lowest x-y path so that we can test whether _any_ x-y path @@ -396,7 +396,7 @@ int _RunExtraK33Tests(graphP theGraph, K33SearchContext *context) if (_TestForZtoWPath(theGraph) != OK) return NOTOK; - if (gp_GetVertexVisited(theGraph, IC->w)) + if (gp_GetVisited(theGraph, IC->w)) { if (_FinishIsolatorContextInitialization(theGraph, context) != OK || _IsolateMinorE5(theGraph) != OK) @@ -414,7 +414,7 @@ int _RunExtraK33Tests(graphP theGraph, K33SearchContext *context) if (IC->uz < u_max) { - if (gp_IsVertex(_TestForStraddlingBridge(theGraph, context, u_max))) + if (gp_IsVertex(theGraph, _TestForStraddlingBridge(theGraph, context, u_max))) { if (_FinishIsolatorContextInitialization(theGraph, context) != OK || _IsolateMinorE6(theGraph, context) != OK) @@ -433,7 +433,7 @@ int _RunExtraK33Tests(graphP theGraph, K33SearchContext *context) if (IC->ux < u_max || IC->uy < u_max) { - if (gp_IsVertex(_TestForStraddlingBridge(theGraph, context, u_max))) + if (gp_IsVertex(theGraph, _TestForStraddlingBridge(theGraph, context, u_max))) { if (_FinishIsolatorContextInitialization(theGraph, context) != OK || _IsolateMinorE7(theGraph, context) != OK) @@ -485,14 +485,14 @@ int _SearchForMinorE1(graphP theGraph) RYW path. Otherwise, the order is (X, new Z, new W, Y), so the new Z (old W with no type) is type changed to be on the RXW path.*/ - if (gp_GetVertexObstructionType(theGraph, Z) == VERTEX_OBSTRUCTIONTYPE_LOW_RXW) - gp_ResetVertexObstructionType(theGraph, theGraph->IC.z, VERTEX_OBSTRUCTIONTYPE_LOW_RYW); + if (gp_GetObstructionMark(theGraph, Z) == ANYVERTEX_OBSTRUCTIONMARK_LOW_RXW) + gp_ResetObstructionMark(theGraph, theGraph->IC.z, ANYVERTEX_OBSTRUCTIONMARK_LOW_RYW); else - gp_ResetVertexObstructionType(theGraph, theGraph->IC.z, VERTEX_OBSTRUCTIONTYPE_LOW_RXW); + gp_ResetObstructionMark(theGraph, theGraph->IC.z, ANYVERTEX_OBSTRUCTIONMARK_LOW_RXW); /* For completeness, we change the new W to type unknown */ - gp_ClearVertexObstructionType(theGraph, theGraph->IC.w); + gp_ClearObstructionMark(theGraph, theGraph->IC.w); /* The external activity ancestor connection of the new Z must be obtained */ @@ -537,14 +537,14 @@ int _FinishIsolatorContextInitialization(graphP theGraph, K33SearchContext *cont /* We assume that the current bicomp has been marked appropriately, but we must now clear the visitation flags of all other bicomps. */ - if (_ClearVisitedFlagsInOtherBicomps(theGraph, IC->r) != OK) + if (_ClearAllVisitedFlagsInOtherBicomps(theGraph, IC->r) != OK) return NOTOK; - /* To complete the normal behavior of _ClearVisitedFlags() in the + /* To complete the normal behavior of _ClearAllVisitedFlagsInGraph() in the normal isolator context initialization, we also have to clear the visited flags on all edges that have not yet been embedded */ - _ClearVisitedFlagsInUnembeddedEdges(theGraph); + _ClearEdgeVisitedFlagsInUnembeddedEdges(theGraph); /* Now we can find the descendant ends of unembedded back edges based on the ancestor settings ux, uy and uz. */ @@ -582,7 +582,7 @@ int _Fast_GetLeastAncestorConnection(graphP theGraph, K33SearchContext *context, int ancestor = gp_GetVertexLeastAncestor(theGraph, cutVertex); int child = context->VI[cutVertex].separatedDFSChildList; - if (gp_IsVertex(child) && ancestor > gp_GetVertexLowpoint(theGraph, child)) + if (gp_IsVertex(theGraph, child) && ancestor > gp_GetVertexLowpoint(theGraph, child)) ancestor = gp_GetVertexLowpoint(theGraph, child); return ancestor; @@ -601,7 +601,7 @@ int _GetAdjacentAncestorInRange(graphP theGraph, K33SearchContext *context, int { int e = context->VI[theVertex].backArcList; - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (gp_GetNeighbor(theGraph, e) < closerAncestor && gp_GetNeighbor(theGraph, e) > fartherAncestor) @@ -630,7 +630,7 @@ int _SearchForDescendantExternalConnection(graphP theGraph, K33SearchContext *co int child, descendant; // Test cutVertex for an external connection to descendant of u_max via direct back edge - if (gp_IsVertex(u2)) + if (gp_IsVertex(theGraph, u2)) return u2; // If there is no direct back edge connection from the cut vertex @@ -643,7 +643,7 @@ int _SearchForDescendantExternalConnection(graphP theGraph, K33SearchContext *co // lowpoints indicating connections to ancestors of the current vertex. sp_ClearStack(theGraph->theStack); child = gp_GetVertexSortedDFSChildList(theGraph, cutVertex); - while (gp_IsVertex(child)) + while (gp_IsVertex(theGraph, child)) { if (gp_GetVertexLowpoint(theGraph, child) < IC->v && gp_IsSeparatedDFSChild(theGraph, child)) sp_Push(theGraph->theStack, child); @@ -661,12 +661,12 @@ int _SearchForDescendantExternalConnection(graphP theGraph, K33SearchContext *co { // Check the subtree root for the desired connection. u2 = _GetAdjacentAncestorInRange(theGraph, context, descendant, IC->v, u_max); - if (gp_IsVertex(u2)) + if (gp_IsVertex(theGraph, u2)) return u2; // Push each child as a new subtree root to be considered, except skip those whose lowpoint is too great. child = gp_GetVertexSortedDFSChildList(theGraph, descendant); - while (gp_IsVertex(child)) + while (gp_IsVertex(theGraph, child)) { if (gp_GetVertexLowpoint(theGraph, child) < IC->v) sp_Push(theGraph->theStack, child); @@ -707,7 +707,7 @@ int _FindExternalConnectionDescendantEndpoint(graphP theGraph, int ancestor, // by an unembedded back edge. e = gp_GetVertexFwdArcList(theGraph, ancestor); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (gp_GetNeighbor(theGraph, e) == cutVertex) { @@ -723,7 +723,7 @@ int _FindExternalConnectionDescendantEndpoint(graphP theGraph, int ancestor, // Now check the descendants of the cut vertex to see if any make // a connection to the ancestor. child = gp_GetVertexSortedDFSChildList(theGraph, cutVertex); - while (gp_IsVertex(child)) + while (gp_IsVertex(theGraph, child)) { if (gp_GetVertexLowpoint(theGraph, child) < theGraph->IC.v && gp_IsSeparatedDFSChild(theGraph, child)) { @@ -778,7 +778,7 @@ int _SearchForMergeBlocker(graphP theGraph, K33SearchContext *context, int v, in sp_Pop2_Discard(tempStack); /* Move (R, Rout) out of the way */ sp_Pop2_Discard1(tempStack, Z); /* Get Z, discard ZPrevLink */ - if (gp_IsVertex(context->VI[Z].mergeBlocker) && + if (gp_IsVertex(theGraph, context->VI[Z].mergeBlocker) && context->VI[Z].mergeBlocker < v) { *pMergeBlocker = Z; @@ -828,11 +828,11 @@ int _FindK33WithMergeBlocker(graphP theGraph, K33SearchContext *context, int v, /* Switch the 'current step' variable v to be equal to the non-virtual counterpart of the bicomp root. */ - IC->v = gp_GetPrimaryVertexFromRoot(theGraph, R); + IC->v = gp_GetVertexFromBicompRoot(theGraph, R); /* Reinitialize the visitation, pertinence and future pertinence settings from step u_max for step v */ - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) { gp_SetVertexVisitedInfo(theGraph, v, theGraph->N); gp_SetVertexPertinentEdge(theGraph, v, NIL); @@ -847,7 +847,7 @@ int _FindK33WithMergeBlocker(graphP theGraph, K33SearchContext *context, int v, back edge that was not embedded when step v was originally performed. */ e = gp_GetVertexFwdArcList(theGraph, IC->v); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { theGraph->functions.fpWalkUp(theGraph, IC->v, e); @@ -996,13 +996,13 @@ int _TestForZtoWPath(graphP theGraph) { sp_Pop2(theGraph->theStack, v, e); - if (gp_IsNotArc(e)) + if (gp_IsNotArc(theGraph, e)) { // If the vertex is visited, then it is a member of the X-Y path // Because it is being popped, its obstruction type is unknown because // that is the only kind of vertex pushed. // Hence, we break because we've found the desired path. - if (gp_GetVertexVisited(theGraph, v)) + if (gp_GetVisited(theGraph, v)) break; // Mark this vertex as being visited by this method (i.e. ineligible @@ -1018,7 +1018,7 @@ int _TestForZtoWPath(graphP theGraph) // pushed. Once that happens, we break. The successive edges of a vertex are // only pushed (see the else clause above) once all paths extending from v // through e have been explored and found not to contain the desired path - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { w = gp_GetNeighbor(theGraph, e); @@ -1026,7 +1026,7 @@ int _TestForZtoWPath(graphP theGraph) // but it can never happen due to the obstructing X-Y path. if (gp_IsNotVirtualVertex(theGraph, w) && gp_GetVertexVisitedInfo(theGraph, w) != -1 && - gp_GetVertexObstructionType(theGraph, w) == VERTEX_OBSTRUCTIONTYPE_UNKNOWN) + gp_GetObstructionMark(theGraph, w) == ANYVERTEX_OBSTRUCTIONMARK_UNMARKED) { sp_Push2(theGraph->theStack, v, e); sp_Push2(theGraph->theStack, w, NIL); @@ -1041,7 +1041,7 @@ int _TestForZtoWPath(graphP theGraph) while (!sp_IsEmpty(theGraph->theStack)) { sp_Pop2(theGraph->theStack, v, e); - gp_SetVertexVisited(theGraph, v); + gp_SetVisited(theGraph, v); gp_SetEdgeVisited(theGraph, e); gp_SetEdgeVisited(theGraph, gp_GetTwinArc(theGraph, e)); } @@ -1100,7 +1100,7 @@ int _TestForStraddlingBridge(graphP theGraph, K33SearchContext *context, int u_m int p, c, d, excludedChild, e; p = IC->v; - excludedChild = gp_GetDFSChildFromRoot(theGraph, IC->r); + excludedChild = gp_GetDFSChildFromBicompRoot(theGraph, IC->r); d = NIL; // Starting at V, traverse the ancestor path to u_max looking for a straddling bridge @@ -1136,7 +1136,7 @@ int _TestForStraddlingBridge(graphP theGraph, K33SearchContext *context, int u_m if (c == excludedChild) c = LCGetNext(context->separatedDFSChildLists, c, c); - if (gp_IsVertex(c) && gp_GetVertexLowpoint(theGraph, c) < u_max) + if (gp_IsVertex(theGraph, c) && gp_GetVertexLowpoint(theGraph, c) < u_max) { _FindUnembeddedEdgeToSubtree(theGraph, gp_GetVertexLowpoint(theGraph, c), c, &d); break; @@ -1153,13 +1153,13 @@ int _TestForStraddlingBridge(graphP theGraph, K33SearchContext *context, int u_m } // If d is NIL, then no straddling bridge was found, so we do the noStraddle optimization. - if (gp_IsNotVertex(d)) + if (gp_IsNotVertex(theGraph, d)) { c = IC->v; while (c != p) { e = gp_GetFirstArc(theGraph, c); - if (gp_IsVertex(context->E[e].noStraddle)) + if (gp_IsVertex(theGraph, context->E[e].noStraddle)) break; context->E[e].noStraddle = u_max; @@ -1189,7 +1189,7 @@ int _TestForStraddlingBridge(graphP theGraph, K33SearchContext *context, int u_m For example, _FindK33WithMergeBlocker() invokes ChooseTypeOfNonplanarityMinor() to help reconstruct the context under which the mergeBlocker was set. - ChooseTypeOfNonplanarityMinor() calls _ClearVisitedFlagsInBicomp(), which + ChooseTypeOfNonplanarityMinor() calls _ClearAllVisitedFlagsInBicomp(), which depends on the DFS tree. NOTE: The following are some general steps taken in this method: @@ -1332,7 +1332,7 @@ int _ReduceBicomp(graphP theGraph, K33SearchContext *context, int R) flags so the current X-Y path will not be retained (an X-Y path formed mostly or entirely from DFS tree edges is retained). */ - if (_ClearVisitedFlagsInBicomp(theGraph, R) != OK) + if (_ClearAllVisitedFlagsInBicomp(theGraph, R) != OK) return NOTOK; /* Now we mark the tree path from the maximum numbered vertex up @@ -1380,7 +1380,7 @@ int _ReduceBicomp(graphP theGraph, K33SearchContext *context, int R) /* Clear all visited flags in the bicomp. This is the important "step 4" mentioned in the NOTE above */ - if (_ClearVisitedFlagsInBicomp(theGraph, R) != OK) + if (_ClearAllVisitedFlagsInBicomp(theGraph, R) != OK) return NOTOK; /* Clear all orientation signs in the bicomp. @@ -1420,12 +1420,12 @@ int _ReduceBicomp(graphP theGraph, K33SearchContext *context, int R) marked for isolation. ********************************************************************/ -int _K33Search_DeleteEdge(graphP theGraph, K33SearchContext *context, int e, int nextLink) +int _K33Search_DeleteEdge(graphP theGraph, K33SearchContext *context, int e) { _K33Search_InitEdgeRec(context, e); _K33Search_InitEdgeRec(context, gp_GetTwinArc(theGraph, e)); - return gp_DeleteEdge(theGraph, e, nextLink); + return gp_DeleteEdge(theGraph, e); } /******************************************************************** @@ -1446,7 +1446,7 @@ int _K33Search_DeleteEdge(graphP theGraph, K33SearchContext *context, int e, int int _K33Search_DeleteUnmarkedEdgesInBicomp(graphP theGraph, K33SearchContext *context, int BicompRoot) { - int V, e; + int V, e, eNext; int stackBottom = sp_GetCurrentSize(theGraph->theStack); sp_Push(theGraph->theStack, BicompRoot); @@ -1455,14 +1455,15 @@ int _K33Search_DeleteUnmarkedEdgesInBicomp(graphP theGraph, K33SearchContext *co sp_Pop(theGraph->theStack, V); e = gp_GetFirstArc(theGraph, V); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) sp_Push(theGraph->theStack, gp_GetNeighbor(theGraph, e)); - e = gp_GetEdgeVisited(theGraph, e) - ? gp_GetNextArc(theGraph, e) - : _K33Search_DeleteEdge(theGraph, context, e, 0); + eNext = gp_GetNextArc(theGraph, e); + if (!gp_GetEdgeVisited(theGraph, e)) + _K33Search_DeleteEdge(theGraph, context, e); + e = eNext; } } return OK; @@ -1503,24 +1504,24 @@ int _ReduceExternalFacePathToEdge(graphP theGraph, K33SearchContext *context, in not a reduction edge. */ e = gp_GetFirstArc(theGraph, u); - if (gp_IsVertex(context->E[e].pathConnector)) + if (gp_IsAnyTypeVertex(theGraph, context->E[e].pathConnector)) { if (_RestoreReducedPath(theGraph, context, e) != OK) return NOTOK; e = gp_GetFirstArc(theGraph, u); v = gp_GetNeighbor(theGraph, e); } - _K33Search_DeleteEdge(theGraph, context, e, 0); + _K33Search_DeleteEdge(theGraph, context, e); e = gp_GetLastArc(theGraph, x); - if (gp_IsVertex(context->E[e].pathConnector)) + if (gp_IsAnyTypeVertex(theGraph, context->E[e].pathConnector)) { if (_RestoreReducedPath(theGraph, context, e) != OK) return NOTOK; e = gp_GetLastArc(theGraph, x); w = gp_GetNeighbor(theGraph, e); } - _K33Search_DeleteEdge(theGraph, context, e, 0); + _K33Search_DeleteEdge(theGraph, context, e); /* Add the reduction edge, then set its path connectors so the original path can be recovered and set the edge type so the essential structure @@ -1564,7 +1565,7 @@ int _ReduceXYPathToEdge(graphP theGraph, K33SearchContext *context, int u, int x /* Otherwise, remove the two edges that join the XY-path to the bicomp */ - if (gp_IsVertex(context->E[e].pathConnector)) + if (gp_IsAnyTypeVertex(theGraph, context->E[e].pathConnector)) { if (_RestoreReducedPath(theGraph, context, e) != OK) return NOTOK; @@ -1572,12 +1573,12 @@ int _ReduceXYPathToEdge(graphP theGraph, K33SearchContext *context, int u, int x e = gp_GetNextArc(theGraph, e); v = gp_GetNeighbor(theGraph, e); } - _K33Search_DeleteEdge(theGraph, context, e, 0); + _K33Search_DeleteEdge(theGraph, context, e); e = gp_GetFirstArc(theGraph, x); e = gp_GetNextArc(theGraph, e); w = gp_GetNeighbor(theGraph, e); - if (gp_IsVertex(context->E[e].pathConnector)) + if (gp_IsAnyTypeVertex(theGraph, context->E[e].pathConnector)) { if (_RestoreReducedPath(theGraph, context, e) != OK) return NOTOK; @@ -1585,7 +1586,7 @@ int _ReduceXYPathToEdge(graphP theGraph, K33SearchContext *context, int u, int x e = gp_GetNextArc(theGraph, e); w = gp_GetNeighbor(theGraph, e); } - _K33Search_DeleteEdge(theGraph, context, e, 0); + _K33Search_DeleteEdge(theGraph, context, e); /* Now add a single edge to represent the XY-path */ gp_InsertEdge(theGraph, u, gp_GetFirstArc(theGraph, u), 0, @@ -1622,7 +1623,7 @@ int _RestoreReducedPath(graphP theGraph, K33SearchContext *context, int e) int eTwin, u, v, w, x; int e0, e1, eTwin0, eTwin1; - if (gp_IsNotVertex(context->E[e].pathConnector)) + if (gp_IsNotAnyTypeVertex(theGraph, context->E[e].pathConnector)) return OK; eTwin = gp_GetTwinArc(theGraph, e); @@ -1644,13 +1645,13 @@ int _RestoreReducedPath(graphP theGraph, K33SearchContext *context, int e) /* We first delete the edge represented by e and eTwin. We do so before restoring the path to ensure we do not exceed the maximum arc capacity. */ - _K33Search_DeleteEdge(theGraph, context, e, 0); + _K33Search_DeleteEdge(theGraph, context, e); /* Now we add the two edges to reconnect the reduced path represented by the edge [e, eTwin]. The edge record in u is added between e0 and e1. Likewise, the new edge record in x is added between eTwin0 and eTwin1. */ - if (gp_IsArc(e0)) + if (gp_IsArc(theGraph, e0)) { if (gp_InsertEdge(theGraph, u, e0, 1, v, NIL, 0) != OK) return NOTOK; @@ -1661,7 +1662,7 @@ int _RestoreReducedPath(graphP theGraph, K33SearchContext *context, int e) return NOTOK; } - if (gp_IsArc(eTwin0)) + if (gp_IsArc(theGraph, eTwin0)) { if (gp_InsertEdge(theGraph, x, eTwin0, 1, w, NIL, 0) != OK) return NOTOK; @@ -1702,10 +1703,10 @@ int _RestoreAndOrientReducedPaths(graphP theGraph, K33SearchContext *context) int EsizeOccupied, e, eTwin, u, v, w, x, visited; int e0, eTwin0, e1, eTwin1; - EsizeOccupied = gp_EdgeInUseIndexBound(theGraph); + EsizeOccupied = gp_EdgeInUseArraySize(theGraph); for (e = gp_GetFirstEdge(theGraph); e < EsizeOccupied;) { - if (gp_IsVertex(context->E[e].pathConnector)) + if (gp_IsAnyTypeVertex(theGraph, context->E[e].pathConnector)) { visited = gp_GetEdgeVisited(theGraph, e); @@ -1729,13 +1730,13 @@ int _RestoreAndOrientReducedPaths(graphP theGraph, K33SearchContext *context) /* We first delete the edge represented by e and eTwin. We do so before restoring the path to ensure we do not exceed the maximum arc capacity. */ - _K33Search_DeleteEdge(theGraph, context, e, 0); + _K33Search_DeleteEdge(theGraph, context, e); /* Now we add the two edges to reconnect the reduced path represented by the edge [e, eTwin]. The edge record in u is added between e0 and e1. Likewise, the new edge record in x is added between eTwin0 and eTwin1. */ - if (gp_IsArc(e0)) + if (gp_IsArc(theGraph, e0)) { if (gp_InsertEdge(theGraph, u, e0, 1, v, NIL, 0) != OK) return NOTOK; @@ -1746,7 +1747,7 @@ int _RestoreAndOrientReducedPaths(graphP theGraph, K33SearchContext *context) return NOTOK; } - if (gp_IsArc(eTwin0)) + if (gp_IsArc(theGraph, eTwin0)) { if (gp_InsertEdge(theGraph, x, eTwin0, 1, w, NIL, 0) != OK) return NOTOK; @@ -1774,7 +1775,7 @@ int _RestoreAndOrientReducedPaths(graphP theGraph, K33SearchContext *context) and last edges of a vertex are the ones that hold it onto the external face, if it is on the external face. */ - if ((gp_IsNotArc(e0) && gp_IsNotArc(eTwin1)) || (gp_IsNotArc(e1) && gp_IsNotArc(eTwin0))) + if ((gp_IsNotArc(theGraph, e0) && gp_IsNotArc(theGraph, eTwin1)) || (gp_IsNotArc(theGraph, e1) && gp_IsNotArc(theGraph, eTwin0))) { if (_OrientExternalFacePath(theGraph, u, v, w, x) != OK) return NOTOK; @@ -1789,12 +1790,12 @@ int _RestoreAndOrientReducedPaths(graphP theGraph, K33SearchContext *context) if (visited) { - if (_SetVisitedFlagsOnPath(theGraph, u, v, w, x) != OK) + if (_SetAllVisitedFlagsOnPath(theGraph, u, v, w, x) != OK) return NOTOK; } else { - if (_ClearVisitedFlagsOnPath(theGraph, u, v, w, x) != OK) + if (_ClearAllVisitedFlagsOnPath(theGraph, u, v, w, x) != OK) return NOTOK; } } @@ -1821,12 +1822,12 @@ int _MarkStraddlingBridgePath(graphP theGraph, int u_min, int u_max, int u_d, in return NOTOK; p = d; - while (!gp_GetVertexVisited(theGraph, p)) + while (!gp_GetVisited(theGraph, p)) { - gp_SetVertexVisited(theGraph, p); + gp_SetVisited(theGraph, p); e = gp_GetFirstArc(theGraph, p); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_PARENT) break; @@ -1842,8 +1843,8 @@ int _MarkStraddlingBridgePath(graphP theGraph, int u_min, int u_max, int u_d, in /* If p is a root copy, mark it visited and skip to the parent copy */ if (gp_IsVirtualVertex(theGraph, p)) { - gp_SetVertexVisited(theGraph, p); - p = gp_GetPrimaryVertexFromRoot(theGraph, p); + gp_SetVisited(theGraph, p); + p = gp_GetVertexFromBicompRoot(theGraph, p); } } @@ -1856,7 +1857,7 @@ int _MarkStraddlingBridgePath(graphP theGraph, int u_min, int u_max, int u_d, in while (p != u_max) { e = gp_GetFirstArc(theGraph, p); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_PARENT) break; @@ -1868,15 +1869,15 @@ int _MarkStraddlingBridgePath(graphP theGraph, int u_min, int u_max, int u_d, in gp_ClearEdgeVisited(theGraph, gp_GetTwinArc(theGraph, e)); p = gp_GetNeighbor(theGraph, e); - gp_ClearVertexVisited(theGraph, p); + gp_ClearVisited(theGraph, p); /* If p is a root copy, clear its visited flag and skip to the parent copy */ if (gp_IsVirtualVertex(theGraph, p)) { - p = gp_GetPrimaryVertexFromRoot(theGraph, p); - gp_ClearVertexVisited(theGraph, p); + p = gp_GetVertexFromBicompRoot(theGraph, p); + gp_ClearVisited(theGraph, p); } } @@ -1927,7 +1928,7 @@ int _IsolateMinorE6(graphP theGraph, K33SearchContext *context) /* Clear the previously marked x-y path */ - if (_ClearVisitedFlagsInBicomp(theGraph, IC->r) != OK) + if (_ClearAllVisitedFlagsInBicomp(theGraph, IC->r) != OK) return NOTOK; /* Clear dw to stop the marking of path (v, w) */ diff --git a/planarity/c/graphLib/homeomorphSearch/graphK33Search.h b/planarity/c/graphLib/homeomorphSearch/graphK33Search.h index 074a076..e247be2 100644 --- a/planarity/c/graphLib/homeomorphSearch/graphK33Search.h +++ b/planarity/c/graphLib/homeomorphSearch/graphK33Search.h @@ -2,7 +2,7 @@ #define GRAPH_K33SEARCH_H /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ diff --git a/planarity/c/graphLib/homeomorphSearch/graphK33Search.private.h b/planarity/c/graphLib/homeomorphSearch/graphK33Search.private.h index 36c36ff..9f1d987 100644 --- a/planarity/c/graphLib/homeomorphSearch/graphK33Search.private.h +++ b/planarity/c/graphLib/homeomorphSearch/graphK33Search.private.h @@ -2,7 +2,7 @@ #define GRAPH_K33SEARCH_PRIVATE_H /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -22,7 +22,7 @@ extern "C" typedef K33Search_EdgeRec *K33Search_EdgeRecP; - // Additional equipment for each primary vertex + // Additional equipment for each vertex (non-virtual only) typedef struct { int separatedDFSChildList, backArcList, mergeBlocker; diff --git a/planarity/c/graphLib/homeomorphSearch/graphK33Search_Extensions.c b/planarity/c/graphLib/homeomorphSearch/graphK33Search_Extensions.c index d449dd8..9b0e2db 100644 --- a/planarity/c/graphLib/homeomorphSearch/graphK33Search_Extensions.c +++ b/planarity/c/graphLib/homeomorphSearch/graphK33Search_Extensions.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -116,6 +116,8 @@ int gp_AttachK33Search(graphP theGraph) &context->functions) != OK) { _K33Search_FreeContext(context); + context = NULL; + return NOTOK; } @@ -131,6 +133,8 @@ int gp_AttachK33Search(graphP theGraph) _K33Search_InitStructures(context) != OK) { _K33Search_FreeContext(context); + context = NULL; + return NOTOK; } } @@ -196,8 +200,8 @@ void _K33Search_ClearStructures(K33SearchContext *context) ********************************************************************/ int _K33Search_CreateStructures(K33SearchContext *context) { - int VIsize = gp_PrimaryVertexIndexBound(context->theGraph); - int Esize = gp_EdgeIndexBound(context->theGraph); + int VIsize = gp_VertexArraySize(context->theGraph); + int Esize = gp_EdgeArraySize(context->theGraph); if (context->theGraph->N <= 0) return NOTOK; @@ -219,8 +223,8 @@ int _K33Search_CreateStructures(K33SearchContext *context) ********************************************************************/ int _K33Search_InitStructures(K33SearchContext *context) { - memset(context->VI, NIL_CHAR, gp_PrimaryVertexIndexBound(context->theGraph) * sizeof(K33Search_VertexInfo)); - memset(context->E, NIL_CHAR, gp_EdgeIndexBound(context->theGraph) * sizeof(K33Search_EdgeRec)); + memset(context->VI, NIL_CHAR, gp_VertexArraySize(context->theGraph) * sizeof(K33Search_VertexInfo)); + memset(context->E, NIL_CHAR, gp_EdgeArraySize(context->theGraph) * sizeof(K33Search_EdgeRec)); // N.B. This is the legacy API-based approach to initializing the structures // required for the K_{3, 3} search graph algorithm extension. // graphP theGraph = context->theGraph; @@ -229,10 +233,10 @@ int _K33Search_InitStructures(K33SearchContext *context) // if (theGraph->N <= 0) // return OK; - // for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + // for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) // _K33Search_InitVertexInfo(context, v); - // Esize = gp_EdgeIndexBound(theGraph); + // Esize = gp_EdgeArraySize(theGraph); // for (e = gp_GetFirstEdge(theGraph); e < Esize; e++) // _K33Search_InitEdgeRec(context, e); @@ -311,8 +315,8 @@ void *_K33Search_DupContext(void *pContext, void *theGraph) if (newContext != NULL) { - int VIsize = gp_PrimaryVertexIndexBound((graphP)theGraph); - int Esize = gp_EdgeIndexBound((graphP)theGraph); + int VIsize = gp_VertexArraySize((graphP)theGraph); + int Esize = gp_EdgeArraySize((graphP)theGraph); *newContext = *context; @@ -325,6 +329,8 @@ void *_K33Search_DupContext(void *pContext, void *theGraph) if (_K33Search_CreateStructures(newContext) != OK) { _K33Search_FreeContext(newContext); + newContext = NULL; + return NULL; } @@ -387,17 +393,17 @@ void _CreateBackArcLists(graphP theGraph, K33SearchContext *context) { int v, e, eTwin, ancestor; - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) { e = gp_GetVertexFwdArcList(theGraph, v); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { // Get the ancestor endpoint and the associated back arc ancestor = gp_GetNeighbor(theGraph, e); eTwin = gp_GetTwinArc(theGraph, e); // Put it into the back arc list of the ancestor - if (gp_IsNotArc(context->VI[ancestor].backArcList)) + if (gp_IsNotArc(theGraph, context->VI[ancestor].backArcList)) { context->VI[ancestor].backArcList = eTwin; gp_SetPrevArc(theGraph, eTwin, eTwin); @@ -438,12 +444,12 @@ void _CreateSeparatedDFSChildLists(graphP theGraph, K33SearchContext *context) // Initialize the bin and all the buckets to be empty LCReset(bin); - for (L = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, L); L++) + for (L = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, L); L++) buckets[L] = NIL; // For each vertex, add it to the bucket whose index is equal to the lowpoint of the vertex. - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) { L = gp_GetVertexLowpoint(theGraph, v); buckets[L] = LCAppend(bin, buckets[L], v); @@ -453,16 +459,16 @@ void _CreateSeparatedDFSChildLists(graphP theGraph, K33SearchContext *context) // Since lower numbered buckets are processed before higher numbered buckets, vertices with lower // lowpoint values are added before those with higher lowpoint values, so the separatedDFSChildList // of each vertex is sorted by lowpoint - for (L = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, L); L++) + for (L = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, L); L++) { v = buckets[L]; // Loop through all the vertices with lowpoint L, putting each in the list of its parent - while (gp_IsVertex(v)) + while (gp_IsVertex(theGraph, v)) { DFSParent = gp_GetVertexParent(theGraph, v); - if (gp_IsVertex(DFSParent) && DFSParent != v) + if (gp_IsVertex(theGraph, DFSParent) && DFSParent != v) { theList = context->VI[DFSParent].separatedDFSChildList; theList = LCAppend(context->separatedDFSChildLists, theList, v); @@ -551,7 +557,7 @@ int _K33Search_MergeBicomps(graphP theGraph, int v, int RootVertex, int W, int W if (_SearchForMergeBlocker(theGraph, context, v, &mergeBlocker) != OK) return NOTOK; - if (gp_IsVertex(mergeBlocker)) + if (gp_IsVertex(theGraph, mergeBlocker)) { if (_FindK33WithMergeBlocker(theGraph, context, v, mergeBlocker) != OK) return NOTOK; @@ -593,7 +599,7 @@ void _K33Search_MergeVertex(graphP theGraph, int W, int WPrevLink, int R) if (theGraph->embedFlags == EMBEDFLAGS_SEARCHFORK33) { int theList = context->VI[W].separatedDFSChildList; - theList = LCDelete(context->separatedDFSChildLists, theList, gp_GetDFSChildFromRoot(theGraph, R)); + theList = LCDelete(context->separatedDFSChildLists, theList, gp_GetDFSChildFromBicompRoot(theGraph, R)); context->VI[W].separatedDFSChildList = theList; } diff --git a/planarity/c/graphLib/homeomorphSearch/graphK4Search.c b/planarity/c/graphLib/homeomorphSearch/graphK4Search.c index 9364fcf..8d33231 100644 --- a/planarity/c/graphLib/homeomorphSearch/graphK4Search.c +++ b/planarity/c/graphLib/homeomorphSearch/graphK4Search.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -14,11 +14,11 @@ extern int K4SEARCH_ID; /* Imported functions */ extern void _InitIsolatorContext(graphP theGraph); -extern void _ClearVisitedFlags(graphP); -extern int _ClearVisitedFlagsInBicomp(graphP theGraph, int BicompRoot); -// extern int _ClearVisitedFlagsInOtherBicomps(graphP theGraph, int BicompRoot); -// extern void _ClearVisitedFlagsInUnembeddedEdges(graphP theGraph); -extern int _ClearVertexTypeInBicomp(graphP theGraph, int BicompRoot); +extern void _ClearAllVisitedFlagsInGraph(graphP); +extern int _ClearAllVisitedFlagsInBicomp(graphP theGraph, int BicompRoot); +// extern int _ClearAllVisitedFlagsInOtherBicomps(graphP theGraph, int BicompRoot); +// extern void _ClearEdgeVisitedFlagsInUnembeddedEdges(graphP theGraph); +extern int _ClearObstructionMarkInBicomp(graphP theGraph, int BicompRoot); // extern int _DeleteUnmarkedEdgesInBicomp(graphP theGraph, int BicompRoot); extern int _ComputeArcType(graphP theGraph, int a, int b, int edgeType); extern int _SetEdgeType(graphP theGraph, int u, int v); @@ -29,8 +29,8 @@ extern int _JoinBicomps(graphP theGraph); extern int _OrientVerticesInBicomp(graphP theGraph, int BicompRoot, int PreserveSigns); extern int _OrientVerticesInEmbedding(graphP theGraph); // extern void _InvertVertex(graphP theGraph, int V); -extern int _ClearVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x); -extern int _SetVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x); +extern int _ClearAllVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x); +extern int _SetAllVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x); extern int _OrientExternalFacePath(graphP theGraph, int u, int v, int w, int x); extern int _FindUnembeddedEdgeToAncestor(graphP theGraph, int cutVertex, int *pAncestor, int *pDescendant); @@ -60,8 +60,8 @@ int _K4_ChooseTypeOfNonOuterplanarityMinor(graphP theGraph, int v, int R); int _K4_FindSecondActiveVertexOnLowExtFacePath(graphP theGraph); int _K4_FindPlanarityActiveVertex(graphP theGraph, int v, int R, int prevLink, int *pW); int _K4_FindSeparatingInternalEdge(graphP theGraph, int R, int prevLink, int A, int *pW, int *pX, int *pY); -void _K4_MarkObstructionTypeOnExternalFacePath(graphP theGraph, int R, int prevLink, int A); -void _K4_UnmarkObstructionTypeOnExternalFacePath(graphP theGraph, int R, int prevLink, int A); +void _K4_SetMarksOnExternalFacePath(graphP theGraph, int R, int prevLink, int A); +void _K4_ClearMarksOnExternalFacePath(graphP theGraph, int R, int prevLink, int A); int _K4_IsolateMinorA1(graphP theGraph); int _K4_IsolateMinorA2(graphP theGraph); @@ -77,7 +77,7 @@ int _K4_TestPathComponentForAncestor(graphP theGraph, int R, int prevLink, int A void _K4_ClearVisitedInPathComponent(graphP theGraph, int R, int prevLink, int A); int _K4_DeleteUnmarkedEdgesInPathComponent(graphP theGraph, int R, int prevLink, int A); int _K4_DeleteUnmarkedEdgesInBicomp(graphP theGraph, K4SearchContext *context, int BicompRoot); -int _K4_DeleteEdge(graphP theGraph, K4SearchContext *context, int e, int nextLink); +int _K4_DeleteEdge(graphP theGraph, K4SearchContext *context, int e); int _K4_RestoreReducedPath(graphP theGraph, K4SearchContext *context, int e); int _K4_RestoreAndOrientReducedPaths(graphP theGraph, K4SearchContext *context); @@ -141,7 +141,7 @@ int _SearchForK4InBicomp(graphP theGraph, K4SearchContext *context, int v, int R return NOTOK; // Set up to isolate K4 homeomorph - _ClearVisitedFlags(theGraph); + _ClearAllVisitedFlagsInGraph(theGraph); if (_FindUnembeddedEdgeToCurVertex(theGraph, IC->w, &IC->dw) != TRUE) return NOTOK; @@ -175,7 +175,7 @@ int _SearchForK4InBicomp(graphP theGraph, K4SearchContext *context, int v, int R return NOTOK; // Marking the X-Y path relies on the bicomp visited flags being cleared - if (_ClearVisitedFlagsInBicomp(theGraph, R) != OK) + if (_ClearAllVisitedFlagsInBicomp(theGraph, R) != OK) return NOTOK; // Now Mark the X-Y path @@ -201,7 +201,7 @@ int _SearchForK4InBicomp(graphP theGraph, K4SearchContext *context, int v, int R return NOTOK; // Set up to isolate K4 homeomorph - _ClearVisitedFlags(theGraph); + _ClearAllVisitedFlagsInGraph(theGraph); if (_FindUnembeddedEdgeToCurVertex(theGraph, IC->w, &IC->dw) != TRUE) { @@ -223,7 +223,7 @@ int _SearchForK4InBicomp(graphP theGraph, K4SearchContext *context, int v, int R // else if there was no X-Y path, then we restore the vertex types to // unknown (though it would suffice to do it just to R and W) - if (_ClearVertexTypeInBicomp(theGraph, R) != OK) + if (_ClearObstructionMarkInBicomp(theGraph, R) != OK) return NOTOK; // Since neither A1 nor A2 is found, then we reduce the bicomp to the @@ -270,7 +270,7 @@ int _SearchForK4InBicomp(graphP theGraph, K4SearchContext *context, int v, int R return NOTOK; // Set up to isolate K4 homeomorph - _ClearVisitedFlags(theGraph); + _ClearAllVisitedFlagsInGraph(theGraph); IC->x = a_x; IC->y = a_y; @@ -304,7 +304,7 @@ int _SearchForK4InBicomp(graphP theGraph, K4SearchContext *context, int v, int R return NOTOK; // Set up to isolate K4 homeomorph - _ClearVisitedFlags(theGraph); + _ClearAllVisitedFlagsInGraph(theGraph); if (PERTINENT(theGraph, IC->w)) { @@ -370,7 +370,7 @@ int _SearchForK4InBicomp(graphP theGraph, K4SearchContext *context, int v, int R return NOTOK; // Set up to isolate minor E - _ClearVisitedFlags(theGraph); + _ClearAllVisitedFlagsInGraph(theGraph); if (_FindUnembeddedEdgeToCurVertex(theGraph, IC->w, &IC->dw) != TRUE) return NOTOK; @@ -459,18 +459,18 @@ int _K4_ChooseTypeOfNonOuterplanarityMinor(graphP theGraph, int v, int R) } } - if (gp_IsNotVertex(theGraph->IC.w)) + if (gp_IsNotVertex(theGraph, theGraph->IC.w)) return NOTOK; // If the root copy is not a root copy of the current vertex v, // then the Walkdown terminated on a descendant bicomp, which is Minor A. - if (gp_GetPrimaryVertexFromRoot(theGraph, R) != v) + if (gp_GetVertexFromBicompRoot(theGraph, R) != v) theGraph->IC.minorType |= MINORTYPE_A; // If W has a pertinent child bicomp, then we've found Minor B. // Notice this is different from planarity, in which minor B is indicated // only if the pertinent child bicomp is also future pertinent. - else if (gp_IsVertex(gp_GetVertexPertinentRootsList(theGraph, theGraph->IC.w))) + else if (gp_IsVertex(theGraph, gp_GetVertexPertinentRootsList(theGraph, theGraph->IC.w))) theGraph->IC.minorType |= MINORTYPE_B; // The only other result is minor E (we will search for the X-Y path later) @@ -623,7 +623,7 @@ int _K4_FindSeparatingInternalEdge(graphP theGraph, int R, int prevLink, int A, int Z, ZPrevLink, e, neighbor; // Mark the vertex obstruction type settings along the path [R ... A] - _K4_MarkObstructionTypeOnExternalFacePath(theGraph, R, prevLink, A); + _K4_SetMarksOnExternalFacePath(theGraph, R, prevLink, A); // Search each of the vertices in the range (R ... A) *pX = *pY = NIL; @@ -635,10 +635,10 @@ int _K4_FindSeparatingInternalEdge(graphP theGraph, int R, int prevLink, int A, // It is OK to not bother skipping the external face edges, since we // know they are marked visited and so are ignored e = gp_GetFirstArc(theGraph, Z); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { neighbor = gp_GetNeighbor(theGraph, e); - if (gp_GetVertexObstructionType(theGraph, neighbor) == VERTEX_OBSTRUCTIONTYPE_UNMARKED) + if (!gp_GetMarked(theGraph, neighbor)) { *pW = A; *pX = Z; @@ -649,7 +649,7 @@ int _K4_FindSeparatingInternalEdge(graphP theGraph, int R, int prevLink, int A, } // If we found the separator edge, then we don't need to go on - if (gp_IsVertex(*pX)) + if (gp_IsVertex(theGraph, *pX)) { break; } @@ -659,52 +659,52 @@ int _K4_FindSeparatingInternalEdge(graphP theGraph, int R, int prevLink, int A, } // Restore the unmarked obstruction type settings on the path [R ... A] - _K4_UnmarkObstructionTypeOnExternalFacePath(theGraph, R, prevLink, A); + _K4_ClearMarksOnExternalFacePath(theGraph, R, prevLink, A); - return gp_IsVertex(*pX) ? TRUE : FALSE; + return gp_IsVertex(theGraph, *pX) ? TRUE : FALSE; } /**************************************************************************** - _K4_MarkObstructionTypeOnExternalFacePath() + _K4_SetMarksOnExternalFacePath() Assumes A is a vertex along the external face of the bicomp rooted by R. Marks the obstruction type of vertices along the path (R ... A) that begins with R's link[1^prevLink] arc. ****************************************************************************/ -void _K4_MarkObstructionTypeOnExternalFacePath(graphP theGraph, int R, int prevLink, int A) +void _K4_SetMarksOnExternalFacePath(graphP theGraph, int R, int prevLink, int A) { int Z, ZPrevLink; - gp_SetVertexObstructionType(theGraph, R, VERTEX_OBSTRUCTIONTYPE_MARKED); + gp_SetMarked(theGraph, R); ZPrevLink = prevLink; Z = R; while (Z != A) { Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); - gp_SetVertexObstructionType(theGraph, Z, VERTEX_OBSTRUCTIONTYPE_MARKED); + gp_SetMarked(theGraph, Z); } } /**************************************************************************** - _K4_UnmarkObstructionTypeOnExternalFacePath() + _K4_ClearMarksOnExternalFacePath() Assumes A is a vertex along the external face of the bicomp rooted by R. Unmarks the obstruction type of vertices along the path (R ... A) that begins with R's link[1^prevLink] arc. ****************************************************************************/ -void _K4_UnmarkObstructionTypeOnExternalFacePath(graphP theGraph, int R, int prevLink, int A) +void _K4_ClearMarksOnExternalFacePath(graphP theGraph, int R, int prevLink, int A) { int Z, ZPrevLink; - gp_ClearVertexObstructionType(theGraph, R); + gp_ClearMarked(theGraph, R); ZPrevLink = prevLink; Z = R; while (Z != A) { Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); - gp_ClearVertexObstructionType(theGraph, Z); + gp_ClearMarked(theGraph, Z); } } @@ -759,7 +759,7 @@ int _K4_IsolateMinorA2(graphP theGraph) isolatorContextP IC = &theGraph->IC; // We assume the X-Y path was already marked - if (!gp_GetVertexVisited(theGraph, IC->px) || !gp_GetVertexVisited(theGraph, IC->py)) + if (!gp_GetVisited(theGraph, IC->px) || !gp_GetVisited(theGraph, IC->py)) return NOTOK; return _IsolateOuterplanarityObstructionA(theGraph); @@ -831,7 +831,7 @@ int _K4_IsolateMinorB2(graphP theGraph) if (PERTINENT(theGraph, IC->w)) { // We assume the X-Y path was already marked - if (!gp_GetVertexVisited(theGraph, IC->px) || !gp_GetVertexVisited(theGraph, IC->py)) + if (!gp_GetVisited(theGraph, IC->px) || !gp_GetVisited(theGraph, IC->py)) return NOTOK; return _IsolateOuterplanarityObstructionE(theGraph); @@ -868,7 +868,7 @@ int _K4_ReduceBicompToEdge(graphP theGraph, K4SearchContext *context, int R, int int newEdge; if (_OrientVerticesInBicomp(theGraph, R, 0) != OK || - _ClearVisitedFlagsInBicomp(theGraph, R) != OK) + _ClearAllVisitedFlagsInBicomp(theGraph, R) != OK) return NOTOK; if (theGraph->functions.fpMarkDFSPath(theGraph, R, W) != OK) return NOTOK; @@ -878,7 +878,7 @@ int _K4_ReduceBicompToEdge(graphP theGraph, K4SearchContext *context, int R, int // Now we have to reduce the path W -> R to the DFS tree edge (R, W) newEdge = _K4_ReducePathToEdge(theGraph, context, EDGE_TYPE_PARENT, R, gp_GetFirstArc(theGraph, R), W, gp_GetFirstArc(theGraph, W)); - if (gp_IsNotArc(newEdge)) + if (gp_IsNotArc(theGraph, newEdge)) return NOTOK; // Finally, set the visited info state of W to unvisited so that @@ -998,7 +998,7 @@ int _K4_ReducePathComponent(graphP theGraph, K4SearchContext *context, int R, in // Reduce the path (R ... A) to an edge e_R = _K4_ReducePathToEdge(theGraph, context, edgeType, R, e_R, A, e_A); - if (gp_IsNotArc(e_R)) + if (gp_IsNotArc(theGraph, e_R)) return NOTOK; // Preserve the net orientation along the DFS path in the case of a tree edge @@ -1029,7 +1029,7 @@ int _K4_ReducePathComponent(graphP theGraph, K4SearchContext *context, int R, in int _K4_DeleteUnmarkedEdgesInBicomp(graphP theGraph, K4SearchContext *context, int BicompRoot) { - int V, e; + int V, e, eNext; int stackBottom = sp_GetCurrentSize(theGraph->theStack); sp_Push(theGraph->theStack, BicompRoot); @@ -1038,14 +1038,15 @@ int _K4_DeleteUnmarkedEdgesInBicomp(graphP theGraph, K4SearchContext *context, i sp_Pop(theGraph->theStack, V); e = gp_GetFirstArc(theGraph, V); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) sp_Push(theGraph->theStack, gp_GetNeighbor(theGraph, e)); - e = gp_GetEdgeVisited(theGraph, e) - ? gp_GetNextArc(theGraph, e) - : _K4_DeleteEdge(theGraph, context, e, 0); + eNext = gp_GetNextArc(theGraph, e); + if (!gp_GetEdgeVisited(theGraph, e)) + _K4_DeleteEdge(theGraph, context, e); + e = eNext; } } return OK; @@ -1059,12 +1060,12 @@ int _K4_DeleteUnmarkedEdgesInBicomp(graphP theGraph, K4SearchContext *context, i marked for isolation. ********************************************************************/ -int _K4_DeleteEdge(graphP theGraph, K4SearchContext *context, int e, int nextLink) +int _K4_DeleteEdge(graphP theGraph, K4SearchContext *context, int e) { _K4Search_InitEdgeRec(context, e); _K4Search_InitEdgeRec(context, gp_GetTwinArc(theGraph, e)); - return gp_DeleteEdge(theGraph, e, nextLink); + return gp_DeleteEdge(theGraph, e); } /**************************************************************************** @@ -1079,17 +1080,17 @@ int _K4_GetCumulativeOrientationOnDFSPath(graphP theGraph, int ancestor, int des copy before starting the loop */ if (gp_IsVirtualVertex(theGraph, descendant)) - descendant = gp_GetPrimaryVertexFromRoot(theGraph, descendant); + descendant = gp_GetVertexFromBicompRoot(theGraph, descendant); while (descendant != ancestor) { - if (gp_IsNotVertex(descendant)) + if (gp_IsNotAnyTypeVertex(theGraph, descendant)) return NOTOK; // If we are at a bicomp root, then ascend to its parent copy if (gp_IsVirtualVertex(theGraph, descendant)) { - parent = gp_GetPrimaryVertexFromRoot(theGraph, descendant); + parent = gp_GetVertexFromBicompRoot(theGraph, descendant); } // If we are on a regular, non-virtual vertex then get the edge to the parent @@ -1098,7 +1099,7 @@ int _K4_GetCumulativeOrientationOnDFSPath(graphP theGraph, int ancestor, int des // Scan the edges for the one marked as the DFS parent parent = NIL; e = gp_GetFirstArc(theGraph, descendant); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_PARENT) { @@ -1109,7 +1110,7 @@ int _K4_GetCumulativeOrientationOnDFSPath(graphP theGraph, int ancestor, int des } // If the edge to the parent vertex was not found, then the data structure is corrupt - if (gp_IsNotVertex(parent)) + if (gp_IsNotAnyTypeVertex(theGraph, parent)) return NOTOK; // Add the inversion flag on the child arc to the cumulative result @@ -1174,13 +1175,13 @@ void _K4_ClearVisitedInPathComponent(graphP theGraph, int R, int prevLink, int A Z = _GetNeighborOnExtFace(theGraph, R, &ZPrevLink); while (Z != A) { - gp_ClearVertexVisited(theGraph, Z); + gp_ClearVisited(theGraph, Z); e = gp_GetFirstArc(theGraph, Z); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { gp_ClearEdgeVisited(theGraph, e); gp_ClearEdgeVisited(theGraph, gp_GetTwinArc(theGraph, e)); - gp_ClearVertexVisited(theGraph, gp_GetNeighbor(theGraph, e)); + gp_ClearVisited(theGraph, gp_GetNeighbor(theGraph, e)); e = gp_GetNextArc(theGraph, e); } @@ -1233,7 +1234,7 @@ int _K4_DeleteUnmarkedEdgesInPathComponent(graphP theGraph, int R, int prevLink, while (Z != A) { e = gp_GetFirstArc(theGraph, Z); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { // The comparison of e to its twin is a useful way of ensuring we // don't push the edge twice, which is of course only applicable @@ -1256,7 +1257,7 @@ int _K4_DeleteUnmarkedEdgesInPathComponent(graphP theGraph, int R, int prevLink, while (sp_NonEmpty(theGraph->theStack)) { sp_Pop(theGraph->theStack, e); - _K4_DeleteEdge(theGraph, context, e, 0); + _K4_DeleteEdge(theGraph, context, e); } return OK; @@ -1286,7 +1287,7 @@ int _K4_ReducePathToEdge(graphP theGraph, K4SearchContext *context, int edgeType // Prepare for removing each of the two edges that join the path to the bicomp by // restoring it if it is a reduction edge (a constant time operation) - if (gp_IsVertex(context->E[e_R].pathConnector)) + if (gp_IsAnyTypeVertex(theGraph, context->E[e_R].pathConnector)) { if (_K4_RestoreReducedPath(theGraph, context, e_R) != OK) return NOTOK; @@ -1294,7 +1295,7 @@ int _K4_ReducePathToEdge(graphP theGraph, K4SearchContext *context, int edgeType e_R = gp_GetArc(theGraph, R, Rlink); } - if (gp_IsVertex(context->E[e_A].pathConnector)) + if (gp_IsAnyTypeVertex(theGraph, context->E[e_A].pathConnector)) { if (_K4_RestoreReducedPath(theGraph, context, e_A) != OK) return NOTOK; @@ -1307,8 +1308,8 @@ int _K4_ReducePathToEdge(graphP theGraph, K4SearchContext *context, int edgeType v_A = gp_GetNeighbor(theGraph, e_A); // Now delete the two edges that join the path to the bicomp. - _K4_DeleteEdge(theGraph, context, e_R, 0); - _K4_DeleteEdge(theGraph, context, e_A, 0); + _K4_DeleteEdge(theGraph, context, e_R); + _K4_DeleteEdge(theGraph, context, e_A); // Now add a single edge to represent the path // We use 1^Rlink, for example, because Rlink was the link from R that indicated e_R, @@ -1365,7 +1366,7 @@ int _K4_RestoreReducedPath(graphP theGraph, K4SearchContext *context, int e) int eTwin, u, v, w, x; int e0, e1, eTwin0, eTwin1; - if (gp_IsNotVertex(context->E[e].pathConnector)) + if (gp_IsNotAnyTypeVertex(theGraph, context->E[e].pathConnector)) return OK; eTwin = gp_GetTwinArc(theGraph, e); @@ -1384,12 +1385,12 @@ int _K4_RestoreReducedPath(graphP theGraph, K4SearchContext *context, int e) // We first delete the edge represented by e and eTwin. We do so before // restoring the path to ensure we do not exceed the maximum arc capacity. - _K4_DeleteEdge(theGraph, context, e, 0); + _K4_DeleteEdge(theGraph, context, e); // Now we add the two edges to reconnect the reduced path represented // by the edge [e, eTwin]. The edge record in u is added between e0 and e1. // Likewise, the new edge record in x is added between eTwin0 and eTwin1. - if (gp_IsArc(e0)) + if (gp_IsArc(theGraph, e0)) { if (gp_InsertEdge(theGraph, u, e0, 1, v, NIL, 0) != OK) return NOTOK; @@ -1400,7 +1401,7 @@ int _K4_RestoreReducedPath(graphP theGraph, K4SearchContext *context, int e) return NOTOK; } - if (gp_IsArc(eTwin0)) + if (gp_IsArc(theGraph, eTwin0)) { if (gp_InsertEdge(theGraph, x, eTwin0, 1, w, NIL, 0) != OK) return NOTOK; @@ -1442,10 +1443,10 @@ int _K4_RestoreAndOrientReducedPaths(graphP theGraph, K4SearchContext *context) { int EsizeOccupied, e, eTwin, u, v, w, x, visited; - EsizeOccupied = gp_EdgeInUseIndexBound(theGraph); + EsizeOccupied = gp_EdgeInUseArraySize(theGraph); for (e = gp_GetFirstEdge(theGraph); e < EsizeOccupied;) { - if (gp_IsVertex(context->E[e].pathConnector)) + if (gp_IsAnyTypeVertex(theGraph, context->E[e].pathConnector)) { visited = gp_GetEdgeVisited(theGraph, e); @@ -1474,12 +1475,12 @@ int _K4_RestoreAndOrientReducedPaths(graphP theGraph, K4SearchContext *context) if (visited) { - if (_SetVisitedFlagsOnPath(theGraph, u, v, w, x) != OK) + if (_SetAllVisitedFlagsOnPath(theGraph, u, v, w, x) != OK) return NOTOK; } else { - if (_ClearVisitedFlagsOnPath(theGraph, u, v, w, x) != OK) + if (_ClearAllVisitedFlagsOnPath(theGraph, u, v, w, x) != OK) return NOTOK; } } diff --git a/planarity/c/graphLib/homeomorphSearch/graphK4Search.h b/planarity/c/graphLib/homeomorphSearch/graphK4Search.h index 02f7409..8a6d4cf 100644 --- a/planarity/c/graphLib/homeomorphSearch/graphK4Search.h +++ b/planarity/c/graphLib/homeomorphSearch/graphK4Search.h @@ -2,7 +2,7 @@ #define GRAPH_K4SEARCH_H /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ diff --git a/planarity/c/graphLib/homeomorphSearch/graphK4Search.private.h b/planarity/c/graphLib/homeomorphSearch/graphK4Search.private.h index 73c1de8..3f1e281 100644 --- a/planarity/c/graphLib/homeomorphSearch/graphK4Search.private.h +++ b/planarity/c/graphLib/homeomorphSearch/graphK4Search.private.h @@ -2,7 +2,7 @@ #define GRAPH_K4SEARCH_PRIVATE_H /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ diff --git a/planarity/c/graphLib/homeomorphSearch/graphK4Search_Extensions.c b/planarity/c/graphLib/homeomorphSearch/graphK4Search_Extensions.c index 4f10a1a..ea4ed58 100644 --- a/planarity/c/graphLib/homeomorphSearch/graphK4Search_Extensions.c +++ b/planarity/c/graphLib/homeomorphSearch/graphK4Search_Extensions.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -104,6 +104,8 @@ int gp_AttachK4Search(graphP theGraph) &context->functions) != OK) { _K4Search_FreeContext(context); + context = NULL; + return NOTOK; } @@ -119,6 +121,8 @@ int gp_AttachK4Search(graphP theGraph) _K4Search_InitStructures(context) != OK) { _K4Search_FreeContext(context); + context = NULL; + return NOTOK; } } @@ -169,7 +173,7 @@ void _K4Search_ClearStructures(K4SearchContext *context) ********************************************************************/ int _K4Search_CreateStructures(K4SearchContext *context) { - int Esize = gp_EdgeIndexBound(context->theGraph); + int Esize = gp_EdgeArraySize(context->theGraph); if (context->theGraph->N <= 0) return NOTOK; @@ -188,12 +192,12 @@ int _K4Search_CreateStructures(K4SearchContext *context) ********************************************************************/ int _K4Search_InitStructures(K4SearchContext *context) { - memset(context->E, NIL_CHAR, gp_EdgeIndexBound(context->theGraph) * sizeof(K4Search_EdgeRec)); + memset(context->E, NIL_CHAR, gp_EdgeArraySize(context->theGraph) * sizeof(K4Search_EdgeRec)); // N.B. This is the legacy API-based approach to initializing the structures // required for the K_4 search graph algorithm extension. // int e, Esize; - // Esize = gp_EdgeIndexBound(context->theGraph); + // Esize = gp_EdgeArraySize(context->theGraph); // for (e = gp_GetFirstEdge(context->theGraph); e < Esize; e++) // _K4Search_InitEdgeRec(context, e); @@ -268,7 +272,7 @@ void *_K4Search_DupContext(void *pContext, void *theGraph) if (newContext != NULL) { - int Esize = gp_EdgeIndexBound((graphP)theGraph); + int Esize = gp_EdgeArraySize((graphP)theGraph); *newContext = *context; @@ -281,6 +285,8 @@ void *_K4Search_DupContext(void *pContext, void *theGraph) if (_K4Search_CreateStructures(newContext) != OK) { _K4Search_FreeContext(newContext); + newContext = NULL; + return NULL; } diff --git a/planarity/c/graphLib/io/g6-api-utilities.c b/planarity/c/graphLib/io/g6-api-utilities.c index 39195e1..9eabf35 100644 --- a/planarity/c/graphLib/io/g6-api-utilities.c +++ b/planarity/c/graphLib/io/g6-api-utilities.c @@ -1,30 +1,51 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ +#include -#include "g6-api-utilities.h" +#include "../lowLevelUtils/appconst.h" -int _getMaxEdgeCount(int graphOrder) +/* Private function declarations (exported within system) */ +int _g6_GetNumCharsForEncoding(int); +int _g6_GetNumCharsForOrder(int); +int _g6_GetExpectedNumPaddingZeroes(const int, const int); +// NOTE: this method is used by g6_ReadGraph() to ensure that graphs after the +// first one in the file have the same order, and by g6_WriteGraph() to ensure +// that the encoding of the graph order at the beginning of the graph encoding +// is correct. The G6 format specification does not have this restriction, but +// the docs for Nauty's geng utility indicate that its output files will only +// contain all graphs up to isomorphism for the single graph order specified +// with the positional command line argument. +int _g6_ValidateOrderOfEncodedGraph(char *graphBuff, int order); +// NOTE: this method is now used to validate each graph we're reading in, as +// well as to check the validity of the encoding produced before attempting to +// write. +int _g6_ValidateGraphEncoding(char *graphBuff, const int order, const int numChars); + +/* Private functions */ +int _g6_GetMaxEdgeCount(int); + +int _g6_GetMaxEdgeCount(int order) { - return (graphOrder * (graphOrder - 1)) / 2; + return (order * (order - 1)) / 2; } -int _getNumCharsForGraphEncoding(int graphOrder) +int _g6_GetNumCharsForEncoding(int order) { - int maxNumEdges = _getMaxEdgeCount(graphOrder); + int maxNumEdges = _g6_GetMaxEdgeCount(order); return (maxNumEdges / 6) + (maxNumEdges % 6 ? 1 : 0); } -int _getNumCharsForGraphOrder(int graphOrder) +int _g6_GetNumCharsForOrder(int order) { - if (graphOrder > 0 && graphOrder < 63) + if (order > 0 && order < 63) { return 1; } - else if (graphOrder >= 63 && graphOrder <= 100000) + else if (order >= 63 && order <= 100000) { return 4; } @@ -32,10 +53,120 @@ int _getNumCharsForGraphOrder(int graphOrder) return -1; } -int _getExpectedNumPaddingZeroes(const int graphOrder, const int numChars) +int _g6_GetExpectedNumPaddingZeroes(const int order, const int numChars) { - int maxNumEdges = _getMaxEdgeCount(graphOrder); + int maxNumEdges = _g6_GetMaxEdgeCount(order); int expectedNumPaddingZeroes = numChars * 6 - maxNumEdges; return expectedNumPaddingZeroes; } + +int _g6_ValidateOrderOfEncodedGraph(char *graphBuff, int order) +{ + int n = 0; + char currChar = graphBuff[0]; + + if (currChar == 126) + { + if (graphBuff[1] == 126) + { + ErrorMessage("Can only handle graphs of order <= 100,000.\n"); + return NOTOK; + } + else if (graphBuff[1] > 126) + { + ErrorMessage("Invalid graph order signifier.\n"); + return NOTOK; + } + else + { + int orderCharIndex = 2; + for (int i = 1; i < 4; i++) + n |= (graphBuff[i] - 63) << (6 * orderCharIndex--); + } + } + else if (currChar > 62 && currChar < 126) + n = currChar - 63; + else + { + ErrorMessage("Character doesn't correspond to a printable ASCII character.\n"); + return NOTOK; + } + + if (n != order) + { + char messageContents[MAXLINE + 1]; + sprintf(messageContents, "Graph order %d doesn't match expected graph order %d", n, order); + ErrorMessage(messageContents); + return NOTOK; + } + + return OK; +} + +int _g6_ValidateGraphEncoding(char *graphBuff, const int order, const int numChars) +{ + int exitCode = OK; + + int numPaddingZeroes = 0, numCharsForGraphEncoding = 0; + int expectedNumPaddingZeroes = 0, expectedNumChars = 0; + char finalByte = '\0'; + + if (graphBuff == NULL || strlen(graphBuff) == 0) + { + ErrorMessage("Invalid encoding: graphBuff is NULL or has no content.\n"); + return NOTOK; + } + + expectedNumPaddingZeroes = _g6_GetExpectedNumPaddingZeroes(order, numChars); + finalByte = graphBuff[numChars - 1] - 63; + + // Num edges of the graph (and therefore the number of bits) is (n * (n-1))/2, and + // since each resulting byte needs to correspond to an ascii character between 63 and 126, + // each group is only comprised of 6 bits (to which we add 63 for the final byte value) + expectedNumChars = _g6_GetNumCharsForEncoding(order); + numCharsForGraphEncoding = strlen(graphBuff); + + if (expectedNumChars != numCharsForGraphEncoding) + { + char messageContents[MAXLINE + 1]; + messageContents[0] = '\0'; + sprintf(messageContents, "Invalid number of bytes for graph of order %d; got %d but expected %d\n", order, numCharsForGraphEncoding, expectedNumChars); + ErrorMessage(messageContents); + return NOTOK; + } + + // Check that characters are valid ASCII characters between 62 and 126 + for (int i = 0; i < numChars; i++) + { + if (graphBuff[i] < 63 || graphBuff[i] > 126) + { + char messageContents[MAXLINE + 1]; + messageContents[0] = '\0'; + sprintf(messageContents, "Invalid character at index %d: \"%c\"\n", i, graphBuff[i]); + ErrorMessage(messageContents); + return NOTOK; + } + } + + // Check that there are no extraneous bits in representation (since we pad out to a + // multiple of 6 before splitting into bytes and adding 63 to each byte) + for (int i = 0; i < expectedNumPaddingZeroes; i++) + { + if (finalByte & (1 << i)) + break; + + numPaddingZeroes++; + } + + if (numPaddingZeroes != expectedNumPaddingZeroes) + { + char messageContents[MAXLINE + 1]; + messageContents[0] = '\0'; + sprintf(messageContents, "Expected %d padding zeroes, but got %d.\n", expectedNumPaddingZeroes, numPaddingZeroes); + ErrorMessage(messageContents); + exitCode = NOTOK; + } + + return exitCode; +} diff --git a/planarity/c/graphLib/io/g6-api-utilities.h b/planarity/c/graphLib/io/g6-api-utilities.h deleted file mode 100644 index 15239d9..0000000 --- a/planarity/c/graphLib/io/g6-api-utilities.h +++ /dev/null @@ -1,24 +0,0 @@ -/* -Copyright (c) 1997-2025, John M. Boyer -All rights reserved. -See the LICENSE.TXT file for licensing information. -*/ - -#ifndef G6_API_UTILITIES -#define G6_API_UTILITIES - -#ifdef __cplusplus -extern "C" -{ -#endif - - int _getMaxEdgeCount(int); - int _getNumCharsForGraphEncoding(int); - int _getNumCharsForGraphOrder(int); - int _getExpectedNumPaddingZeroes(const int, const int); - -#ifdef __cplusplus -} -#endif - -#endif /* G6_API_UTILITIES */ diff --git a/planarity/c/graphLib/io/g6-read-iterator.c b/planarity/c/graphLib/io/g6-read-iterator.c index c5c5397..76d824a 100644 --- a/planarity/c/graphLib/io/g6-read-iterator.c +++ b/planarity/c/graphLib/io/g6-read-iterator.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -8,9 +8,31 @@ See the LICENSE.TXT file for licensing information. #include #include "g6-read-iterator.h" -#include "g6-api-utilities.h" -int allocateG6ReadIterator(G6ReadIteratorP *ppG6ReadIterator, graphP pGraph) +/* Imported functions */ +extern int _g6_GetNumCharsForEncoding(int); +extern int _g6_GetNumCharsForOrder(int); +extern int _g6_GetExpectedNumPaddingZeroes(const int, const int); +extern int _g6_ValidateOrderOfEncodedGraph(char *graphBuff, int order); +extern int _g6_ValidateGraphEncoding(char *graphBuff, const int order, const int numChars); + +/* Private function declarations (exported within system) */ +int _g6_ReadGraphFromStrOrFile(graphP theGraph, strOrFileP g6InputContainer); + +/* Private functions */ +int _g6_InitReaderWithStrOrFile(G6ReadIteratorP pG6ReadIterator, strOrFileP inputContainer); +int _g6_InitReader(G6ReadIteratorP pG6ReadIterator); +bool _g6_IsReaderInitialized(G6ReadIteratorP pG6ReadIterator, bool reportUninitializedParts); +int _g6_ValidateHeader(strOrFileP g6Input); +int _g6_ValidateFirstChar(char c, const int lineNum); +int _g6_DetermineOrderFromInput(strOrFileP g6Input, int *order); + +int _g6_DecodeGraph(char *graphBuff, const int order, const int numChars, graphP theGraph); + +int _g6_ReadGraphFromFile(graphP theGraph, char *pathToG6File); +int _g6_ReadGraphFromString(graphP theGraph, char *g6EncodedString); + +int g6_NewReader(G6ReadIteratorP *ppG6ReadIterator, graphP theGraph) { int exitCode = OK; @@ -20,7 +42,7 @@ int allocateG6ReadIterator(G6ReadIteratorP *ppG6ReadIterator, graphP pGraph) return NOTOK; } - // numGraphsRead, graphOrder, numCharsForGraphOrder, + // numGraphsRead, order, numCharsForOrder, // numCharsForGraphEncoding, and currGraphBuffSize all set to 0 (*ppG6ReadIterator) = (G6ReadIteratorP)calloc(1, sizeof(G6ReadIterator)); @@ -32,73 +54,73 @@ int allocateG6ReadIterator(G6ReadIteratorP *ppG6ReadIterator, graphP pGraph) (*ppG6ReadIterator)->g6Input = NULL; - if (pGraph == NULL) + if (theGraph == NULL) { ErrorMessage("Must allocate graph to be used by G6ReadIterator.\n"); - exitCode = freeG6ReadIterator(ppG6ReadIterator); - - if (exitCode != OK) - ErrorMessage("Unable to free the G6ReadIterator.\n"); + g6_FreeReader(ppG6ReadIterator); } else { - (*ppG6ReadIterator)->currGraph = pGraph; + (*ppG6ReadIterator)->currGraph = theGraph; } return exitCode; } -bool _isG6ReadIteratorAllocated(G6ReadIteratorP pG6ReadIterator) +bool _g6_IsReaderInitialized(G6ReadIteratorP pG6ReadIterator, bool reportUninitializedParts) { - bool g6ReadIteratorIsAllocated = true; + bool readerInitialized = true; if (pG6ReadIterator == NULL) { - ErrorMessage("G6ReadIterator is NULL.\n"); - g6ReadIteratorIsAllocated = false; + if (reportUninitializedParts) + ErrorMessage("G6ReadIterator is NULL.\n"); + readerInitialized = false; } else { - if (sf_ValidateStrOrFile(pG6ReadIterator->g6Input) != OK) + if (!sf_IsValidStrOrFile(pG6ReadIterator->g6Input)) { - ErrorMessage("G6ReadIterator's g6Input string-or-file container " - "is not valid.\n"); - g6ReadIteratorIsAllocated = false; + if (reportUninitializedParts) + ErrorMessage("G6ReadIterator's g6Input string-or-file container " + "is not valid.\n"); + readerInitialized = false; } if (pG6ReadIterator->currGraphBuff == NULL) { - ErrorMessage("G6ReadIterator's currGraphBuff is NULL.\n"); - g6ReadIteratorIsAllocated = false; + if (reportUninitializedParts) + ErrorMessage("G6ReadIterator's currGraphBuff is NULL.\n"); + readerInitialized = false; } if (pG6ReadIterator->currGraph == NULL) { - ErrorMessage("G6ReadIterator's currGraph is NULL.\n"); - g6ReadIteratorIsAllocated = false; + if (reportUninitializedParts) + ErrorMessage("G6ReadIterator's currGraph is NULL.\n"); + readerInitialized = false; } } - return g6ReadIteratorIsAllocated; + return readerInitialized; } -bool contentsExhausted(G6ReadIteratorP pG6ReadIterator) +bool g6_EndReached(G6ReadIteratorP pG6ReadIterator) { - if (pG6ReadIterator == NULL || - pG6ReadIterator->currGraph == NULL || - pG6ReadIterator->contentsExhausted) - { + if (pG6ReadIterator == NULL) return true; - } - return false; + + return pG6ReadIterator->endReached; } -int getNumGraphsRead(G6ReadIteratorP pG6ReadIterator, int *pNumGraphsRead) +int g6_GetNumGraphsRead(G6ReadIteratorP pG6ReadIterator, int *pNumGraphsRead) { - if (_isG6ReadIteratorAllocated(pG6ReadIterator) == false) + if (!_g6_IsReaderInitialized(pG6ReadIterator, true)) { ErrorMessage("Unable to get numGraphsRead, as G6ReadIterator is not " - "allocated.\n"); + "initialized.\n"); + (*pNumGraphsRead) = 0; + return NOTOK; } @@ -107,75 +129,121 @@ int getNumGraphsRead(G6ReadIteratorP pG6ReadIterator, int *pNumGraphsRead) return OK; } -int getOrderOfGraphToRead(G6ReadIteratorP pG6ReadIterator, int *pGraphOrder) +int g6_GetOrderFromReader(G6ReadIteratorP pG6ReadIterator, int *pOrder) { - if (pG6ReadIterator == NULL) + if (!_g6_IsReaderInitialized(pG6ReadIterator, true)) { - ErrorMessage("G6ReadIterator is not allocated.\n"); + ErrorMessage("Unable to get order, as G6ReadIterator is not " + "initialized.\n"); + + (*pOrder) = 0; + return NOTOK; } - (*pGraphOrder) = pG6ReadIterator->graphOrder; + (*pOrder) = pG6ReadIterator->order; return OK; } -int getPointerToGraphReadIn(G6ReadIteratorP pG6ReadIterator, graphP *ppGraph) +int g6_GetGraphFromReader(G6ReadIteratorP pG6ReadIterator, graphP *pTheGraph) { - if (pG6ReadIterator == NULL) + if (!_g6_IsReaderInitialized(pG6ReadIterator, true)) { - ErrorMessage("G6ReadIterator is not allocated.\n"); + ErrorMessage("Unable to get currGraph from reader, as G6ReadIterator " + "is not initialized.\n"); + + (*pTheGraph) = NULL; + return NOTOK; } - (*ppGraph) = pG6ReadIterator->currGraph; + (*pTheGraph) = pG6ReadIterator->currGraph; return OK; } -int beginG6ReadIterationFromG6String(G6ReadIteratorP pG6ReadIterator, char *inputString) +int g6_InitReaderWithString(G6ReadIteratorP pG6ReadIterator, char *inputString) { - return beginG6ReadIterationFromG6StrOrFile( + if (pG6ReadIterator == NULL) + { + ErrorMessage("Unable to initialize reader, since pointer to " + "pG6ReadIterator is NULL.\n"); + return NOTOK; + } + + if (_g6_IsReaderInitialized(pG6ReadIterator, false)) + { + ErrorMessage("Unable to initialize reader, as it was already previously initialized.\n"); + return NOTOK; + } + + if (inputString == NULL || strlen(inputString) == 0) + { + ErrorMessage("Unable to initialize reader with empty input string.\n"); + return NOTOK; + } + + return _g6_InitReaderWithStrOrFile( pG6ReadIterator, sf_New(inputString, NULL, READTEXT)); } -int beginG6ReadIterationFromG6FilePath(G6ReadIteratorP pG6ReadIterator, char *infileName) +int g6_InitReaderWithFileName(G6ReadIteratorP pG6ReadIterator, char const *const infileName) { - return beginG6ReadIterationFromG6StrOrFile( + if (pG6ReadIterator == NULL) + { + ErrorMessage("Unable to initialize reader, since pointer to " + "pG6ReadIterator is NULL.\n"); + return NOTOK; + } + + if (_g6_IsReaderInitialized(pG6ReadIterator, false)) + { + ErrorMessage("Unable to initialize reader, as it was already previously initialized.\n"); + return NOTOK; + } + + if (infileName == NULL || strlen(infileName) == 0) + { + ErrorMessage("Unable to initialize reader with empty infile name.\n"); + return NOTOK; + } + + return _g6_InitReaderWithStrOrFile( pG6ReadIterator, sf_New(NULL, infileName, READTEXT)); } -int beginG6ReadIterationFromG6StrOrFile(G6ReadIteratorP pG6ReadIterator, strOrFileP g6InputContainer) +int _g6_InitReaderWithStrOrFile(G6ReadIteratorP pG6ReadIterator, strOrFileP inputContainer) { if ( - sf_ValidateStrOrFile(g6InputContainer) != OK || - (g6InputContainer->theStr != NULL && sb_GetSize(g6InputContainer->theStr) == 0)) + !sf_IsValidStrOrFile(inputContainer) || + (inputContainer->theStr != NULL && sb_GetSize(inputContainer->theStr) == 0)) { - ErrorMessage("Invalid g6InputContainer; must contain either valid input stream or non-empty string.\n"); + ErrorMessage("Unable to initialize reader with invalid strOrFile " + "input container.\n"); return NOTOK; } - pG6ReadIterator->g6Input = g6InputContainer; + pG6ReadIterator->g6Input = inputContainer; - return _beginG6ReadIteration(pG6ReadIterator); + return _g6_InitReader(pG6ReadIterator); } -int _beginG6ReadIteration(G6ReadIteratorP pG6ReadIterator) +int _g6_InitReader(G6ReadIteratorP pG6ReadIterator) { - int exitCode = OK; char charConfirmation = EOF; int firstChar = '\0'; int lineNum = 1; - int graphOrder = -1; + int order = NIL; strOrFileP g6Input = pG6ReadIterator->g6Input; char messageContents[MAXLINE + 1]; messageContents[0] = '\0'; if ((firstChar = sf_getc(g6Input)) == EOF) { - ErrorMessage(".g6 infile is empty.\n"); + ErrorMessage("Unable to initialize reader: .g6 infile is empty.\n"); return NOTOK; } else @@ -184,17 +252,18 @@ int _beginG6ReadIteration(G6ReadIteratorP pG6ReadIterator) if (charConfirmation != firstChar) { - ErrorMessage("Unable to ungetc first character.\n"); + ErrorMessage("Unable to initialize reader due to failure to ungetc " + "first character.\n"); return NOTOK; } if (firstChar == '>') { - exitCode = _processAndCheckHeader(g6Input); - if (exitCode != OK) + if (_g6_ValidateHeader(g6Input) != OK) { - ErrorMessage("Unable to process and check .g6 infile header.\n"); - return exitCode; + ErrorMessage("Unable to initialize reader due to inability to " + "process and check .g6 infile header.\n"); + return NOTOK; } } } @@ -204,78 +273,77 @@ int _beginG6ReadIteration(G6ReadIteratorP pG6ReadIterator) if (charConfirmation != firstChar) { - ErrorMessage("Unable to ungetc first character.\n"); + ErrorMessage("Unable to initialize reader due to failure to ungetc " + "first character.\n"); return NOTOK; } - if (!_firstCharIsValid((char)firstChar, lineNum)) + if (_g6_ValidateFirstChar((char)firstChar, lineNum) != OK) return NOTOK; // Despite the general specification indicating that n \in [0, 68,719,476,735], // in practice n will be limited such that an integer will suffice in storing it. - exitCode = _getGraphOrder(g6Input, &graphOrder); - - if (exitCode != OK) + if (_g6_DetermineOrderFromInput(g6Input, &order) != OK) { - sprintf(messageContents, "Invalid graph order on line %d of .g6 file.\n", lineNum); + sprintf(messageContents, "Unable to initialize reader due to invalid graph order on line %d of .g6 file.\n", lineNum); ErrorMessage(messageContents); - return exitCode; + return NOTOK; } - if (gp_getN(pG6ReadIterator->currGraph) == 0) + if (gp_GetN(pG6ReadIterator->currGraph) == 0) { - exitCode = gp_InitGraph(pG6ReadIterator->currGraph, graphOrder); - - if (exitCode != OK) + if (gp_InitGraph(pG6ReadIterator->currGraph, order) != OK) { - sprintf(messageContents, "Unable to initialize graph datastructure with order %d for graph on line %d of the .g6 file.\n", graphOrder, lineNum); + sprintf(messageContents, "Unable to initialize reader due to failure initializing graph datastructure with order %d for graph on line %d of the .g6 file.\n", order, lineNum); ErrorMessage(messageContents); - return exitCode; + return NOTOK; } - pG6ReadIterator->graphOrder = graphOrder; + pG6ReadIterator->order = order; } else { - if (gp_getN(pG6ReadIterator->currGraph) != graphOrder) + if (gp_GetN(pG6ReadIterator->currGraph) != order) { - sprintf(messageContents, "Graph datastructure passed to G6ReadIterator already initialized with graph order %d,\n", gp_getN(pG6ReadIterator->currGraph)); + ErrorMessage("Unable to initialize reader, as graph datastructure " + "passed in was already initialized "); + sprintf(messageContents, "with graph order %d,\n", gp_GetN(pG6ReadIterator->currGraph)); ErrorMessage(messageContents); - sprintf(messageContents, "\twhich doesn't match the graph order %d specified in the file.\n", graphOrder); + sprintf(messageContents, "\twhich doesn't match the graph order %d specified in the file.\n", order); ErrorMessage(messageContents); return NOTOK; } else { gp_ReinitializeGraph(pG6ReadIterator->currGraph); - pG6ReadIterator->graphOrder = graphOrder; + pG6ReadIterator->order = order; } } // Ensures zero-based flag is set regardless of whether the graph was initialized or reinitialized. pG6ReadIterator->currGraph->internalFlags |= FLAGS_ZEROBASEDIO; - pG6ReadIterator->numCharsForGraphOrder = _getNumCharsForGraphOrder(graphOrder); - pG6ReadIterator->numCharsForGraphEncoding = _getNumCharsForGraphEncoding(graphOrder); + pG6ReadIterator->numCharsForOrder = _g6_GetNumCharsForOrder(order); + pG6ReadIterator->numCharsForGraphEncoding = _g6_GetNumCharsForEncoding(order); // Must add 3 bytes for newline, possible carriage return, and null terminator - pG6ReadIterator->currGraphBuffSize = pG6ReadIterator->numCharsForGraphOrder + pG6ReadIterator->numCharsForGraphEncoding + 3; + pG6ReadIterator->currGraphBuffSize = pG6ReadIterator->numCharsForOrder + pG6ReadIterator->numCharsForGraphEncoding + 3; pG6ReadIterator->currGraphBuff = (char *)calloc(pG6ReadIterator->currGraphBuffSize, sizeof(char)); if (pG6ReadIterator->currGraphBuff == NULL) { ErrorMessage("Unable to allocate memory for currGraphBuff.\n"); - exitCode = NOTOK; + return NOTOK; } - return exitCode; + return OK; } -int _processAndCheckHeader(strOrFileP g6Input) +int _g6_ValidateHeader(strOrFileP g6Input) { - int exitCode = OK; - char const *correctG6Header = ">>graph6<<"; + char const *g6Header = ">>graph6<<"; char const *sparse6Header = ">>sparse6<"; char const *digraph6Header = ">>digraph6"; + char headerCandidateChars[11]; headerCandidateChars[0] = '\0'; @@ -292,7 +360,7 @@ int _processAndCheckHeader(strOrFileP g6Input) headerCandidateChars[10] = '\0'; - if (strcmp(correctG6Header, headerCandidateChars) != 0) + if (strcmp(g6Header, headerCandidateChars) != 0) { if (strcmp(sparse6Header, headerCandidateChars) == 0) ErrorMessage("Graph file is sparse6 format, which is not supported.\n"); @@ -301,31 +369,28 @@ int _processAndCheckHeader(strOrFileP g6Input) else ErrorMessage("Invalid header for .g6 file.\n"); - exitCode = NOTOK; + return NOTOK; } - return exitCode; + return OK; } -bool _firstCharIsValid(char c, const int lineNum) +int _g6_ValidateFirstChar(char c, const int lineNum) { - bool isValidFirstChar = false; - if (strchr(":;&", c) != NULL) { char messageContents[MAXLINE + 1]; sprintf(messageContents, "Invalid first character on line %d, i.e. one of ':', ';', or '&'; aborting.\n", lineNum); ErrorMessage(messageContents); + + return NOTOK; } - else - isValidFirstChar = true; - return isValidFirstChar; + return OK; } -int _getGraphOrder(strOrFileP g6Input, int *graphOrder) +int _g6_DetermineOrderFromInput(strOrFileP g6Input, int *order) { - int exitCode = OK; int n = 0; int graphChar = '\0'; @@ -342,7 +407,9 @@ int _getGraphOrder(strOrFileP g6Input, int *graphOrder) { if ((graphChar = sf_getc(g6Input)) == 126) { - ErrorMessage("Graph order is too large; format suggests that 258048 <= n <= 68719476735, but we only support n <= 100000.\n"); + ErrorMessage("Graph order is too large; format suggests that " + "258048 <= n <= 68719476735, but only n <= 100000 is " + "supported.\n"); return NOTOK; } @@ -364,51 +431,40 @@ int _getGraphOrder(strOrFileP g6Input, int *graphOrder) n = graphChar - 63; else { - ErrorMessage("Graph order is too small; character doesn't correspond to a printable ASCII character.\n"); + ErrorMessage("Graph order is too small; character doesn't correspond " + "to a printable ASCII character.\n"); return NOTOK; } - (*graphOrder) = n; + (*order) = n; - return exitCode; + return OK; } -int readGraphUsingG6ReadIterator(G6ReadIteratorP pG6ReadIterator) +int g6_ReadGraph(G6ReadIteratorP pG6ReadIterator) { - int exitCode = OK; strOrFileP g6Input = NULL; int numGraphsRead = 0; char *currGraphBuff = NULL; char firstChar = '\0'; char *graphEncodingChars = NULL; graphP currGraph = NULL; - const int graphOrder = pG6ReadIterator == NULL ? 0 : pG6ReadIterator->graphOrder; - const int numCharsForGraphOrder = pG6ReadIterator == NULL ? 0 : pG6ReadIterator->numCharsForGraphOrder; + const int order = pG6ReadIterator == NULL ? 0 : pG6ReadIterator->order; + const int numCharsForOrder = pG6ReadIterator == NULL ? 0 : pG6ReadIterator->numCharsForOrder; const int numCharsForGraphEncoding = pG6ReadIterator == NULL ? 0 : pG6ReadIterator->numCharsForGraphEncoding; const int currGraphBuffSize = pG6ReadIterator == NULL ? 0 : pG6ReadIterator->currGraphBuffSize; char messageContents[MAXLINE + 1]; messageContents[0] = '\0'; - if (!_isG6ReadIteratorAllocated(pG6ReadIterator)) - { - ErrorMessage("G6ReadIterator is not allocated.\n"); - return NOTOK; - } - - if ((g6Input = pG6ReadIterator->g6Input) == NULL) + if (!_g6_IsReaderInitialized(pG6ReadIterator, true)) { - ErrorMessage("Pointer to .g6 string-or-file container is NULL.\n"); + ErrorMessage("G6ReadIterator is not initialized.\n"); return NOTOK; } + g6Input = pG6ReadIterator->g6Input; numGraphsRead = pG6ReadIterator->numGraphsRead; - - if ((currGraphBuff = pG6ReadIterator->currGraphBuff) == NULL) - { - ErrorMessage("currGraphBuff string is null.\n"); - return NOTOK; - } - + currGraphBuff = pG6ReadIterator->currGraphBuff; currGraph = pG6ReadIterator->currGraph; if (sf_fgets(currGraphBuff, currGraphBuffSize, g6Input) != NULL) @@ -416,7 +472,7 @@ int readGraphUsingG6ReadIterator(G6ReadIteratorP pG6ReadIterator) numGraphsRead++; firstChar = currGraphBuff[0]; - if (!_firstCharIsValid(firstChar, numGraphsRead)) + if (_g6_ValidateFirstChar(firstChar, numGraphsRead) != OK) return NOTOK; // From https://stackoverflow.com/a/28462221, strcspn finds the index of the first @@ -426,7 +482,7 @@ int readGraphUsingG6ReadIterator(G6ReadIteratorP pG6ReadIterator) // If the line was too long, then we would have placed the null terminator at the final // index (where it already was; see strcpn docs), and the length of the string will be // longer than the line should have been, i.e. orderOffset + numCharsForGraphRepr - if ((int)strlen(currGraphBuff) != (((numGraphsRead == 1) ? 0 : numCharsForGraphOrder) + numCharsForGraphEncoding)) + if ((int)strlen(currGraphBuff) != (((numGraphsRead == 1) ? 0 : numCharsForOrder) + numCharsForGraphEncoding)) { sprintf(messageContents, "Invalid line length read on line %d\n", numGraphsRead); ErrorMessage(messageContents); @@ -435,13 +491,11 @@ int readGraphUsingG6ReadIterator(G6ReadIteratorP pG6ReadIterator) if (numGraphsRead > 1) { - exitCode = _checkGraphOrder(currGraphBuff, graphOrder); - - if (exitCode != OK) + if (_g6_ValidateOrderOfEncodedGraph(currGraphBuff, order) != OK) { sprintf(messageContents, "Order of graph on line %d is incorrect.\n", numGraphsRead); ErrorMessage(messageContents); - return exitCode; + return NOTOK; } } @@ -449,15 +503,13 @@ int readGraphUsingG6ReadIterator(G6ReadIteratorP pG6ReadIterator) // order, so there's no need to apply the offset. On subsequent lines, the orderOffset // must be applied so that we are only starting validation on the byte corresponding to // the encoding of the adjacency matrix. - graphEncodingChars = (numGraphsRead == 1) ? currGraphBuff : currGraphBuff + numCharsForGraphOrder; + graphEncodingChars = (numGraphsRead == 1) ? currGraphBuff : currGraphBuff + numCharsForOrder; - exitCode = _validateGraphEncoding(graphEncodingChars, graphOrder, numCharsForGraphEncoding); - - if (exitCode != OK) + if (_g6_ValidateGraphEncoding(graphEncodingChars, order, numCharsForGraphEncoding) != OK) { sprintf(messageContents, "Graph on line %d is invalid.", numGraphsRead); ErrorMessage(messageContents); - return exitCode; + return NOTOK; } if (numGraphsRead > 1) @@ -467,13 +519,11 @@ int readGraphUsingG6ReadIterator(G6ReadIteratorP pG6ReadIterator) currGraph->internalFlags |= FLAGS_ZEROBASEDIO; } - exitCode = _decodeGraph(graphEncodingChars, graphOrder, numCharsForGraphEncoding, currGraph); - - if (exitCode != OK) + if (_g6_DecodeGraph(graphEncodingChars, order, numCharsForGraphEncoding, currGraph) != OK) { sprintf(messageContents, "Unable to interpret bits on line %d to populate adjacency matrix.\n", numGraphsRead); ErrorMessage(messageContents); - return exitCode; + return NOTOK; } pG6ReadIterator->numGraphsRead = numGraphsRead; @@ -481,134 +531,31 @@ int readGraphUsingG6ReadIterator(G6ReadIteratorP pG6ReadIterator) else { pG6ReadIterator->currGraph = NULL; - pG6ReadIterator->contentsExhausted = true; + pG6ReadIterator->endReached = true; } - return exitCode; -} - -int _checkGraphOrder(char *graphBuff, int graphOrder) -{ - int exitCode = OK; - int n = 0; - char currChar = graphBuff[0]; - - if (currChar == 126) - { - if (graphBuff[1] == 126) - { - ErrorMessage("Can only handle graphs of order <= 100,000.\n"); - return NOTOK; - } - else if (graphBuff[1] > 126) - { - ErrorMessage("Invalid graph order signifier.\n"); - return NOTOK; - } - else - { - int orderCharIndex = 2; - for (int i = 1; i < 4; i++) - n |= (graphBuff[i] - 63) << (6 * orderCharIndex--); - } - } - else if (currChar > 62 && currChar < 126) - n = currChar - 63; - else - { - ErrorMessage("Character doesn't correspond to a printable ASCII character.\n"); - return NOTOK; - } - - if (n != graphOrder) - { - char messageContents[MAXLINE + 1]; - sprintf(messageContents, "Graph order %d doesn't match expected graph order %d", n, graphOrder); - ErrorMessage(messageContents); - exitCode = NOTOK; - } - - return exitCode; -} - -int _validateGraphEncoding(char *graphBuff, const int graphOrder, const int numChars) -{ - int exitCode = OK; - int expectedNumPaddingZeroes = _getExpectedNumPaddingZeroes(graphOrder, numChars); - char finalByte = graphBuff[numChars - 1] - 63; - int numPaddingZeroes = 0; - - // Num edges of the graph (and therefore the number of bits) is (n * (n-1))/2, and - // since each resulting byte needs to correspond to an ascii character between 63 and 126, - // each group is only comprised of 6 bits (to which we add 63 for the final byte value) - int expectedNumChars = _getNumCharsForGraphEncoding(graphOrder); - int numCharsForGraphEncoding = strlen(graphBuff); - - if (expectedNumChars != numCharsForGraphEncoding) - { - char messageContents[MAXLINE + 1]; - messageContents[0] = '\0'; - sprintf(messageContents, "Invalid number of bytes for graph of order %d; got %d but expected %d\n", graphOrder, numCharsForGraphEncoding, expectedNumChars); - ErrorMessage(messageContents); - return NOTOK; - } - - // Check that characters are valid ASCII characters between 62 and 126 - for (int i = 0; i < numChars; i++) - { - if (graphBuff[i] < 63 || graphBuff[i] > 126) - { - char messageContents[MAXLINE + 1]; - messageContents[0] = '\0'; - sprintf(messageContents, "Invalid character at index %d: \"%c\"\n", i, graphBuff[i]); - ErrorMessage(messageContents); - return NOTOK; - } - } - - // Check that there are no extraneous bits in representation (since we pad out to a - // multiple of 6 before splitting into bytes and adding 63 to each byte) - for (int i = 0; i < expectedNumPaddingZeroes; i++) - { - if (finalByte & (1 << i)) - break; - - numPaddingZeroes++; - } - - if (numPaddingZeroes != expectedNumPaddingZeroes) - { - char messageContents[MAXLINE + 1]; - messageContents[0] = '\0'; - sprintf(messageContents, "Expected %d padding zeroes, but got %d.\n", expectedNumPaddingZeroes, numPaddingZeroes); - ErrorMessage(messageContents); - exitCode = NOTOK; - } - - return exitCode; + return OK; } -// Takes the character array graphBuff, the derived number of vertices graphOrder, +// Takes the character array graphBuff, the derived number of vertices order, // and the numChars corresponding to the number of characters after the first byte // and performs the inverse transformation of the graph encoding: we subtract 63 from // each byte, then only process the 6 least significant bits of the resulting byte. For // the final byte, we determine how many padding zeroes to expect, and exclude them // from being processed. We index into the adjacency matrix by row and column, which // are incremented such that row ranges from 0 to one less than the column index. -int _decodeGraph(char *graphBuff, const int graphOrder, const int numChars, graphP pGraph) +int _g6_DecodeGraph(char *graphBuff, const int order, const int numChars, graphP theGraph) { - int exitCode = OK; - - int numPaddingZeroes = _getExpectedNumPaddingZeroes(graphOrder, numChars); + int numPaddingZeroes = _g6_GetExpectedNumPaddingZeroes(order, numChars); char currByte = '\0'; int bitValue = 0; int row = 0; int col = 1; - if (pGraph == NULL) + if (theGraph == NULL) { - ErrorMessage("Must initialize graph datastructure before invoking _decodeGraph.\n"); + ErrorMessage("Must initialize graph datastructure before decoding the graph representation.\n"); return NOTOK; } @@ -633,49 +580,27 @@ int _decodeGraph(char *graphBuff, const int graphOrder, const int numChars, grap bitValue = ((currByte >> j) & 1u) ? 1 : 0; if (bitValue == 1) { - // Add gp_GetFirstVertex(pGraph), which is 1 if NIL == 0 (i.e. internal 1-based labelling) and 0 if NIL == -1 (internally 0-based) - exitCode = gp_DynamicAddEdge(pGraph, row + gp_GetFirstVertex(pGraph), 0, col + gp_GetFirstVertex(pGraph), 0); - if (exitCode != OK) - return exitCode; + // Add gp_GetFirstVertex(theGraph), which is 1 if NIL == 0 (i.e. internal 1-based labelling) and 0 if NIL == -1 (internally 0-based) + if (gp_DynamicAddEdge(theGraph, row + gp_GetFirstVertex(theGraph), 0, col + gp_GetFirstVertex(theGraph), 0) != OK) + return NOTOK; } row++; } } - return exitCode; -} - -int endG6ReadIteration(G6ReadIteratorP pG6ReadIterator) -{ - int exitCode = OK; - - if (pG6ReadIterator != NULL) - { - if (pG6ReadIterator->g6Input != NULL) - sf_Free(&(pG6ReadIterator->g6Input)); - - if (pG6ReadIterator->currGraphBuff != NULL) - { - free(pG6ReadIterator->currGraphBuff); - pG6ReadIterator->currGraphBuff = NULL; - } - } - - return exitCode; + return OK; } -int freeG6ReadIterator(G6ReadIteratorP *ppG6ReadIterator) +void g6_FreeReader(G6ReadIteratorP *ppG6ReadIterator) { - int exitCode = OK; - if (ppG6ReadIterator != NULL && (*ppG6ReadIterator) != NULL) { if ((*ppG6ReadIterator)->g6Input != NULL) sf_Free(&((*ppG6ReadIterator)->g6Input)); (*ppG6ReadIterator)->numGraphsRead = 0; - (*ppG6ReadIterator)->graphOrder = 0; + (*ppG6ReadIterator)->order = 0; if ((*ppG6ReadIterator)->currGraphBuff != NULL) { @@ -688,11 +613,9 @@ int freeG6ReadIterator(G6ReadIteratorP *ppG6ReadIterator) free((*ppG6ReadIterator)); (*ppG6ReadIterator) = NULL; } - - return exitCode; } -int _ReadGraphFromG6FilePath(graphP pGraphToRead, char *pathToG6File) +int _g6_ReadGraphFromFile(graphP theGraph, char *pathToG6File) { char const *messageFormat = NULL; int charsAvailForStr = 0; @@ -713,10 +636,10 @@ int _ReadGraphFromG6FilePath(graphP pGraphToRead, char *pathToG6File) return NOTOK; } - return _ReadGraphFromG6StrOrFile(pGraphToRead, inputContainer); + return _g6_ReadGraphFromStrOrFile(theGraph, inputContainer); } -int _ReadGraphFromG6String(graphP pGraphToRead, char *g6EncodedString) +int _g6_ReadGraphFromString(graphP theGraph, char *g6EncodedString) { strOrFileP inputContainer = NULL; @@ -732,52 +655,38 @@ int _ReadGraphFromG6String(graphP pGraphToRead, char *g6EncodedString) return NOTOK; } - return _ReadGraphFromG6StrOrFile(pGraphToRead, inputContainer); + return _g6_ReadGraphFromStrOrFile(theGraph, inputContainer); } -int _ReadGraphFromG6StrOrFile(graphP pGraphToRead, strOrFileP g6InputContainer) +int _g6_ReadGraphFromStrOrFile(graphP theGraph, strOrFileP g6InputContainer) { - int exitCode = OK; - G6ReadIteratorP pG6ReadIterator = NULL; - if (sf_ValidateStrOrFile(g6InputContainer) != OK) + if (!sf_IsValidStrOrFile(g6InputContainer)) { ErrorMessage("Invalid G6 output container.\n"); return NOTOK; } - if (allocateG6ReadIterator(&pG6ReadIterator, pGraphToRead) != OK) + if (g6_NewReader(&pG6ReadIterator, theGraph) != OK) { ErrorMessage("Unable to allocate G6ReadIterator.\n"); return NOTOK; } - if (beginG6ReadIterationFromG6StrOrFile(pG6ReadIterator, g6InputContainer) != OK) + if (_g6_InitReaderWithStrOrFile(pG6ReadIterator, g6InputContainer) != OK) { - ErrorMessage("Unable to begin .g6 read iteration.\n"); + ErrorMessage("Unable to initialize G6ReadIterator.\n"); - if (freeG6ReadIterator(&pG6ReadIterator) != OK) - ErrorMessage("Unable to free G6ReadIterator.\n"); + g6_FreeReader(&pG6ReadIterator); return NOTOK; } - exitCode = readGraphUsingG6ReadIterator(pG6ReadIterator); - if (exitCode != OK) + if (g6_ReadGraph(pG6ReadIterator) != OK) ErrorMessage("Unable to read graph from .g6 read iterator.\n"); - if (endG6ReadIteration(pG6ReadIterator) != OK) - { - ErrorMessage("Unable to end G6ReadIterator.\n"); - exitCode = NOTOK; - } - - if (freeG6ReadIterator(&pG6ReadIterator) != OK) - { - ErrorMessage("Unable to free G6ReadIterator.\n"); - exitCode = NOTOK; - } + g6_FreeReader(&pG6ReadIterator); - return exitCode; + return OK; } diff --git a/planarity/c/graphLib/io/g6-read-iterator.h b/planarity/c/graphLib/io/g6-read-iterator.h index 76f3223..65e17ec 100644 --- a/planarity/c/graphLib/io/g6-read-iterator.h +++ b/planarity/c/graphLib/io/g6-read-iterator.h @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -23,46 +23,31 @@ extern "C" strOrFileP g6Input; int numGraphsRead; - int graphOrder; - int numCharsForGraphOrder; + int order; + int numCharsForOrder; int numCharsForGraphEncoding; int currGraphBuffSize; char *currGraphBuff; graphP currGraph; - bool contentsExhausted; + bool endReached; } G6ReadIterator; typedef G6ReadIterator *G6ReadIteratorP; - int allocateG6ReadIterator(G6ReadIteratorP *, graphP); - bool _isG6ReadIteratorAllocated(G6ReadIteratorP); - bool contentsExhausted(G6ReadIteratorP pG6ReadIterator); + int g6_NewReader(G6ReadIteratorP *ppG6ReadIterator, graphP theGraph); + bool g6_EndReached(G6ReadIteratorP pG6ReadIterator); - int getNumGraphsRead(G6ReadIteratorP, int *); - int getOrderOfGraphToRead(G6ReadIteratorP, int *); - int getPointerToGraphReadIn(G6ReadIteratorP, graphP *); + int g6_GetNumGraphsRead(G6ReadIteratorP pG6ReadIterator, int *pNumGraphsRead); + int g6_GetOrderFromReader(G6ReadIteratorP pG6ReadIterator, int *pOrder); + int g6_GetGraphFromReader(G6ReadIteratorP pG6ReadIterator, graphP *pTheGraph); - int beginG6ReadIterationFromG6String(G6ReadIteratorP, char *); - int beginG6ReadIterationFromG6FilePath(G6ReadIteratorP, char *); - int beginG6ReadIterationFromG6StrOrFile(G6ReadIteratorP, strOrFileP); - int _beginG6ReadIteration(G6ReadIteratorP); - int _processAndCheckHeader(strOrFileP); - bool _firstCharIsValid(char, const int); - int _getGraphOrder(strOrFileP, int *); + int g6_InitReaderWithString(G6ReadIteratorP pG6ReadIterator, char *inputString); + int g6_InitReaderWithFileName(G6ReadIteratorP pG6ReadIterator, char const *const infileName); - int readGraphUsingG6ReadIterator(G6ReadIteratorP); - int _checkGraphOrder(char *, int); - int _validateGraphEncoding(char *, const int, const int); - int _decodeGraph(char *, const int, const int, graphP); + int g6_ReadGraph(G6ReadIteratorP pG6ReadIterator); - int endG6ReadIteration(G6ReadIteratorP); - - int freeG6ReadIterator(G6ReadIteratorP *); - - int _ReadGraphFromG6FilePath(graphP, char *); - int _ReadGraphFromG6String(graphP, char *); - int _ReadGraphFromG6StrOrFile(graphP, strOrFileP); + void g6_FreeReader(G6ReadIteratorP *ppG6ReadIterator); #ifdef __cplusplus } diff --git a/planarity/c/graphLib/io/g6-write-iterator.c b/planarity/c/graphLib/io/g6-write-iterator.c index 6aea9d8..246ff0f 100644 --- a/planarity/c/graphLib/io/g6-write-iterator.c +++ b/planarity/c/graphLib/io/g6-write-iterator.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -8,19 +8,46 @@ See the LICENSE.TXT file for licensing information. #include #include "g6-write-iterator.h" -#include "g6-api-utilities.h" -int allocateG6WriteIterator(G6WriteIteratorP *ppG6WriteIterator, graphP pGraph) +/* Imported functions */ +extern int _g6_GetNumCharsForEncoding(int); +extern int _g6_GetNumCharsForOrder(int); +extern int _g6_ValidateOrderOfEncodedGraph(char *graphBuff, int order); +extern int _g6_ValidateGraphEncoding(char *graphBuff, const int order, const int numChars); + +/* Private function declarations (exported within system) */ +int _g6_WriteGraphToStrOrFile(graphP theGraph, strOrFileP outputContainer, char **outputStr); + +/* Private functions */ +int _g6_InitWriterWithStrOrFile(G6WriteIteratorP pG6WriteIterator, strOrFileP outputContainer); +int _g6_InitWriter(G6WriteIteratorP pG6WriteIterator); +bool _g6_IsWriterInitialized(G6WriteIteratorP pG6WriteIterator, bool reportUninitializedParts); +void _g6_PrecomputeColumnOffsets(int *columnOffsets, int order); +void _g6_EncodeAdjMatAsG6(G6WriteIteratorP pG6WriteIterator); +void _g6_GetFirstEdgeInUse(graphP theGraph, int *e, int *u, int *v); +void _g6_GetNextEdgeInUse(graphP theGraph, int *e, int *u, int *v); +int _g6_WriteEncodedGraph(G6WriteIteratorP pG6WriteIterator); + +int _g6_WriteGraphToFile(graphP theGraph, char *g6OutputFileName); +int _g6_WriteGraphToString(graphP theGraph, char **g6OutputStr); + +int g6_NewWriter(G6WriteIteratorP *ppG6WriteIterator, graphP theGraph) { - int exitCode = OK; - if (ppG6WriteIterator != NULL && (*ppG6WriteIterator) != NULL) { ErrorMessage("G6WriteIterator is not NULL and therefore can't be allocated.\n"); return NOTOK; } - // numGraphsWritten, graphOrder, numCharsForGraphOrder, + if (theGraph == NULL || gp_GetN(theGraph) <= 0) + { + ErrorMessage("Must allocate and initialize graph with an order greater " + "than 0 to use the G6WriteIterator.\n"); + + return NOTOK; + } + + // numGraphsWritten, order, numCharsForOrder, // numCharsForGraphEncoding, and currGraphBuffSize all set to 0 (*ppG6WriteIterator) = (G6WriteIteratorP)calloc(1, sizeof(G6WriteIterator)); @@ -33,182 +60,212 @@ int allocateG6WriteIterator(G6WriteIteratorP *ppG6WriteIterator, graphP pGraph) (*ppG6WriteIterator)->g6Output = NULL; (*ppG6WriteIterator)->currGraphBuff = NULL; (*ppG6WriteIterator)->columnOffsets = NULL; + (*ppG6WriteIterator)->currGraph = theGraph; - if (pGraph == NULL || gp_getN(pGraph) <= 0) - { - ErrorMessage("[ERROR] Must allocate and initialize graph with an order greater than 0 to use the G6WriteIterator.\n"); - - exitCode = freeG6WriteIterator(ppG6WriteIterator); - - if (exitCode != OK) - ErrorMessage("Unable to free the G6WriteIterator.\n"); - } - else - (*ppG6WriteIterator)->currGraph = pGraph; - - return exitCode; + return OK; } -bool _isG6WriteIteratorAllocated(G6WriteIteratorP pG6WriteIterator) +bool _g6_IsWriterInitialized(G6WriteIteratorP pG6WriteIterator, bool reportUninitializedParts) { - bool G6WriteIteratorIsAllocated = true; + bool writerIsInitialized = true; if (pG6WriteIterator == NULL) { - ErrorMessage("G6WriteIterator is NULL.\n"); - G6WriteIteratorIsAllocated = false; + if (reportUninitializedParts) + ErrorMessage("G6WriteIterator is NULL.\n"); + writerIsInitialized = false; } else { - if (sf_ValidateStrOrFile(pG6WriteIterator->g6Output) != OK) + if (!sf_IsValidStrOrFile(pG6WriteIterator->g6Output)) { - ErrorMessage("G6WriteIterator's g6Output is not valid.\n"); - G6WriteIteratorIsAllocated = false; + if (reportUninitializedParts) + ErrorMessage("G6WriteIterator's g6Output is not valid.\n"); + writerIsInitialized = false; } if (pG6WriteIterator->currGraphBuff == NULL) { - ErrorMessage("G6WriteIterator's currGraphBuff is NULL.\n"); - G6WriteIteratorIsAllocated = false; + if (reportUninitializedParts) + ErrorMessage("G6WriteIterator's currGraphBuff is NULL.\n"); + writerIsInitialized = false; } if (pG6WriteIterator->columnOffsets == NULL) { - ErrorMessage("G6WriteIterator's columnOffsets is NULL.\n"); - G6WriteIteratorIsAllocated = false; + if (reportUninitializedParts) + ErrorMessage("G6WriteIterator's columnOffsets is NULL.\n"); + writerIsInitialized = false; } if (pG6WriteIterator->currGraph == NULL) { - ErrorMessage("G6WriteIterator's currGraph is NULL.\n"); - G6WriteIteratorIsAllocated = false; + if (reportUninitializedParts) + ErrorMessage("G6WriteIterator's currGraph is NULL.\n"); + writerIsInitialized = false; } - if (gp_getN(pG6WriteIterator->currGraph) == 0) + if (gp_GetN(pG6WriteIterator->currGraph) == 0) { - ErrorMessage("G6WriteIterator's currGraph does not contain a valid " - "graph.\n"); - G6WriteIteratorIsAllocated = false; + if (reportUninitializedParts) + ErrorMessage("G6WriteIterator's currGraph does not contain a valid " + "graph.\n"); + writerIsInitialized = false; } } - return G6WriteIteratorIsAllocated; + return writerIsInitialized; } -int getNumGraphsWritten(G6WriteIteratorP pG6WriteIterator, int *pNumGraphsRead) +int g6_GetNumGraphsWritten(G6WriteIteratorP pG6WriteIterator, int *pNumGraphsWritten) { - if (pG6WriteIterator == NULL) + if (!_g6_IsWriterInitialized(pG6WriteIterator, true)) { - ErrorMessage("G6WriteIterator is not allocated.\n"); + ErrorMessage("Unable to get numGraphsWritten, as G6WriteIterator is " + "not initialized.\n"); + + (*pNumGraphsWritten) = 0; + return NOTOK; } - (*pNumGraphsRead) = pG6WriteIterator->numGraphsWritten; + (*pNumGraphsWritten) = pG6WriteIterator->numGraphsWritten; return OK; } -int getOrderOfGraphToWrite(G6WriteIteratorP pG6WriteIterator, int *pGraphOrder) +int g6_GetOrderFromWriter(G6WriteIteratorP pG6WriteIterator, int *pOrder) { - if (pG6WriteIterator == NULL) + if (!_g6_IsWriterInitialized(pG6WriteIterator, true)) { - ErrorMessage("G6WriteIterator is not allocated.\n"); + ErrorMessage("Unable to get order, as G6WriteIterator is not " + "initialized.\n"); + + (*pOrder) = 0; + return NOTOK; } - (*pGraphOrder) = pG6WriteIterator->graphOrder; + (*pOrder) = pG6WriteIterator->order; return OK; } -int getPointerToGraphToWrite(G6WriteIteratorP pG6WriteIterator, graphP *ppGraph) +int g6_GetGraphFromWriter(G6WriteIteratorP pG6WriteIterator, graphP *pTheGraph) { - if (pG6WriteIterator == NULL) + if (!_g6_IsWriterInitialized(pG6WriteIterator, true)) { - ErrorMessage("[ERROR] G6WriteIterator is not allocated.\n"); + ErrorMessage("Unable to get numGraphsWritten, as G6WriteIterator is " + "not initialized.\n"); + + (*pTheGraph) = NULL; + return NOTOK; } - (*ppGraph) = pG6WriteIterator->currGraph; + (*pTheGraph) = pG6WriteIterator->currGraph; return OK; } -int beginG6WriteIterationToG6String(G6WriteIteratorP pG6WriteIterator) +int g6_InitWriterWithString(G6WriteIteratorP pG6WriteIterator) { - return beginG6WriteIterationToG6StrOrFile( - pG6WriteIterator, - sf_New(NULL, NULL, WRITETEXT)); -} + if (pG6WriteIterator == NULL) + { + ErrorMessage("Unable to initialize writer, since pointer to " + "pG6WriteIterator is NULL.\n"); + return NOTOK; + } -int beginG6WriteIterationToG6FilePath(G6WriteIteratorP pG6WriteIterator, char *outputFilename) -{ - return beginG6WriteIterationToG6StrOrFile( + if (_g6_IsWriterInitialized(pG6WriteIterator, false)) + { + ErrorMessage("Unable to initialize writer, as it was already previously initialized.\n"); + return NOTOK; + } + + return _g6_InitWriterWithStrOrFile( pG6WriteIterator, - sf_New(NULL, outputFilename, WRITETEXT)); + sf_New(NULL, NULL, WRITETEXT)); } -int beginG6WriteIterationToG6StrOrFile(G6WriteIteratorP pG6WriteIterator, strOrFileP outputContainer) +int g6_InitWriterWithFileName(G6WriteIteratorP pG6WriteIterator, char *outputFileName) { - int exitCode = OK; - if (pG6WriteIterator == NULL) { - ErrorMessage("Invalid parameter pG6WriteIterator.\n"); + ErrorMessage("Unable to initialize writer, since pointer to " + "pG6WriteIterator is NULL.\n"); return NOTOK; } - if (sf_ValidateStrOrFile(outputContainer) != OK) + if (_g6_IsWriterInitialized(pG6WriteIterator, false)) { - ErrorMessage("Invalid strOrFile output container provided.\n"); + ErrorMessage("Unable to initialize writer, as it was already previously initialized.\n"); return NOTOK; } - pG6WriteIterator->g6Output = outputContainer; + if (outputFileName == NULL || strlen(outputFileName) == 0) + { + ErrorMessage("Unable to initialize writer with NULL or empty output file name.\n"); + return NOTOK; + } - exitCode = _beginG6WriteIteration(pG6WriteIterator); + return _g6_InitWriterWithStrOrFile( + pG6WriteIterator, + sf_New(NULL, outputFileName, WRITETEXT)); +} - if (exitCode != OK) - ErrorMessage("Unable to begin .g6 write iteration to given strOrFile output container.\n"); +int _g6_InitWriterWithStrOrFile(G6WriteIteratorP pG6WriteIterator, strOrFileP outputContainer) +{ + if (!sf_IsValidStrOrFile(outputContainer)) + { + ErrorMessage("Unable to initialize writer with invalid strOrFile " + "output container.\n"); + return NOTOK; + } + + pG6WriteIterator->g6Output = outputContainer; - return exitCode; + return _g6_InitWriter(pG6WriteIterator); } -int _beginG6WriteIteration(G6WriteIteratorP pG6WriteIterator) +int _g6_InitWriter(G6WriteIteratorP pG6WriteIterator) { - int exitCode = OK; - char const *g6Header = ">>graph6<<"; + if (sf_fputs(g6Header, pG6WriteIterator->g6Output) < 0) { - ErrorMessage("Unable to fputs header to g6Output.\n"); + ErrorMessage("Unable to initialize writer due to failure to fputs " + "header to g6Output.\n"); return NOTOK; } - pG6WriteIterator->graphOrder = gp_getN(pG6WriteIterator->currGraph); + pG6WriteIterator->order = gp_GetN(pG6WriteIterator->currGraph); - pG6WriteIterator->columnOffsets = (int *)calloc(pG6WriteIterator->graphOrder + 1, sizeof(int)); + pG6WriteIterator->columnOffsets = (int *)calloc(pG6WriteIterator->order + 1, sizeof(int)); if (pG6WriteIterator->columnOffsets == NULL) { - ErrorMessage("Unable to allocate memory for column offsets.\n"); + ErrorMessage("Unable to initialize writer due to failure to allocate " + "memory for column offsets.\n"); return NOTOK; } - _precomputeColumnOffsets(pG6WriteIterator->columnOffsets, pG6WriteIterator->graphOrder); + _g6_PrecomputeColumnOffsets(pG6WriteIterator->columnOffsets, pG6WriteIterator->order); - pG6WriteIterator->numCharsForGraphOrder = _getNumCharsForGraphOrder(pG6WriteIterator->graphOrder); - pG6WriteIterator->numCharsForGraphEncoding = _getNumCharsForGraphEncoding(pG6WriteIterator->graphOrder); + pG6WriteIterator->numCharsForOrder = _g6_GetNumCharsForOrder(pG6WriteIterator->order); + pG6WriteIterator->numCharsForGraphEncoding = _g6_GetNumCharsForEncoding(pG6WriteIterator->order); // Must add 3 bytes for newline, possible carriage return, and null terminator - pG6WriteIterator->currGraphBuffSize = pG6WriteIterator->numCharsForGraphOrder + pG6WriteIterator->numCharsForGraphEncoding + 3; + pG6WriteIterator->currGraphBuffSize = pG6WriteIterator->numCharsForOrder + pG6WriteIterator->numCharsForGraphEncoding + 3; + pG6WriteIterator->currGraphBuff = (char *)calloc(pG6WriteIterator->currGraphBuffSize, sizeof(char)); if (pG6WriteIterator->currGraphBuff == NULL) { - ErrorMessage("Unable to allocate memory for currGraphBuff.\n"); - exitCode = NOTOK; + ErrorMessage("Unable to initialize writer due to failure to allocate " + "memory for currGraphBuff.\n"); + return NOTOK; } - return exitCode; + return OK; } -void _precomputeColumnOffsets(int *columnOffsets, int graphOrder) +void _g6_PrecomputeColumnOffsets(int *columnOffsets, int order) { if (columnOffsets == NULL) { @@ -218,38 +275,51 @@ void _precomputeColumnOffsets(int *columnOffsets, int graphOrder) columnOffsets[0] = 0; columnOffsets[1] = 0; - for (int i = 2; i <= graphOrder; i++) + for (int i = 2; i <= order; i++) columnOffsets[i] = columnOffsets[i - 1] + (i - 1); } -int writeGraphUsingG6WriteIterator(G6WriteIteratorP pG6WriteIterator) +int g6_WriteGraph(G6WriteIteratorP pG6WriteIterator) { - int exitCode = OK; + char *graphEncodingChars = NULL; + if (!_g6_IsWriterInitialized(pG6WriteIterator, true)) + { + ErrorMessage("Unable to write graph because G6WriteIterator is not initialized.\n"); + return NOTOK; + } - exitCode = _encodeAdjMatAsG6(pG6WriteIterator); - if (exitCode != OK) + _g6_EncodeAdjMatAsG6(pG6WriteIterator); + + if (_g6_ValidateOrderOfEncodedGraph(pG6WriteIterator->currGraphBuff, pG6WriteIterator->order) != OK) { - ErrorMessage("Error converting adjacency matrix to g6 format.\n"); - return exitCode; + ErrorMessage("Unable to write graph, as constructed encoding has incorrect order.\n"); + return NOTOK; } - exitCode = _printEncodedGraph(pG6WriteIterator); - if (exitCode != OK) - ErrorMessage("Unable to output g6 encoded graph to string-or-file container.\n"); + graphEncodingChars = pG6WriteIterator->currGraphBuff + pG6WriteIterator->numCharsForOrder; + if (_g6_ValidateGraphEncoding(graphEncodingChars, pG6WriteIterator->order, pG6WriteIterator->numCharsForGraphEncoding) != OK) + { + ErrorMessage("Unable to write graph, as constructed encoding is invalid.\n"); + return NOTOK; + } + + if (_g6_WriteEncodedGraph(pG6WriteIterator) != OK) + { + ErrorMessage("Unable to write g6 encoded graph to output container.\n"); + return NOTOK; + } - return exitCode; + return OK; } -int _encodeAdjMatAsG6(G6WriteIteratorP pG6WriteIterator) +void _g6_EncodeAdjMatAsG6(G6WriteIteratorP pG6WriteIterator) { - int exitCode = OK; - char *g6Encoding = NULL; int *columnOffsets = NULL; - graphP pGraph = NULL; + graphP theGraph = NULL; - int graphOrder = 0; - int numCharsForGraphOrder = 0; + int order = 0; + int numCharsForOrder = 0; int numCharsForGraphEncoding = 0; int totalNumCharsForOrderAndGraph = 0; @@ -257,51 +327,39 @@ int _encodeAdjMatAsG6(G6WriteIteratorP pG6WriteIterator) int charOffset = 0; int bitPositionPower = 0; - if (!_isG6WriteIteratorAllocated(pG6WriteIterator)) - { - ErrorMessage("Unable to encode graph with invalid G6WriteIterator\n"); - return NOTOK; - } - g6Encoding = pG6WriteIterator->currGraphBuff; columnOffsets = pG6WriteIterator->columnOffsets; - pGraph = pG6WriteIterator->currGraph; + theGraph = pG6WriteIterator->currGraph; // memset ensures all bits are zero, which means we only need to set the bits // that correspond to an edge; this also takes care of padding zeroes for us memset(pG6WriteIterator->currGraphBuff, 0, (pG6WriteIterator->currGraphBuffSize) * sizeof(char)); - graphOrder = pG6WriteIterator->graphOrder; - numCharsForGraphOrder = pG6WriteIterator->numCharsForGraphOrder; + order = pG6WriteIterator->order; + numCharsForOrder = pG6WriteIterator->numCharsForOrder; numCharsForGraphEncoding = pG6WriteIterator->numCharsForGraphEncoding; - totalNumCharsForOrderAndGraph = numCharsForGraphOrder + numCharsForGraphEncoding; + totalNumCharsForOrderAndGraph = numCharsForOrder + numCharsForGraphEncoding; - if (graphOrder > 62) + if (order > 62) { - int i, intermediate; - g6Encoding[0] = 126; // bytes 1 through 3 will be populated with the 18-bit representation of the graph order - intermediate = -1; - for (i = 0; i < 3; i++) + int intermediate = -1; + g6Encoding[0] = 126; + + for (int i = 0; i < 3; i++) { - intermediate = graphOrder >> (6 * i); + intermediate = order >> (6 * i); g6Encoding[3 - i] = intermediate & 63; g6Encoding[3 - i] += 63; } } - else if (graphOrder > 1 && graphOrder < 63) + else if (order > 1 && order < 63) { - g6Encoding[0] = (char)(graphOrder + 63); + g6Encoding[0] = (char)(order + 63); } u = v = e = NIL; - exitCode = _getFirstEdge(pGraph, &e, &u, &v); - - if (exitCode != OK) - { - ErrorMessage("Unable to fetch first edge in graph.\n"); - return exitCode; - } + _g6_GetFirstEdgeInUse(theGraph, &e, &u, &v); charOffset = bitPositionPower = 0; while (u != NIL && v != NIL) @@ -329,65 +387,40 @@ int _encodeAdjMatAsG6(G6WriteIteratorP pG6WriteIterator) // bit to set in that byte by left-shifting 1 by (5 - ((columnOffsets[v] + u) % 6)) // (transforming the ((columnOffsets[v] + u) % 6)th bit from the left to the // (5 - ((columnOffsets[v] + u) % 6))th bit from the right) - charOffset = numCharsForGraphOrder + ((columnOffsets[v] + u) / 6); + charOffset = numCharsForOrder + ((columnOffsets[v] + u) / 6); bitPositionPower = 5 - ((columnOffsets[v] + u) % 6); g6Encoding[charOffset] |= (1u << bitPositionPower); - exitCode = _getNextEdge(pGraph, &e, &u, &v); - - if (exitCode != OK) - { - ErrorMessage("Unable to fetch next edge in graph.\n"); - free(columnOffsets); - free(g6Encoding); - return exitCode; - } + _g6_GetNextEdgeInUse(theGraph, &e, &u, &v); } // Bytes corresponding to graph order have already been modified to // correspond to printable ascii character (i.e. by adding 63); must // now do the same for bytes corresponding to edge lists - for (int i = numCharsForGraphOrder; i < totalNumCharsForOrderAndGraph; i++) + for (int i = numCharsForOrder; i < totalNumCharsForOrderAndGraph; i++) g6Encoding[i] += 63; - - return exitCode; -} - -int _getFirstEdge(graphP theGraph, int *e, int *u, int *v) -{ - if (theGraph == NULL) - return NOTOK; - - if ((*e) >= gp_EdgeInUseIndexBound(theGraph)) - { - ErrorMessage("First edge is outside bounds."); - return NOTOK; - } - - (*e) = gp_GetFirstEdge(theGraph); - - return _getNextInUseEdge(theGraph, e, u, v); } -int _getNextEdge(graphP theGraph, int *e, int *u, int *v) +void _g6_GetFirstEdgeInUse(graphP theGraph, int *e, int *u, int *v) { - if (theGraph == NULL) - return NOTOK; + (*e) = NIL; - (*e) += 2; - - return _getNextInUseEdge(theGraph, e, u, v); + _g6_GetNextEdgeInUse(theGraph, e, u, v); } -int _getNextInUseEdge(graphP theGraph, int *e, int *u, int *v) +void _g6_GetNextEdgeInUse(graphP theGraph, int *e, int *u, int *v) { - int exitCode = OK; - int EsizeOccupied = gp_EdgeInUseIndexBound(theGraph); + int EsizeOccupied = gp_EdgeInUseArraySize(theGraph); (*u) = NIL; (*v) = NIL; + if ((*e) == NIL) + (*e) = gp_GetFirstEdge(theGraph); + else + (*e) += 2; + if ((*e) < EsizeOccupied) { while (!gp_EdgeInUse(theGraph, (*e))) @@ -403,77 +436,34 @@ int _getNextInUseEdge(graphP theGraph, int *e, int *u, int *v) (*v) = gp_GetNeighbor(theGraph, gp_GetTwinArc(theGraph, (*e))); } } - - return exitCode; } -int _printEncodedGraph(G6WriteIteratorP pG6WriteIterator) +int _g6_WriteEncodedGraph(G6WriteIteratorP pG6WriteIterator) { - int exitCode = OK; - - if (pG6WriteIterator->g6Output == NULL) - { - ErrorMessage("Unable to print to NULL string-or-file container.\n"); - return NOTOK; - } - - if (pG6WriteIterator->currGraphBuff == NULL || strlen(pG6WriteIterator->currGraphBuff) == 0) - { - ErrorMessage("Unable to print; g6 encoding is empty.\n"); - return NOTOK; - } - if (sf_fputs(pG6WriteIterator->currGraphBuff, pG6WriteIterator->g6Output) < 0) { ErrorMessage("Failed to output all characters of g6 encoding.\n"); - exitCode = NOTOK; + return NOTOK; } if (sf_fputs("\n", pG6WriteIterator->g6Output) < 0) { ErrorMessage("Failed to put line terminator after g6 encoding.\n"); - exitCode = NOTOK; - } - - return exitCode; -} - -int endG6WriteIteration(G6WriteIteratorP pG6WriteIterator) -{ - int exitCode = OK; - - if (pG6WriteIterator != NULL) - { - if (pG6WriteIterator->g6Output != NULL) - sf_Free(&(pG6WriteIterator->g6Output)); - - if (pG6WriteIterator->currGraphBuff != NULL) - { - free(pG6WriteIterator->currGraphBuff); - pG6WriteIterator->currGraphBuff = NULL; - } - - if (pG6WriteIterator->columnOffsets != NULL) - { - free((pG6WriteIterator->columnOffsets)); - pG6WriteIterator->columnOffsets = NULL; - } + return NOTOK; } - return exitCode; + return OK; } -int freeG6WriteIterator(G6WriteIteratorP *ppG6WriteIterator) +void g6_FreeWriter(G6WriteIteratorP *ppG6WriteIterator) { - int exitCode = OK; - if (ppG6WriteIterator != NULL && (*ppG6WriteIterator) != NULL) { if ((*ppG6WriteIterator)->g6Output != NULL) sf_Free(&((*ppG6WriteIterator)->g6Output)); (*ppG6WriteIterator)->numGraphsWritten = 0; - (*ppG6WriteIterator)->graphOrder = 0; + (*ppG6WriteIterator)->order = 0; if ((*ppG6WriteIterator)->currGraphBuff != NULL) { @@ -493,23 +483,21 @@ int freeG6WriteIterator(G6WriteIteratorP *ppG6WriteIterator) free((*ppG6WriteIterator)); (*ppG6WriteIterator) = NULL; } - - return exitCode; } -int _WriteGraphToG6FilePath(graphP pGraph, char *g6OutputFilename) +int _g6_WriteGraphToFile(graphP theGraph, char *g6OutputFileName) { - strOrFileP outputContainer = sf_New(NULL, g6OutputFilename, WRITETEXT); + strOrFileP outputContainer = sf_New(NULL, g6OutputFileName, WRITETEXT); if (outputContainer == NULL) { ErrorMessage("Unable to allocate outputContainer to which to write.\n"); return NOTOK; } - return _WriteGraphToG6StrOrFile(pGraph, outputContainer, NULL); + return _g6_WriteGraphToStrOrFile(theGraph, outputContainer, NULL); } -int _WriteGraphToG6String(graphP pGraph, char **g6OutputStr) +int _g6_WriteGraphToString(graphP theGraph, char **g6OutputStr) { strOrFileP outputContainer = sf_New(NULL, NULL, WRITETEXT); if (outputContainer == NULL) @@ -520,20 +508,18 @@ int _WriteGraphToG6String(graphP pGraph, char **g6OutputStr) // N.B. If g6OutputStr is a pointer to a pointer to a block of memory that // has been allocated, i.e. if g6OutputStr != NULL && (*g6OutputStr) != NULL - // then an error will be emitted by _WriteGraphToG6StrOrFile(). + // then an error will be emitted by _g6_WriteGraphToStrOrFile(). // N.B. Once the graph is successfully written, the string is taken from // the G6WriteIterator's outputContainer and assigned to (*g6OutputStr) - // before ending G6 write iteration - return _WriteGraphToG6StrOrFile(pGraph, outputContainer, g6OutputStr); + // before freeing the G6 write iterator. + return _g6_WriteGraphToStrOrFile(theGraph, outputContainer, g6OutputStr); } -int _WriteGraphToG6StrOrFile(graphP pGraph, strOrFileP outputContainer, char **outputStr) +int _g6_WriteGraphToStrOrFile(graphP theGraph, strOrFileP outputContainer, char **outputStr) { - int exitCode = OK; - G6WriteIteratorP pG6WriteIterator = NULL; - if (sf_ValidateStrOrFile(outputContainer) != OK) + if (!sf_IsValidStrOrFile(outputContainer)) { ErrorMessage("Invalid G6 output container.\n"); return NOTOK; @@ -542,8 +528,8 @@ int _WriteGraphToG6StrOrFile(graphP pGraph, strOrFileP outputContainer, char **o if (outputContainer->theStr != NULL && (outputStr == NULL)) { ErrorMessage("If writing G6 to string, must provide pointer-pointer " - "to allow _WriteGraphToG6StrOrFile() to assign the address " - "of the output string.\n"); + "to allow _g6_WriteGraphToStrOrFile() to assign the " + "address of the output string.\n"); return NOTOK; } @@ -553,42 +539,39 @@ int _WriteGraphToG6StrOrFile(graphP pGraph, strOrFileP outputContainer, char **o return NOTOK; } - exitCode = allocateG6WriteIterator(&pG6WriteIterator, pGraph); - if (exitCode != OK) + if (g6_NewWriter(&pG6WriteIterator, theGraph) != OK) { ErrorMessage("Unable to allocate G6WriteIterator.\n"); - freeG6WriteIterator(&pG6WriteIterator); - return exitCode; + g6_FreeWriter(&pG6WriteIterator); + return NOTOK; } - exitCode = beginG6WriteIterationToG6StrOrFile(pG6WriteIterator, outputContainer); - if (exitCode != OK) + if (_g6_InitWriterWithStrOrFile(pG6WriteIterator, outputContainer) != OK) { - ErrorMessage("Unable to begin G6 write iteration.\n"); - freeG6WriteIterator(&pG6WriteIterator); - return exitCode; + ErrorMessage("Unable to initialize G6WriteIterator.\n"); + g6_FreeWriter(&pG6WriteIterator); + return NOTOK; } - exitCode = writeGraphUsingG6WriteIterator(pG6WriteIterator); - if (exitCode != OK) - ErrorMessage("Unable to write graph using G6WriteIterator.\n"); - else + if (g6_WriteGraph(pG6WriteIterator) != OK) { - if (outputStr != NULL && pG6WriteIterator->g6Output->theStr != NULL) - (*outputStr) = sf_takeTheStr(pG6WriteIterator->g6Output); + ErrorMessage("Unable to write graph using G6WriteIterator.\n"); + g6_FreeWriter(&pG6WriteIterator); + return NOTOK; } - if (endG6WriteIteration(pG6WriteIterator) != OK) + if (outputStr != NULL && pG6WriteIterator->g6Output != NULL) { - ErrorMessage("Unable to end G6 write iteration.\n"); - exitCode = NOTOK; + (*outputStr) = sf_takeTheStr(pG6WriteIterator->g6Output); + if ((*outputStr) == NULL || strlen((*outputStr)) == 0) + { + ErrorMessage("Failed to transfer ownership of string contained by output container.\n"); + g6_FreeWriter(&pG6WriteIterator); + return NOTOK; + } } - if (freeG6WriteIterator(&pG6WriteIterator) != OK) - { - ErrorMessage("Unable to free G6Writer.\n"); - exitCode = NOTOK; - } + g6_FreeWriter(&pG6WriteIterator); - return exitCode; + return OK; } diff --git a/planarity/c/graphLib/io/g6-write-iterator.h b/planarity/c/graphLib/io/g6-write-iterator.h index c855d8f..5cae84f 100644 --- a/planarity/c/graphLib/io/g6-write-iterator.h +++ b/planarity/c/graphLib/io/g6-write-iterator.h @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -23,8 +23,8 @@ extern "C" strOrFileP g6Output; int numGraphsWritten; - int graphOrder; - int numCharsForGraphOrder; + int order; + int numCharsForOrder; int numCharsForGraphEncoding; int currGraphBuffSize; char *currGraphBuff; @@ -36,35 +36,18 @@ extern "C" typedef G6WriteIterator *G6WriteIteratorP; - int allocateG6WriteIterator(G6WriteIteratorP *, graphP); - bool _isG6WriteIteratorAllocated(G6WriteIteratorP); + int g6_NewWriter(G6WriteIteratorP *ppG6WriteIterator, graphP theGraph); - int getNumGraphsWritten(G6WriteIteratorP, int *); - int getOrderOfGraphToWrite(G6WriteIteratorP, int *); - int getPointerToGraphToWrite(G6WriteIteratorP, graphP *); + int g6_GetNumGraphsWritten(G6WriteIteratorP pG6WriteIterator, int *pNumGraphsWritten); + int g6_GetOrderFromWriter(G6WriteIteratorP pG6WriteIterator, int *pOrder); + int g6_GetGraphFromWriter(G6WriteIteratorP pG6WriteIterator, graphP *pTheGraph); - int beginG6WriteIterationToG6String(G6WriteIteratorP); - int beginG6WriteIterationToG6FilePath(G6WriteIteratorP, char *); - int beginG6WriteIterationToG6StrOrFile(G6WriteIteratorP, strOrFileP); - int _beginG6WriteIteration(G6WriteIteratorP); - void _precomputeColumnOffsets(int *, int); + int g6_InitWriterWithString(G6WriteIteratorP pG6WriteIterator); + int g6_InitWriterWithFileName(G6WriteIteratorP pG6WriteIterator, char *outputFileName); - int writeGraphUsingG6WriteIterator(G6WriteIteratorP); + int g6_WriteGraph(G6WriteIteratorP pG6WriteIterator); - int _encodeAdjMatAsG6(G6WriteIteratorP); - int _getFirstEdge(graphP, int *, int *, int *); - int _getNextEdge(graphP, int *, int *, int *); - int _getNextInUseEdge(graphP, int *, int *, int *); - - int _printEncodedGraph(G6WriteIteratorP); - - int endG6WriteIteration(G6WriteIteratorP); - - int freeG6WriteIterator(G6WriteIteratorP *); - - int _WriteGraphToG6FilePath(graphP, char *); - int _WriteGraphToG6String(graphP, char **); - int _WriteGraphToG6StrOrFile(graphP, strOrFileP, char **); + void g6_FreeWriter(G6WriteIteratorP *ppG6WriteIterator); #ifdef __cplusplus } diff --git a/planarity/c/graphLib/io/graphIO.c b/planarity/c/graphLib/io/graphIO.c index 41d24f2..bf86ee7 100644 --- a/planarity/c/graphLib/io/graphIO.c +++ b/planarity/c/graphLib/io/graphIO.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -10,6 +10,10 @@ See the LICENSE.TXT file for licensing information. #include "../graph.h" +/* Imported functions */ +extern int _g6_ReadGraphFromStrOrFile(graphP theGraph, strOrFileP g6InputContainer); +extern int _g6_WriteGraphToStrOrFile(graphP theGraph, strOrFileP outputContainer, char **outputStr); + /* Private functions (exported to system) */ int _ReadGraph(graphP theGraph, strOrFileP inputContainer); @@ -40,7 +44,7 @@ char *_MakeLogStr5(char *format, int, int, int, int, int); /* Private functions */ char _GetEdgeTypeChar(graphP theGraph, int e); -char _GetVertexObstructionTypeChar(graphP theGraph, int v); +char _GetObstructionMarkChar(graphP theGraph, int v); /******************************************************************** _ReadAdjMatrix() @@ -55,10 +59,10 @@ char _GetVertexObstructionTypeChar(graphP theGraph, int v); int _ReadAdjMatrix(graphP theGraph, strOrFileP inputContainer) { - int N = -1; - int v, w, Flag; + int N = 0; + int v = NIL, w = NIL, Flag = NIL; - if (sf_ValidateStrOrFile(inputContainer) != OK) + if (!sf_IsValidStrOrFile(inputContainer)) return NOTOK; // Read the number of vertices from the first line of the file @@ -74,10 +78,10 @@ int _ReadAdjMatrix(graphP theGraph, strOrFileP inputContainer) // Read an upper-triangular matrix row for each vertex // Note that for the last vertex, zero flags are read, per the upper triangular format - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) { - gp_SetVertexIndex(theGraph, v, v); - for (w = v + 1; gp_VertexInRange(theGraph, w); w++) + gp_SetIndex(theGraph, v, v); + for (w = v + 1; gp_VertexInRangeAscending(theGraph, w); w++) { // Read each of v's w-neighbor flags if (sf_ReadSkipWhitespace(inputContainer) != OK) @@ -129,11 +133,12 @@ int _ReadAdjMatrix(graphP theGraph, strOrFileP inputContainer) int _ReadAdjList(graphP theGraph, strOrFileP inputContainer) { - int N = -1; - int v, W, adjList, e, indexValue, ErrorCode; + int ErrorCode = OK; + + int N = 0, v = NIL, W = NIL, adjList = NIL, e = NIL, indexValue = NIL; int zeroBased = FALSE; - if (sf_ValidateStrOrFile(inputContainer) != OK) + if (!sf_IsValidStrOrFile(inputContainer)) return NOTOK; // Skip the "N=" and then read the N value for number of vertices @@ -158,11 +163,11 @@ int _ReadAdjList(graphP theGraph, strOrFileP inputContainer) // Clear the visited members of the vertices so they can be used // during the adjacency list read operation - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) gp_SetVertexVisitedInfo(theGraph, v, NIL); // Do the adjacency list read operation for each vertex in order - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) { // Read the vertex number if (sf_ReadSkipWhitespace(inputContainer) != OK) @@ -174,12 +179,18 @@ int _ReadAdjList(graphP theGraph, strOrFileP inputContainer) if (indexValue == 0 && v == gp_GetFirstVertex(theGraph)) zeroBased = TRUE; - indexValue += zeroBased ? gp_GetFirstVertex(theGraph) : 0; - gp_SetVertexIndex(theGraph, v, indexValue); + // If we are reading a zero-based input file, then we have to add to the + // indexValue for v the amount returned by gp_GetFirstVertex(), + // which is 1 if this library was compiled with USE_FASTER_1BASEDARRAYS + // or 0 if this library was compiled with USE_0BASEDARRAYS + if (zeroBased) + indexValue += gp_GetFirstVertex(theGraph); + + gp_SetIndex(theGraph, v, indexValue); // The vertices are expected to be in numeric ascending order - if (gp_GetVertexIndex(theGraph, v) != v) + if (gp_GetIndex(theGraph, v) != v) return NOTOK; // Skip the colon after the vertex number @@ -197,14 +208,14 @@ int _ReadAdjList(graphP theGraph, strOrFileP inputContainer) // read operation for a vertex v, any adjacency nodes left in the saved // list are converted to directed edges from the preceding vertex to v. adjList = gp_GetFirstArc(theGraph, v); - if (gp_IsArc(adjList)) + if (gp_IsArc(theGraph, adjList)) { // Store the adjacency node location in the visited member of each // of the preceding vertices to which v is adjacent so that we can // efficiently detect the adjacency during the read operation and // efficiently find the adjacency node. e = gp_GetFirstArc(theGraph, v); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { gp_SetVertexVisitedInfo(theGraph, gp_GetNeighbor(theGraph, e), e); e = gp_GetNextArc(theGraph, e); @@ -230,9 +241,15 @@ int _ReadAdjList(graphP theGraph, strOrFileP inputContainer) if (sf_ReadSkipWhitespace(inputContainer) != OK) return NOTOK; - W += zeroBased ? gp_GetFirstVertex(theGraph) : 0; + // If we are reading a zero-based input file, then we have to add to W + // the amount returned by gp_GetFirstVertex(), which is 1 if this library + // was compiled with USE_FASTER_1BASEDARRAYS or 0 if this library was + // compiled with USE_0BASEDARRAYS + if (zeroBased) + W += gp_GetFirstVertex(theGraph); // A value below the valid range indicates the adjacency list end + // This was written before gp_IsNotVertex() existed if (W < gp_GetFirstVertex(theGraph)) break; @@ -259,7 +276,7 @@ int _ReadAdjList(graphP theGraph, strOrFileP inputContainer) { // If the adjacency node (arc) already exists, then we add it // as the new first arc of the vertex and delete it from adjList - if (gp_IsArc(gp_GetVertexVisitedInfo(theGraph, W))) + if (gp_IsArc(theGraph, gp_GetVertexVisitedInfo(theGraph, W))) { e = gp_GetVertexVisitedInfo(theGraph, W); @@ -297,7 +314,7 @@ int _ReadAdjList(graphP theGraph, strOrFileP inputContainer) // Rather, they represent incoming directed arcs from other vertices // into vertex v. They need to be added back into v's adjacency list but // marked as "INONLY", while the twin is marked "OUTONLY" (by the same function). - while (gp_IsArc(adjList)) + while (gp_IsArc(theGraph, adjList)) { e = adjList; @@ -333,12 +350,16 @@ int _ReadAdjList(graphP theGraph, strOrFileP inputContainer) int _ReadLEDAGraph(graphP theGraph, strOrFileP inputContainer) { - char Line[MAXLINE + 1]; - int N = -1; - int graphType, M, m, u, v, ErrorCode; + int ErrorCode = OK; + + int graphType = 0; + int N = 0, M = 0, u = NIL, v = NIL; int zeroBasedOffset = gp_GetFirstVertex(theGraph) == 0 ? 1 : 0; + char Line[MAXLINE + 1]; - if (sf_ValidateStrOrFile(inputContainer) != OK) + memset(Line, '\0', (MAXLINE + 1)); + + if (!sf_IsValidStrOrFile(inputContainer)) return NOTOK; /* @@ -371,7 +392,7 @@ int _ReadLEDAGraph(graphP theGraph, strOrFileP inputContainer) if (gp_InitGraph(theGraph, N) != OK) return NOTOK; - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) if (sf_fgets(Line, MAXLINE, inputContainer) == NULL) return NOTOK; @@ -384,7 +405,7 @@ int _ReadLEDAGraph(graphP theGraph, strOrFileP inputContainer) return NOTOK; /* Read and add each edge, omitting loops and parallel edges */ - for (m = 0; m < M; m++) + for (int m = 0; m < M; m++) { if (sf_ReadSkipWhitespace(inputContainer) != OK) return NOTOK; @@ -423,7 +444,12 @@ int _ReadLEDAGraph(graphP theGraph, strOrFileP inputContainer) int gp_Read(graphP theGraph, char const *FileName) { - strOrFileP inputContainer = sf_New(NULL, FileName, READTEXT); + strOrFileP inputContainer = NULL; + + if (theGraph == NULL || FileName == NULL) + return NOTOK; + + inputContainer = sf_New(NULL, FileName, READTEXT); if (inputContainer == NULL) return NOTOK; @@ -435,24 +461,23 @@ int gp_Read(graphP theGraph, char const *FileName) Populates theGraph using the information stored in inputStr. - The ownership of inputStr is transferred from the caller; it is - assigned to a strOrFile container and ownership is transferred to - the internal helper function _ReadGraph(), which then handles - freeing this memory. + The caller owns the memory of inputStr, as the contents of inputStr are copied + into the inputContainer's internal strBuf, and therefore is responsible for + freeing the inputStr after gp_ReadFromString(). Returns NOTOK for any error, or OK otherwise ********************************************************************/ int gp_ReadFromString(graphP theGraph, char *inputStr) { - strOrFileP inputContainer = sf_New(inputStr, NULL, READTEXT); + strOrFileP inputContainer = NULL; + + if (theGraph == NULL || inputStr == NULL) + return NOTOK; + + inputContainer = sf_New(inputStr, NULL, READTEXT); if (inputContainer == NULL) - { - if (inputStr != NULL) - free(inputStr); - inputStr = NULL; return NOTOK; - } return _ReadGraph(theGraph, inputContainer); } @@ -475,10 +500,13 @@ int gp_ReadFromString(graphP theGraph, char *inputStr) int _ReadGraph(graphP theGraph, strOrFileP inputContainer) { int RetVal = OK; + bool extraDataAllowed = false; char lineBuff[MAXLINE + 1]; - if (sf_ValidateStrOrFile(inputContainer) != OK) + memset(lineBuff, '\0', (MAXLINE + 1)); + + if (!sf_IsValidStrOrFile(inputContainer)) return NOTOK; if (sf_fgets(lineBuff, MAXLINE, inputContainer) == NULL) @@ -511,7 +539,7 @@ int _ReadGraph(graphP theGraph, strOrFileP inputContainer) } else { - RetVal = _ReadGraphFromG6StrOrFile(theGraph, inputContainer); + RetVal = _g6_ReadGraphFromStrOrFile(theGraph, inputContainer); // N.B. Unlike the other _Read functions, we are relinquishing // ownership of inputContainer to the G6ReadIterator, which // calls sf_Free() when ending iteration. This assignment @@ -539,7 +567,6 @@ int _ReadGraph(graphP theGraph, strOrFileP inputContainer) RetVal = NOTOK; else { - // FIXME: how do I distinguish between "there's no more content on input stream" and "I've hit an error state" while (sf_fgets(lineBuff, MAXLINE, inputContainer) != NULL) { if (sb_ConcatString(extraData, lineBuff) != OK) @@ -583,12 +610,13 @@ int _ReadPostprocess(graphP theGraph, char *extraData) int _WriteAdjList(graphP theGraph, strOrFileP outputContainer) { - int v, e; - int zeroBasedOffset = (theGraph->internalFlags & FLAGS_ZEROBASEDIO) ? gp_GetFirstVertex(theGraph) : 0; + int v = NIL, e = NIL; + int zeroBasedVertexOffset = 0, adjacencyListTerminator = NIL; char numberStr[MAXCHARSFOR32BITINT + 1]; + memset(numberStr, '\0', (MAXCHARSFOR32BITINT + 1) * sizeof(char)); - if (theGraph == NULL || sf_ValidateStrOrFile(outputContainer) != OK) + if (theGraph == NULL || !sf_IsValidStrOrFile(outputContainer)) return NOTOK; // Write the number of vertices of the graph to the file or string buffer @@ -597,20 +625,33 @@ int _WriteAdjList(graphP theGraph, strOrFileP outputContainer) if (sf_fputs(numberStr, outputContainer) == EOF) return NOTOK; + // If we are supposed to write 0-based output, then we have to adjust the vertex offset and the + // adjacency list terminator based on whether this library has been compiled with 0-based or + // 1-based array indexing for the in-memory data structure (i.e., compiled with + // USE_FASTER_1BASEDARRAYS USE_0BASEDARRAYS). The macro invoked is responsive to the difference. + if (theGraph->internalFlags & FLAGS_ZEROBASEDIO) + { + zeroBasedVertexOffset = gp_GetFirstVertex(theGraph); + // If the graph must be written 0-based, then the adjacency list terminator must be -1, + // even if the internal representation is 1-based (i.e. when USE_FASTER_1BASEDARRAYS, NIL == 0, + // but the output needs to be -1 for 0-based output) + adjacencyListTerminator = -1; + } + // Write the adjacency list of each vertex - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) { - if (sprintf(numberStr, "%d:", v - zeroBasedOffset) < 1) + if (sprintf(numberStr, "%d:", v - zeroBasedVertexOffset) < 1) return NOTOK; if (sf_fputs(numberStr, outputContainer) == EOF) return NOTOK; e = gp_GetLastArc(theGraph, v); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (gp_GetDirection(theGraph, e) != EDGEFLAG_DIRECTION_INONLY) { - if (sprintf(numberStr, " %d", gp_GetNeighbor(theGraph, e) - zeroBasedOffset) < 1) + if (sprintf(numberStr, " %d", gp_GetNeighbor(theGraph, e) - zeroBasedVertexOffset) < 1) return NOTOK; if (sf_fputs(numberStr, outputContainer) == EOF) return NOTOK; @@ -620,7 +661,7 @@ int _WriteAdjList(graphP theGraph, strOrFileP outputContainer) } // Write NIL at the end of the adjacency list (in zero-based I/O, NIL was -1) - if (sprintf(numberStr, " %d\n", (theGraph->internalFlags & FLAGS_ZEROBASEDIO) ? -1 : NIL) < 1) + if (sprintf(numberStr, " %d\n", adjacencyListTerminator) < 1) return NOTOK; if (sf_fputs(numberStr, outputContainer) == EOF) return NOTOK; @@ -644,12 +685,12 @@ int _WriteAdjList(graphP theGraph, strOrFileP outputContainer) int _WriteAdjMatrix(graphP theGraph, strOrFileP outputContainer) { - int v, e, K; + int v = NIL, e = NIL; char *Row = NULL; char numberStr[MAXCHARSFOR32BITINT + 1]; memset(numberStr, '\0', (MAXCHARSFOR32BITINT + 1) * sizeof(char)); - if (theGraph == NULL || sf_ValidateStrOrFile(outputContainer) != OK) + if (theGraph == NULL || !sf_IsValidStrOrFile(outputContainer)) return NOTOK; // Write the number of vertices in the graph to the file or string buffer @@ -664,15 +705,16 @@ int _WriteAdjMatrix(graphP theGraph, strOrFileP outputContainer) return NOTOK; // Construct the upper triangular matrix representation one row at a time - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) { - for (K = gp_GetFirstVertex(theGraph); K <= v; K++) - Row[K - gp_GetFirstVertex(theGraph)] = ' '; - for (K = v + 1; gp_VertexInRange(theGraph, K); K++) - Row[K - gp_GetFirstVertex(theGraph)] = '0'; + for (int i = gp_GetFirstVertex(theGraph); i <= v; i++) + Row[i - gp_GetFirstVertex(theGraph)] = ' '; + + for (int i = v + 1; gp_VertexInRangeAscending(theGraph, i); i++) + Row[i - gp_GetFirstVertex(theGraph)] = '0'; e = gp_GetFirstArc(theGraph, v); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (gp_GetDirection(theGraph, e) == EDGEFLAG_DIRECTION_INONLY) return NOTOK; @@ -692,6 +734,8 @@ int _WriteAdjMatrix(graphP theGraph, strOrFileP outputContainer) } free(Row); + Row = NULL; + return OK; } @@ -719,17 +763,17 @@ char _GetEdgeTypeChar(graphP theGraph, int e) /******************************************************************** ********************************************************************/ -char _GetVertexObstructionTypeChar(graphP theGraph, int v) +char _GetObstructionMarkChar(graphP theGraph, int v) { char type = 'U'; - if (gp_GetVertexObstructionType(theGraph, v) == VERTEX_OBSTRUCTIONTYPE_HIGH_RXW) + if (gp_GetObstructionMark(theGraph, v) == ANYVERTEX_OBSTRUCTIONMARK_HIGH_RXW) type = 'X'; - else if (gp_GetVertexObstructionType(theGraph, v) == VERTEX_OBSTRUCTIONTYPE_LOW_RXW) + else if (gp_GetObstructionMark(theGraph, v) == ANYVERTEX_OBSTRUCTIONMARK_LOW_RXW) type = 'x'; - if (gp_GetVertexObstructionType(theGraph, v) == VERTEX_OBSTRUCTIONTYPE_HIGH_RYW) + if (gp_GetObstructionMark(theGraph, v) == ANYVERTEX_OBSTRUCTIONMARK_HIGH_RYW) type = 'Y'; - else if (gp_GetVertexObstructionType(theGraph, v) == VERTEX_OBSTRUCTIONTYPE_LOW_RYW) + else if (gp_GetObstructionMark(theGraph, v) == ANYVERTEX_OBSTRUCTIONMARK_LOW_RYW) type = 'y'; return type; @@ -744,11 +788,12 @@ char _GetVertexObstructionTypeChar(graphP theGraph, int v) int _WriteDebugInfo(graphP theGraph, strOrFileP outputContainer) { - int v, e, EsizeOccupied; + int v = NIL, e = NIL, EsizeOccupied = 0; char lineBuf[MAXLINE + 1]; + memset(lineBuf, '\0', (MAXLINE + 1) * sizeof(char)); - if (theGraph == NULL || sf_ValidateStrOrFile(outputContainer) != OK) + if (theGraph == NULL || !sf_IsValidStrOrFile(outputContainer)) return NOTOK; /* Print parent copy vertices and their adjacency lists */ @@ -757,19 +802,19 @@ int _WriteDebugInfo(graphP theGraph, strOrFileP outputContainer) if (sf_fputs(lineBuf, outputContainer) == EOF) return NOTOK; - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) { if (sprintf(lineBuf, "%d(P=%d,lA=%d,LowPt=%d,v=%d):", v, gp_GetVertexParent(theGraph, v), gp_GetVertexLeastAncestor(theGraph, v), gp_GetVertexLowpoint(theGraph, v), - gp_GetVertexIndex(theGraph, v)) < 1) + gp_GetIndex(theGraph, v)) < 1) return NOTOK; if (sf_fputs(lineBuf, outputContainer) == EOF) return NOTOK; e = gp_GetFirstArc(theGraph, v); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (sprintf(lineBuf, " %d(e=%d)", gp_GetNeighbor(theGraph, e), e) < 1) return NOTOK; @@ -786,20 +831,20 @@ int _WriteDebugInfo(graphP theGraph, strOrFileP outputContainer) /* Print any root copy vertices and their adjacency lists */ - for (v = gp_GetFirstVirtualVertex(theGraph); gp_VirtualVertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVirtualVertex(theGraph); gp_VirtualVertexInRangeAscending(theGraph, v); v++) { if (!gp_VirtualVertexInUse(theGraph, v)) continue; if (sprintf(lineBuf, "%d(copy of=%d, DFS child=%d):", - v, gp_GetVertexIndex(theGraph, v), - gp_GetDFSChildFromRoot(theGraph, v)) < 1) + v, gp_GetIndex(theGraph, v), + gp_GetDFSChildFromBicompRoot(theGraph, v)) < 1) return NOTOK; if (sf_fputs(lineBuf, outputContainer) == EOF) return NOTOK; e = gp_GetFirstArc(theGraph, v); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (sprintf(lineBuf, " %d(e=%d)", gp_GetNeighbor(theGraph, e), e) < 1) return NOTOK; @@ -819,27 +864,27 @@ int _WriteDebugInfo(graphP theGraph, strOrFileP outputContainer) if (sf_fputs("\nVERTEX INFORMATION\n", outputContainer) == EOF) return NOTOK; - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) { if (sprintf(lineBuf, "V[%3d] index=%3d, type=%c, first arc=%3d, last arc=%3d\n", v, - gp_GetVertexIndex(theGraph, v), - (gp_IsVirtualVertex(theGraph, v) ? 'X' : _GetVertexObstructionTypeChar(theGraph, v)), + gp_GetIndex(theGraph, v), + (gp_IsVirtualVertex(theGraph, v) ? 'X' : _GetObstructionMarkChar(theGraph, v)), gp_GetFirstArc(theGraph, v), gp_GetLastArc(theGraph, v)) < 1) return NOTOK; if (sf_fputs(lineBuf, outputContainer) == EOF) return NOTOK; } - for (v = gp_GetFirstVirtualVertex(theGraph); gp_VirtualVertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVirtualVertex(theGraph); gp_VirtualVertexInRangeAscending(theGraph, v); v++) { if (gp_VirtualVertexNotInUse(theGraph, v)) continue; if (sprintf(lineBuf, "V[%3d] index=%3d, type=%c, first arc=%3d, last arc=%3d\n", v, - gp_GetVertexIndex(theGraph, v), - (gp_IsVirtualVertex(theGraph, v) ? 'X' : _GetVertexObstructionTypeChar(theGraph, v)), + gp_GetIndex(theGraph, v), + (gp_IsVirtualVertex(theGraph, v) ? 'X' : _GetObstructionMarkChar(theGraph, v)), gp_GetFirstArc(theGraph, v), gp_GetLastArc(theGraph, v)) < 1) return NOTOK; @@ -852,7 +897,7 @@ int _WriteDebugInfo(graphP theGraph, strOrFileP outputContainer) if (sf_fputs("\nEDGE INFORMATION\n", outputContainer) == EOF) return NOTOK; - EsizeOccupied = gp_EdgeInUseIndexBound(theGraph); + EsizeOccupied = gp_EdgeInUseArraySize(theGraph); for (e = gp_GetFirstEdge(theGraph); e < EsizeOccupied; e++) { if (gp_EdgeInUse(theGraph, e)) @@ -885,7 +930,7 @@ int _WriteDebugInfo(graphP theGraph, strOrFileP outputContainer) int gp_Write(graphP theGraph, char const *FileName, int Mode) { - int RetVal; + int RetVal = OK; strOrFileP outputContainer = NULL; if (theGraph == NULL || FileName == NULL) @@ -900,9 +945,7 @@ int gp_Write(graphP theGraph, char const *FileName, int Mode) RetVal = _WriteGraph(theGraph, &outputContainer, NULL, Mode); - if (outputContainer != NULL) - sf_Free(&outputContainer); - outputContainer = NULL; + sf_Free(&outputContainer); return RetVal; } @@ -925,7 +968,8 @@ int gp_Write(graphP theGraph, char const *FileName, int Mode) ********************************************************************/ int gp_WriteToString(graphP theGraph, char **pOutputStr, int Mode) { - int RetVal; + int RetVal = OK; + strOrFileP outputContainer = NULL; if (theGraph == NULL || pOutputStr == NULL) @@ -939,7 +983,7 @@ int gp_WriteToString(graphP theGraph, char **pOutputStr, int Mode) // N.B. Since we pass ownership of the outputContainer to the // G6WriteIterator when we WRITE_G6, we make sure to take the string - // *before* we endG6WriteIteration(), since that calls sf_Free() on the + // *before* we gp_FreeWriter(), since that calls sf_Free() on the // g6Output (i.e. outputContainer) and therefore sb_Free() on theStr. This // means that we need to make sure outputContainer and theStr it contains // are both non-NULL before trying to take the string, as WRITE_ADJLIST, @@ -953,9 +997,7 @@ int gp_WriteToString(graphP theGraph, char **pOutputStr, int Mode) if ((*pOutputStr) == NULL || strlen(*pOutputStr) == 0) RetVal = NOTOK; - if (outputContainer != NULL) - sf_Free(&outputContainer); - outputContainer = NULL; + sf_Free(&outputContainer); return RetVal; } @@ -978,7 +1020,7 @@ int _WriteGraph(graphP theGraph, strOrFileP *outputContainer, char **pOutputStr, switch (Mode) { case WRITE_G6: - RetVal = _WriteGraphToG6StrOrFile(theGraph, (*outputContainer), pOutputStr); + RetVal = _g6_WriteGraphToStrOrFile(theGraph, (*outputContainer), pOutputStr); // Since G6WriteIterator owns the outputContainer, it'll // free it, so don't want to try to double-free (*outputContainer) = NULL; @@ -1007,7 +1049,9 @@ int _WriteGraph(graphP theGraph, strOrFileP *outputContainer, char **pOutputStr, { if (sf_fputs(extraData, (*outputContainer)) == EOF) RetVal = NOTOK; + free(extraData); + extraData = NULL; } } diff --git a/planarity/c/graphLib/io/strOrFile.c b/planarity/c/graphLib/io/strOrFile.c index 8355769..af667af 100644 --- a/planarity/c/graphLib/io/strOrFile.c +++ b/planarity/c/graphLib/io/strOrFile.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -7,7 +7,6 @@ See the LICENSE.TXT file for licensing information. #include #include #include -#include #include #include "../lowLevelUtils/appconst.h" @@ -16,12 +15,27 @@ See the LICENSE.TXT file for licensing information. /******************************************************************** sf_New() - Accepts a FILE pointer XOR a string, which are owned by the container. + The string-or-file object supports two IO modes: reading input (ioMode == + READTEXT), and writing output (ioMode == WRITETEXT). The string-or-file object + also may only contain a string (stored using a strBufP to leverage its string + manipulation functions) XOR a FILE *. + + For the input mode, sf_New() should receive either a non-NULL (and preferably + nonempty) input string (which the container *does not own*, but rather copies + into the internal strBufP) or a non-NULL and nonempty fileName (which may + correspond to stdin). + + For the output mode, theStr *must* be NULL because, if the fileName is also + NULL, then the desired output string will be constructed internally in the + string-or-file object and can be obtained after all output has been written + using sf_takeTheStr(). If the fileName is non-NULL and nonempty (which may + correspond to stdout or stderr), then the output will go to the output stream + and an output string will not be constructed. Returns the allocated string-or-file container, or NULL on error. ********************************************************************/ -strOrFileP sf_New(char const *theStr, char const *fileName, char const *ioMode) +strOrFileP sf_New(char const *const theStr, char const *const fileName, char const *ioMode) { strOrFileP theStrOrFile; int containerType = 0; @@ -167,10 +181,10 @@ strOrFileP sf_New(char const *theStr, char const *fileName, char const *ioMode) should only contain one source). 5. containerType is either set to INPUT_CONTAINER or OUTPUT_CONTAINER - Returns NOTOK if any of these conditions are not met, otherwise OK. + Returns false if any of these conditions are not met, otherwise true. ********************************************************************/ -int sf_ValidateStrOrFile(strOrFileP theStrOrFile) +bool sf_IsValidStrOrFile(strOrFileP theStrOrFile) { if (theStrOrFile == NULL || theStrOrFile->ungetBuf == NULL || @@ -178,9 +192,9 @@ int sf_ValidateStrOrFile(strOrFileP theStrOrFile) (theStrOrFile->pFile != NULL && theStrOrFile->theStr != NULL) || (theStrOrFile->containerType != INPUT_CONTAINER && theStrOrFile->containerType != OUTPUT_CONTAINER)) - return NOTOK; + return false; - return OK; + return true; } /******************************************************************** @@ -196,7 +210,7 @@ char sf_getc(strOrFileP theStrOrFile) { char theChar = EOF; - if (sf_ValidateStrOrFile(theStrOrFile) != OK || + if (!sf_IsValidStrOrFile(theStrOrFile) || theStrOrFile->containerType != INPUT_CONTAINER) return EOF; @@ -230,7 +244,7 @@ char sf_getc(strOrFileP theStrOrFile) int sf_ReadSkipChar(strOrFileP theStrOrFile) { - if (sf_ValidateStrOrFile(theStrOrFile) != OK || + if (!sf_IsValidStrOrFile(theStrOrFile) || theStrOrFile->containerType != INPUT_CONTAINER) return NOTOK; @@ -251,7 +265,7 @@ int sf_ReadSkipWhitespace(strOrFileP theStrOrFile) { char currChar = EOF; - if (sf_ValidateStrOrFile(theStrOrFile) != OK || + if (!sf_IsValidStrOrFile(theStrOrFile) || theStrOrFile->containerType != INPUT_CONTAINER) return NOTOK; @@ -280,7 +294,7 @@ int sf_ReadSingleDigit(int *digitToRead, strOrFileP theStrOrFile) { int candidateDigit = EOF; - if (sf_ValidateStrOrFile(theStrOrFile) != OK || + if (!sf_IsValidStrOrFile(theStrOrFile) || theStrOrFile->containerType != INPUT_CONTAINER) return NOTOK; @@ -314,7 +328,7 @@ int sf_ReadInteger(int *intToRead, strOrFileP theStrOrFile) char intCandidateStr[MAXCHARSFOR32BITINT + 1]; memset(intCandidateStr, '\0', (MAXCHARSFOR32BITINT + 1) * sizeof(char)); - if (sf_ValidateStrOrFile(theStrOrFile) != OK || + if (!sf_IsValidStrOrFile(theStrOrFile) || theStrOrFile->containerType != INPUT_CONTAINER) return NOTOK; @@ -463,7 +477,7 @@ int sf_ReadSkipLineRemainder(strOrFileP theStrOrFile) char sf_ungetc(char theChar, strOrFileP theStrOrFile) { if (theChar == EOF || - sf_ValidateStrOrFile(theStrOrFile) != OK || + !sf_IsValidStrOrFile(theStrOrFile) || theStrOrFile->containerType != INPUT_CONTAINER || sp_GetCurrentSize(theStrOrFile->ungetBuf) >= sp_GetCapacity(theStrOrFile->ungetBuf)) return EOF; // Acceptable downcast, allowing char rather than int return type @@ -484,7 +498,7 @@ char sf_ungetc(char theChar, strOrFileP theStrOrFile) int sf_ungets(char *strToUnget, strOrFileP theStrOrFile) { - if (sf_ValidateStrOrFile(theStrOrFile) != OK || + if (!sf_IsValidStrOrFile(theStrOrFile) || theStrOrFile->containerType != INPUT_CONTAINER || (int)strlen(strToUnget) > (sp_GetCapacity(theStrOrFile->ungetBuf) - sp_GetCurrentSize(theStrOrFile->ungetBuf))) return NOTOK; @@ -518,7 +532,7 @@ char *sf_fgets(char *str, int count, strOrFileP theStrOrFile) int charsToReadFromStrOrFile = count; if (str == NULL || count < 0 || - sf_ValidateStrOrFile(theStrOrFile) != OK || + !sf_IsValidStrOrFile(theStrOrFile) || theStrOrFile->containerType != INPUT_CONTAINER) return NULL; @@ -603,7 +617,7 @@ int sf_fputs(char const *strToWrite, strOrFileP theStrOrFile) int outputLen = EOF; if (strToWrite == NULL || - sf_ValidateStrOrFile(theStrOrFile) != OK || + !sf_IsValidStrOrFile(theStrOrFile) || theStrOrFile->containerType != OUTPUT_CONTAINER) return EOF; diff --git a/planarity/c/graphLib/io/strOrFile.h b/planarity/c/graphLib/io/strOrFile.h index fb26eb5..3c2687f 100644 --- a/planarity/c/graphLib/io/strOrFile.h +++ b/planarity/c/graphLib/io/strOrFile.h @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -12,6 +12,7 @@ extern "C" { #endif +#include #include #include "../lowLevelUtils/stack.h" @@ -30,8 +31,8 @@ extern "C" typedef strOrFile *strOrFileP; - strOrFileP sf_New(char const *theStr, char const *fileName, char const *ioMode); - int sf_ValidateStrOrFile(strOrFileP theStrOrFile); + strOrFileP sf_New(char const *const theStr, char const *const fileName, char const *ioMode); + bool sf_IsValidStrOrFile(strOrFileP theStrOrFile); char sf_getc(strOrFileP theStrOrFile); int sf_ReadSkipChar(strOrFileP theStrOrFile); diff --git a/planarity/c/graphLib/io/strbuf.c b/planarity/c/graphLib/io/strbuf.c index efe07f6..b344676 100644 --- a/planarity/c/graphLib/io/strbuf.c +++ b/planarity/c/graphLib/io/strbuf.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -180,7 +180,7 @@ void sb_ReadSkipInteger(strBufP theStrBuf) small concatenations). Returns OK on success, NOTOK on error ********************************************************************/ -int sb_ConcatString(strBufP theStrBuf, char const*s) +int sb_ConcatString(strBufP theStrBuf, char const *s) { int slen = s == NULL ? 0 : strlen(s); diff --git a/planarity/c/graphLib/io/strbuf.h b/planarity/c/graphLib/io/strbuf.h index f9a504d..24c02bc 100644 --- a/planarity/c/graphLib/io/strbuf.h +++ b/planarity/c/graphLib/io/strbuf.h @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -49,7 +49,7 @@ extern "C" theStrBuf->readPos++; \ } - int sb_ConcatString(strBufP, char const*); + int sb_ConcatString(strBufP, char const *); int sb_ConcatChar(strBufP, char); char *sb_TakeString(strBufP); diff --git a/planarity/c/graphLib/lowLevelUtils/apiutils.c b/planarity/c/graphLib/lowLevelUtils/apiutils.c index 23ea81b..44f329b 100644 --- a/planarity/c/graphLib/lowLevelUtils/apiutils.c +++ b/planarity/c/graphLib/lowLevelUtils/apiutils.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ diff --git a/planarity/c/graphLib/lowLevelUtils/apiutils.h b/planarity/c/graphLib/lowLevelUtils/apiutils.h index f749a7e..c9abde6 100644 --- a/planarity/c/graphLib/lowLevelUtils/apiutils.h +++ b/planarity/c/graphLib/lowLevelUtils/apiutils.h @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -29,8 +29,8 @@ extern "C" extern int getQuietModeSetting(void); extern void setQuietModeSetting(int); - extern void Message(char const*message); - extern void ErrorMessage(char const*message); + extern void Message(char const *message); + extern void ErrorMessage(char const *message); int GetNumCharsToReprInt(int theNum, int *numCharsRequired); #ifdef __cplusplus diff --git a/planarity/c/graphLib/lowLevelUtils/appconst.h b/planarity/c/graphLib/lowLevelUtils/appconst.h index d813c9b..fbefb94 100644 --- a/planarity/c/graphLib/lowLevelUtils/appconst.h +++ b/planarity/c/graphLib/lowLevelUtils/appconst.h @@ -2,7 +2,7 @@ #define APPCONST_H /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -73,13 +73,16 @@ extern int debugNOTOK(void); #define NULL 0L #endif -/* Array indices are used as pointers, and NIL means bad pointer */ +// Define one of these to use faster 1-based arrays or +// the slower original 0-based arrays #define USE_FASTER_1BASEDARRAYS +// #define USE_0BASEDARRAYS #ifdef USE_0BASEDARRAYS #undef USE_FASTER_1BASEDARRAYS #endif +/* Array indices are used as pointers, and NIL means bad pointer */ #ifdef USE_FASTER_1BASEDARRAYS // This definition is used with 1-based array indexing #define NIL 0 diff --git a/planarity/c/graphLib/lowLevelUtils/listcoll.c b/planarity/c/graphLib/lowLevelUtils/listcoll.c index e530d36..83a5429 100644 --- a/planarity/c/graphLib/lowLevelUtils/listcoll.c +++ b/planarity/c/graphLib/lowLevelUtils/listcoll.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ diff --git a/planarity/c/graphLib/lowLevelUtils/listcoll.h b/planarity/c/graphLib/lowLevelUtils/listcoll.h index c4ea3be..2608373 100644 --- a/planarity/c/graphLib/lowLevelUtils/listcoll.h +++ b/planarity/c/graphLib/lowLevelUtils/listcoll.h @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ diff --git a/planarity/c/graphLib/lowLevelUtils/platformTime.h b/planarity/c/graphLib/lowLevelUtils/platformTime.h index 91c2ec1..bd44cdf 100644 --- a/planarity/c/graphLib/lowLevelUtils/platformTime.h +++ b/planarity/c/graphLib/lowLevelUtils/platformTime.h @@ -2,7 +2,7 @@ #define PLATFORM_TIME /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ diff --git a/planarity/c/graphLib/lowLevelUtils/stack.c b/planarity/c/graphLib/lowLevelUtils/stack.c index fc31bde..9ded98d 100644 --- a/planarity/c/graphLib/lowLevelUtils/stack.c +++ b/planarity/c/graphLib/lowLevelUtils/stack.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ diff --git a/planarity/c/graphLib/lowLevelUtils/stack.h b/planarity/c/graphLib/lowLevelUtils/stack.h index 67db50d..e2cb891 100644 --- a/planarity/c/graphLib/lowLevelUtils/stack.h +++ b/planarity/c/graphLib/lowLevelUtils/stack.h @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ diff --git a/planarity/c/graphLib/planarityRelated/graphDrawPlanar.c b/planarity/c/graphLib/planarityRelated/graphDrawPlanar.c index 25bf647..f979283 100644 --- a/planarity/c/graphLib/planarityRelated/graphDrawPlanar.c +++ b/planarity/c/graphLib/planarityRelated/graphDrawPlanar.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -15,7 +15,7 @@ extern int DRAWPLANAR_ID; #include #include -extern void _ClearVisitedFlags(graphP theGraph); +extern void _ClearAllVisitedFlagsInGraph(graphP theGraph); /* Private functions exported to system */ @@ -81,7 +81,7 @@ int _ComputeVertexPositions(DrawPlanarContext *context) int v, vertpos; vertpos = 0; - for (v = gp_GetFirstVertex(theEmbedding); gp_VertexInRange(theEmbedding, v); v++) + for (v = gp_GetFirstVertex(theEmbedding); gp_VertexInRangeAscending(theEmbedding, v); v++) { // For each DFS tree root in the embedding, we // compute the vertex positions @@ -191,7 +191,7 @@ int _ComputeVertexPositions(DrawPlanarContext *context) int _ComputeVertexPositionsInComponent(DrawPlanarContext *context, int root, int *pVertpos) { graphP theEmbedding = context->theGraph; - listCollectionP theOrder = LCNew(gp_PrimaryVertexIndexBound(theEmbedding)); + listCollectionP theOrder = LCNew(gp_VertexArraySize(theEmbedding)); int W, P, C, V, e; if (theOrder == NULL) @@ -212,7 +212,7 @@ int _ComputeVertexPositionsInComponent(DrawPlanarContext *context, int root, int // For the special case that we just popped the DFS tree root, // we simply add the root to its own position. - if (gp_IsNotVertex(P)) + if (gp_IsNotVertex(theEmbedding, P)) { // Put the DFS root in the list by itself LCAppend(theOrder, NIL, W); @@ -237,7 +237,7 @@ int _ComputeVertexPositionsInComponent(DrawPlanarContext *context, int root, int // which is equal to or descendant to C. If C below V, then P below V, // so interpret 'W between P and V' as 'W above P', and interpret // 'W beyond P relative to V' as 'W below P'. - if (gp_IsNotVertex(C) || context->VI[C].drawingFlag == DRAWINGFLAG_BELOW) + if (gp_IsNotVertex(theEmbedding, C) || context->VI[C].drawingFlag == DRAWINGFLAG_BELOW) { if (context->VI[W].drawingFlag == DRAWINGFLAG_BETWEEN) context->VI[W].drawingFlag = DRAWINGFLAG_ABOVE; @@ -264,7 +264,7 @@ int _ComputeVertexPositionsInComponent(DrawPlanarContext *context, int root, int // Push DFS children e = gp_GetFirstArc(theEmbedding, W); - while (gp_IsArc(e)) + while (gp_IsArc(theEmbedding, e)) { if (gp_GetEdgeType(theEmbedding, e) == EDGE_TYPE_CHILD) sp_Push(theEmbedding->theStack, gp_GetNeighbor(theEmbedding, e)); @@ -275,7 +275,7 @@ int _ComputeVertexPositionsInComponent(DrawPlanarContext *context, int root, int // Use the order to assign vertical positions V = root; - while (gp_IsVertex(V)) + while (gp_IsVertex(theEmbedding, V)) { context->VI[V].pos = *pVertpos; (*pVertpos)++; @@ -299,14 +299,14 @@ void _LogEdgeList(graphP theEmbedding, listCollectionP edgeList, int edgeListHea gp_Log("EdgeList: [ "); - while (gp_IsArc(eIndex)) + while (gp_IsArc(theGraph, eIndex)) { e = (eIndex << 1); eTwin = gp_GetTwinArc(theEmbedding, e); gp_Log(gp_MakeLogStr2("(%d, %d) ", - gp_GetVertexIndex(theEmbedding, gp_GetNeighbor(theEmbedding, e)), - gp_GetVertexIndex(theEmbedding, gp_GetNeighbor(theEmbedding, eTwin)))); + gp_GetIndex(theEmbedding, gp_GetNeighbor(theEmbedding, e)), + gp_GetIndex(theEmbedding, gp_GetNeighbor(theEmbedding, eTwin)))); eIndex = LCGetNext(edgeList, edgeListHead, eIndex); } @@ -350,7 +350,7 @@ int _ComputeEdgePositions(DrawPlanarContext *context) return NOTOK; } - for (v = gp_GetFirstVertex(theEmbedding); gp_VertexInRange(theEmbedding, v); v++) + for (v = gp_GetFirstVertex(theEmbedding); gp_VertexInRangeAscending(theEmbedding, v); v++) vertexOrder[context->VI[v].pos] = v; // Allocate the edge list of size M. @@ -363,6 +363,8 @@ int _ComputeEdgePositions(DrawPlanarContext *context) if (theEmbedding->M > 0 && (edgeList = LCNew(gp_GetFirstEdge(theEmbedding) / 2 + theEmbedding->M)) == NULL) { free(vertexOrder); + vertexOrder = NULL; + return NOTOK; } @@ -370,7 +372,7 @@ int _ComputeEdgePositions(DrawPlanarContext *context) // Each vertex starts out with a NIL generator edge. - for (v = gp_GetFirstVertex(theEmbedding); gp_VertexInRange(theEmbedding, v); v++) + for (v = gp_GetFirstVertex(theEmbedding); gp_VertexInRangeAscending(theEmbedding, v); v++) gp_SetVertexVisitedInfo(theEmbedding, v, NIL); // Perform the vertical sweep of the combinatorial embedding, using @@ -384,7 +386,7 @@ int _ComputeEdgePositions(DrawPlanarContext *context) // Get the vertex associated with the position v = vertexOrder[vpos]; gp_LogLine(gp_MakeLogStr3("Processing vertex %d with DFI=%d at position=%d", - gp_GetVertexIndex(theEmbedding, v), v, vpos)); + gp_GetIndex(theEmbedding, v), v, vpos)); // The DFS tree root of a connected component is always the least // number vertex in the vertex ordering. We have to give it a @@ -402,13 +404,13 @@ int _ComputeEdgePositions(DrawPlanarContext *context) // Now we traverse the adjacency list of the DFS tree root and // record each edge as the generator edge of the neighbors e = gp_GetFirstArc(theEmbedding, v); - while (gp_IsArc(e)) + while (gp_IsArc(theEmbedding, e)) { eIndex = (e >> 1); // div by 2 since each edge is a pair of arcs edgeListHead = LCAppend(edgeList, edgeListHead, eIndex); gp_LogLine(gp_MakeLogStr2("Append generator edge (%d, %d) to edgeList", - gp_GetVertexIndex(theEmbedding, v), gp_GetVertexIndex(theEmbedding, gp_GetNeighbor(theEmbedding, e)))); + gp_GetIndex(theEmbedding, v), gp_GetIndex(theEmbedding, gp_GetNeighbor(theEmbedding, e)))); // Set the generator edge for the root's neighbor gp_SetVertexVisitedInfo(theEmbedding, gp_GetNeighbor(theEmbedding, e), e); @@ -424,7 +426,7 @@ int _ComputeEdgePositions(DrawPlanarContext *context) // Get the generator edge of the vertex // Note that this never gets the false generator edge of a DFS tree root eTwin = gp_GetVertexVisitedInfo(theEmbedding, v); - if (gp_IsNotArc(eTwin)) + if (gp_IsNotArc(theEmbedding, eTwin)) return NOTOK; e = gp_GetTwinArc(theEmbedding, eTwin); @@ -447,22 +449,22 @@ int _ComputeEdgePositions(DrawPlanarContext *context) LCInsertAfter(edgeList, edgeListInsertPoint, eIndex); gp_LogLine(gp_MakeLogStr4("Insert (%d, %d) after (%d, %d)", - gp_GetVertexIndex(theEmbedding, v), - gp_GetVertexIndex(theEmbedding, gp_GetNeighbor(theEmbedding, eCur)), - gp_GetVertexIndex(theEmbedding, gp_GetNeighbor(theEmbedding, gp_GetTwinArc(theEmbedding, e))), - gp_GetVertexIndex(theEmbedding, gp_GetNeighbor(theEmbedding, e)))); + gp_GetIndex(theEmbedding, v), + gp_GetIndex(theEmbedding, gp_GetNeighbor(theEmbedding, eCur)), + gp_GetIndex(theEmbedding, gp_GetNeighbor(theEmbedding, gp_GetTwinArc(theEmbedding, e))), + gp_GetIndex(theEmbedding, gp_GetNeighbor(theEmbedding, e)))); edgeListInsertPoint = eIndex; // If the vertex does not yet have a generator edge, then set it. // Note that a DFS tree root has a false generator edge, so this if // test avoids setting a generator edge for a DFS tree root - if (gp_IsNotArc(gp_GetVertexVisitedInfo(theEmbedding, gp_GetNeighbor(theEmbedding, eCur)))) + if (gp_IsNotArc(theEmbedding, gp_GetVertexVisitedInfo(theEmbedding, gp_GetNeighbor(theEmbedding, eCur)))) { gp_SetVertexVisitedInfo(theEmbedding, gp_GetNeighbor(theEmbedding, eCur), eCur); gp_LogLine(gp_MakeLogStr2("Generator edge (%d, %d)", - gp_GetVertexIndex(theEmbedding, gp_GetNeighbor(theEmbedding, gp_GetTwinArc(theEmbedding, e))), - gp_GetVertexIndex(theEmbedding, gp_GetNeighbor(theEmbedding, eCur)))); + gp_GetIndex(theEmbedding, gp_GetNeighbor(theEmbedding, gp_GetTwinArc(theEmbedding, e))), + gp_GetIndex(theEmbedding, gp_GetNeighbor(theEmbedding, eCur)))); } } @@ -479,9 +481,10 @@ int _ComputeEdgePositions(DrawPlanarContext *context) // Now iterate through the edgeList and assign positions to the edges. epos = 0; eIndex = edgeListHead; - while (gp_IsArc(eIndex)) + e = eIndex == NIL ? NIL : (eIndex << 1); + + while (gp_IsArc(theEmbedding, e)) { - e = (eIndex << 1); eTwin = gp_GetTwinArc(theEmbedding, e); context->E[e].pos = context->E[eTwin].pos = epos; @@ -489,11 +492,14 @@ int _ComputeEdgePositions(DrawPlanarContext *context) epos++; eIndex = LCGetNext(edgeList, edgeListHead, eIndex); + e = eIndex == NIL ? NIL : (eIndex << 1); } // Clean up and return LCFree(&edgeList); + free(vertexOrder); + vertexOrder = NULL; gp_LogLine("graphDrawPlanar.c/_ComputeEdgePositions() end\n"); @@ -511,24 +517,24 @@ int _ComputeEdgePositions(DrawPlanarContext *context) int _ComputeVertexRanges(DrawPlanarContext *context) { graphP theEmbedding = context->theGraph; - int v, e, min, max; + int v = NIL, e = NIL, min = NIL, max = NIL; - for (v = gp_GetFirstVertex(theEmbedding); gp_VertexInRange(theEmbedding, v); v++) + for (v = gp_GetFirstVertex(theEmbedding); gp_VertexInRangeAscending(theEmbedding, v); v++) { min = theEmbedding->M + 1; - max = -1; + max = NIL; // Iterate the edges, except in the isolated vertex case we just // set the min and max to 1 since there no edges controlling where // it gets drawn. e = gp_GetFirstArc(theEmbedding, v); - if (gp_IsNotArc(e)) + if (gp_IsNotArc(theEmbedding, e)) { min = max = 0; } else { - while (gp_IsArc(e)) + while (gp_IsArc(theEmbedding, e)) { if (min > context->E[e].pos) min = context->E[e].pos; @@ -564,7 +570,7 @@ int _ComputeEdgeRanges(DrawPlanarContext *context) if (sp_NonEmpty(theEmbedding->edgeHoles)) return NOTOK; - EsizeOccupied = gp_EdgeInUseIndexBound(theEmbedding); + EsizeOccupied = gp_EdgeInUseArraySize(theEmbedding); for (e = gp_GetFirstEdge(theEmbedding); e < EsizeOccupied; e += 2) { eTwin = gp_GetTwinArc(theEmbedding, e); @@ -647,7 +653,7 @@ void _CollectDrawingData(DrawPlanarContext *context, int RootVertex, int W, int the 4-tuple in the merge stack */ Parent = theEmbedding->theStack->S[K]; BicompRoot = theEmbedding->theStack->S[K + 2]; - DFSChild = gp_GetDFSChildFromRoot(theEmbedding, BicompRoot); + DFSChild = gp_GetDFSChildFromBicompRoot(theEmbedding, BicompRoot); /* We get the active descendant vertex in the child bicomp that will be adjacent to the parent along the external face. @@ -737,15 +743,15 @@ int _BreakTie(DrawPlanarContext *context, int BicompRoot, int W, int WPrevLink) return NOTOK; /* If there is a tie, it can now be resolved. */ - if (gp_IsVertex(context->VI[W].tie[WPrevLink])) + if (gp_IsVertex(theEmbedding, context->VI[W].tie[WPrevLink])) { int DFSChild = context->VI[W].tie[WPrevLink]; /* Set the two ancestor variables that contextualize putting W 'between' or 'beyond' its parent relative to what. */ - context->VI[DFSChild].ancestorChild = gp_GetDFSChildFromRoot(theEmbedding, BicompRoot); - context->VI[DFSChild].ancestor = gp_GetPrimaryVertexFromRoot(theEmbedding, BicompRoot); + context->VI[DFSChild].ancestorChild = gp_GetDFSChildFromBicompRoot(theEmbedding, BicompRoot); + context->VI[DFSChild].ancestor = gp_GetVertexFromBicompRoot(theEmbedding, BicompRoot); gp_LogLine(gp_MakeLogStr4("V[child=%d]=.ancestorChild = %d, V[child=%d]=.ancestor = %d", DFSChild, context->VI[DFSChild].ancestorChild, DFSChild, context->VI[DFSChild].ancestor)); @@ -796,7 +802,7 @@ char *_RenderToString(graphP theEmbedding) { int N = theEmbedding->N; int M = theEmbedding->M; - int zeroBasedVertexOffset = (theEmbedding->internalFlags & FLAGS_ZEROBASEDIO) ? gp_GetFirstVertex(theEmbedding) : 0; + int zeroBasedVertexOffset = 0; int n, m, EsizeOccupied, v, vRange, e, eRange, Mid, Pos; char *visRep = (char *)malloc(sizeof(char) * ((M + 1) * 2 * N + 1)); char numBuffer[32]; @@ -804,12 +810,26 @@ char *_RenderToString(graphP theEmbedding) if (visRep == NULL) return NULL; - if (sp_NonEmpty(context->theGraph->edgeHoles)) + // If edges were deleted from the embedding, then the visibility representation is + // no longer valid. (This is a necessary condition but not sufficient to guarantee + // no embedding mutations, because adding edges uses the holes, and other APIs + // allow edge changes). + if (sp_NonEmpty(theEmbedding->edgeHoles)) { free(visRep); + visRep = NULL; + return NULL; } + // If we are supposed to write 0-based output, then we have to set this variable to indicate + // how much to subtract from each vertex index based on whether this library has been + // compiled with 0-based or 1-based array indexing for the in-memory data structure (i.e., + // compiled with USE_FASTER_1BASEDARRAYS USE_0BASEDARRAYS). + // The macro invoked is responsive to the compile-time difference. + if (theEmbedding->internalFlags & FLAGS_ZEROBASEDIO) + zeroBasedVertexOffset = gp_GetFirstVertex(theGraph); + // Clear the space for (n = 0; n < N; n++) { @@ -824,7 +844,7 @@ char *_RenderToString(graphP theEmbedding) } // Draw the vertices - for (v = gp_GetFirstVertex(theEmbedding); gp_VertexInRange(theEmbedding, v); v++) + for (v = gp_GetFirstVertex(theEmbedding); gp_VertexInRangeAscending(theEmbedding, v); v++) { Pos = context->VI[v].pos; for (vRange = context->VI[v].start; vRange <= context->VI[v].end; vRange++) @@ -850,7 +870,7 @@ char *_RenderToString(graphP theEmbedding) } // Draw the edges - EsizeOccupied = gp_EdgeInUseIndexBound(theEmbedding); + EsizeOccupied = gp_EdgeInUseArraySize(theEmbedding); for (e = gp_GetFirstEdge(theEmbedding); e < EsizeOccupied; e += 2) { Pos = context->E[e].pos; @@ -864,6 +884,7 @@ char *_RenderToString(graphP theEmbedding) // Null terminate string and return it visRep[(M + 1) * 2 * N] = '\0'; + return visRep; } @@ -902,6 +923,8 @@ int gp_DrawPlanar_RenderToString(graphP theEmbedding, char **pRenditionString) ********************************************************************/ int gp_DrawPlanar_RenderToFile(graphP theEmbedding, char *theFileName) { + int Result = OK; + if (theEmbedding != NULL && sp_IsEmpty(theEmbedding->edgeHoles)) { FILE *outfile; @@ -918,10 +941,13 @@ int gp_DrawPlanar_RenderToFile(graphP theEmbedding, char *theFileName) return NOTOK; theRendition = _RenderToString(theEmbedding); + Result = theRendition ? OK : NOTOK; if (theRendition != NULL) { fprintf(outfile, "%s", theRendition); + free(theRendition); + theRendition = NULL; } if (strcmp(theFileName, "stdout") == 0 || strcmp(theFileName, "stderr") == 0) @@ -930,7 +956,7 @@ int gp_DrawPlanar_RenderToFile(graphP theEmbedding, char *theFileName) else if (fclose(outfile) != 0) return NOTOK; - return theRendition ? OK : NOTOK; + return Result; } return NOTOK; @@ -948,12 +974,12 @@ int _CheckVisibilityRepresentationIntegrity(DrawPlanarContext *context) if (sp_NonEmpty(context->theGraph->edgeHoles)) return NOTOK; - _ClearVisitedFlags(theEmbedding); + _ClearAllVisitedFlagsInGraph(theEmbedding); /* Test whether the vertex values make sense and whether the vertex positions are unique. */ - for (v = gp_GetFirstVertex(theEmbedding); gp_VertexInRange(theEmbedding, v); v++) + for (v = gp_GetFirstVertex(theEmbedding); gp_VertexInRangeAscending(theEmbedding, v); v++) { if (theEmbedding->M > 0) { @@ -966,20 +992,20 @@ int _CheckVisibilityRepresentationIntegrity(DrawPlanarContext *context) } // Has the vertex position been used by a vertex before vertex v? - if (gp_GetVertexVisited(theEmbedding, context->VI[v].pos + gp_GetFirstVertex(theEmbedding))) + if (gp_GetVisited(theEmbedding, context->VI[v].pos + gp_GetFirstVertex(theEmbedding))) return NOTOK; // Mark the vertex position as used by vertex v. // Note that this marking is made on some other vertex unrelated to v // We're just reusing the vertex visited array as cheap storage for a // detector of reusing vertex position integers. - gp_SetVertexVisited(theEmbedding, context->VI[v].pos + gp_GetFirstVertex(theEmbedding)); + gp_SetVisited(theEmbedding, context->VI[v].pos + gp_GetFirstVertex(theEmbedding)); } /* Test whether the edge values make sense and whether the edge positions are unique */ - EsizeOccupied = gp_EdgeInUseIndexBound(theEmbedding); + EsizeOccupied = gp_EdgeInUseArraySize(theEmbedding); for (e = gp_GetFirstEdge(theEmbedding); e < EsizeOccupied; e += 2) { /* Each edge has two index locations in the edge information array */ @@ -1017,12 +1043,12 @@ int _CheckVisibilityRepresentationIntegrity(DrawPlanarContext *context) /* Test whether any edge intersects any vertex position for a vertex that is not an endpoint of the edge. */ - EsizeOccupied = gp_EdgeInUseIndexBound(theEmbedding); + EsizeOccupied = gp_EdgeInUseArraySize(theEmbedding); for (e = gp_GetFirstEdge(theEmbedding); e < EsizeOccupied; e += 2) { eTwin = gp_GetTwinArc(theEmbedding, e); - for (v = gp_GetFirstVertex(theEmbedding); gp_VertexInRange(theEmbedding, v); v++) + for (v = gp_GetFirstVertex(theEmbedding); gp_VertexInRangeAscending(theEmbedding, v); v++) { /* If the vertex is an endpoint of the edge, then... */ diff --git a/planarity/c/graphLib/planarityRelated/graphDrawPlanar.h b/planarity/c/graphLib/planarityRelated/graphDrawPlanar.h index f79ad9b..6f5332d 100644 --- a/planarity/c/graphLib/planarityRelated/graphDrawPlanar.h +++ b/planarity/c/graphLib/planarityRelated/graphDrawPlanar.h @@ -2,7 +2,7 @@ #define GRAPH_DRAWPLANAR_H /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ diff --git a/planarity/c/graphLib/planarityRelated/graphDrawPlanar.private.h b/planarity/c/graphLib/planarityRelated/graphDrawPlanar.private.h index bdcd017..52e0db1 100644 --- a/planarity/c/graphLib/planarityRelated/graphDrawPlanar.private.h +++ b/planarity/c/graphLib/planarityRelated/graphDrawPlanar.private.h @@ -2,7 +2,7 @@ #define GRAPH_DRAWPLANAR_PRIVATE_H /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ diff --git a/planarity/c/graphLib/planarityRelated/graphDrawPlanar_Extensions.c b/planarity/c/graphLib/planarityRelated/graphDrawPlanar_Extensions.c index 0a87e7a..6b0dc4e 100644 --- a/planarity/c/graphLib/planarityRelated/graphDrawPlanar_Extensions.c +++ b/planarity/c/graphLib/planarityRelated/graphDrawPlanar_Extensions.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -9,7 +9,7 @@ See the LICENSE.TXT file for licensing information. #include "graphDrawPlanar.private.h" #include "graphDrawPlanar.h" -extern void _ClearVertexVisitedFlags(graphP theGraph, int); +extern void _ClearAnyTypeVertexVisitedFlags(graphP theGraph, int); extern void _CollectDrawingData(DrawPlanarContext *context, int RootVertex, int W, int WPrevLink); extern int _BreakTie(DrawPlanarContext *context, int BicompRoot, int W, int WPrevLink); @@ -198,8 +198,8 @@ void _DrawPlanar_ClearStructures(DrawPlanarContext *context) int _DrawPlanar_CreateStructures(DrawPlanarContext *context) { graphP theGraph = context->theGraph; - int VIsize = gp_PrimaryVertexIndexBound(theGraph); - int Esize = gp_EdgeIndexBound(theGraph); + int VIsize = gp_VertexArraySize(theGraph); + int Esize = gp_EdgeArraySize(theGraph); if (theGraph->N <= 0) return NOTOK; @@ -222,8 +222,8 @@ int _DrawPlanar_CreateStructures(DrawPlanarContext *context) int _DrawPlanar_InitStructures(DrawPlanarContext *context) { #ifdef USE_FASTER_1BASEDARRAYS - memset(context->VI, NIL_CHAR, gp_PrimaryVertexIndexBound(context->theGraph) * sizeof(DrawPlanar_VertexInfo)); - memset(context->E, NIL_CHAR, gp_EdgeIndexBound(context->theGraph) * sizeof(DrawPlanar_EdgeRec)); + memset(context->VI, NIL_CHAR, gp_VertexArraySize(context->theGraph) * sizeof(DrawPlanar_VertexInfo)); + memset(context->E, NIL_CHAR, gp_EdgeArraySize(context->theGraph) * sizeof(DrawPlanar_EdgeRec)); #else int v, e, Esize; graphP theGraph = context->theGraph; @@ -231,10 +231,10 @@ int _DrawPlanar_InitStructures(DrawPlanarContext *context) if (theGraph->N <= 0) return NOTOK; - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) _DrawPlanar_InitVertexInfo(context, v); - Esize = gp_EdgeIndexBound(theGraph); + Esize = gp_EdgeArraySize(theGraph); for (e = gp_GetFirstEdge(theGraph); e < Esize; e++) _DrawPlanar_InitEdgeRec(context, e); #endif @@ -253,8 +253,8 @@ void *_DrawPlanar_DupContext(void *pContext, void *theGraph) if (newContext != NULL) { - int VIsize = gp_PrimaryVertexIndexBound((graphP)theGraph); - int Esize = gp_EdgeIndexBound((graphP)theGraph); + int VIsize = gp_VertexArraySize((graphP)theGraph); + int Esize = gp_EdgeArraySize((graphP)theGraph); *newContext = *context; @@ -368,12 +368,12 @@ int _DrawPlanar_SortVertices(graphP theGraph) DrawPlanar_VertexInfo temp; // Relabel the context data members that indicate vertices - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) { - if (gp_IsVertex(context->VI[v].ancestor)) + if (gp_IsVertex(theGraph, context->VI[v].ancestor)) { - context->VI[v].ancestor = gp_GetVertexIndex(theGraph, context->VI[v].ancestor); - context->VI[v].ancestorChild = gp_GetVertexIndex(theGraph, context->VI[v].ancestorChild); + context->VI[v].ancestor = gp_GetIndex(theGraph, context->VI[v].ancestor); + context->VI[v].ancestorChild = gp_GetIndex(theGraph, context->VI[v].ancestorChild); } } @@ -381,20 +381,20 @@ int _DrawPlanar_SortVertices(graphP theGraph) // to the index values of the vertices. This could be done very easily with an extra array in // which, for each v, newVI[index of v] = VI[v]. However, this loop avoids memory allocation // by performing the operation (almost) in-place, except for the pre-existing visitation flags. - _ClearVertexVisitedFlags(theGraph, FALSE); - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + _ClearAnyTypeVertexVisitedFlags(theGraph, FALSE); + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) { // If the correct data has already been placed into position v // by prior steps, then skip to the next vertex - if (gp_GetVertexVisited(theGraph, v)) + if (gp_GetVisited(theGraph, v)) continue; // At the beginning of processing position v, the data in position v // corresponds to data that belongs at the index of v. - vIndex = gp_GetVertexIndex(theGraph, v); + vIndex = gp_GetIndex(theGraph, v); // Iterate on position v until it receives the correct data - while (!gp_GetVertexVisited(theGraph, v)) + while (!gp_GetVisited(theGraph, v)) { // Place the data at position v into its proper location at position // vIndex, and move vIndex's data into position v. @@ -403,11 +403,11 @@ int _DrawPlanar_SortVertices(graphP theGraph) context->VI[vIndex] = temp; // The data at position vIndex is now marked as being correct. - gp_SetVertexVisited(theGraph, vIndex); + gp_SetVisited(theGraph, vIndex); // The data now in position v is the data from position vIndex, // whose index we now take as the new vIndex - vIndex = gp_GetVertexIndex(theGraph, vIndex); + vIndex = gp_GetIndex(theGraph, vIndex); } } } @@ -576,7 +576,7 @@ int _DrawPlanar_ReadPostprocess(graphP theGraph, char *extraData) extraData = extraData + strlen(line) + 1; // Read the N lines of vertex information - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) { sscanf(extraData, " %d%c %d %d %d", &tempInt, &tempChar, &context->VI[v].pos, @@ -587,7 +587,7 @@ int _DrawPlanar_ReadPostprocess(graphP theGraph, char *extraData) } // Read the lines that contain edge information - EsizeOccupied = gp_EdgeInUseIndexBound(theGraph); + EsizeOccupied = gp_EdgeInUseArraySize(theGraph); for (e = gp_GetFirstEdge(theGraph); e < EsizeOccupied; e++) { sscanf(extraData, " %d%c %d %d %d", &tempInt, &tempChar, @@ -615,25 +615,47 @@ int _DrawPlanar_WritePostprocess(graphP theGraph, char **pExtraData) if (context != NULL) { + (*pExtraData) = NULL; if (context->functions.fpWritePostprocess(theGraph, pExtraData) != OK) return NOTOK; + else if ((*pExtraData) != NULL) + { + // NOTE: We currently do not support stacking WritePostprocess calls + // from multiple extensions; it wouldn't be hard, we just don't ;) + free((*pExtraData)); + (*pExtraData) = NULL; + + return NOTOK; + } else { int v, e, EsizeOccupied; char line[64]; int maxLineSize = 64, extraDataPos = 0; char *extraData = (char *)calloc((1 + theGraph->N + 2 * theGraph->M + 1) * maxLineSize, sizeof(char)); - int zeroBasedVertexOffset = (theGraph->internalFlags & FLAGS_ZEROBASEDIO) ? gp_GetFirstVertex(theGraph) : 0; - int zeroBasedEdgeOffset = (theGraph->internalFlags & FLAGS_ZEROBASEDIO) ? gp_GetFirstEdge(theGraph) : 0; + int zeroBasedVertexOffset = 0; + int zeroBasedEdgeOffset = 0; if (extraData == NULL) return NOTOK; + // If we are supposed to write 0-based output, then we have to set these two variables to indicate + // how much to subtract from each vertex and edge index based on whether this library has been + // compiled with 0-based or 1-based array indexing for the in-memory data structure (i.e., compiled + // with USE_FASTER_1BASEDARRAYS USE_0BASEDARRAYS). The macros invoked are responsive to the difference. + if (theGraph->internalFlags & FLAGS_ZEROBASEDIO) + { + zeroBasedVertexOffset = gp_GetFirstVertex(theGraph); + zeroBasedEdgeOffset = gp_GetFirstEdge(theGraph); + } + // Bit of an unlikely case, but for safety, a bigger maxLineSize // and line array size are needed to handle very large graphs if (theGraph->N > 2000000000) { free(extraData); + extraData = NULL; + return NOTOK; } @@ -641,7 +663,7 @@ int _DrawPlanar_WritePostprocess(graphP theGraph, char **pExtraData) strcpy(extraData + extraDataPos, line); extraDataPos += (int)strlen(line); - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) { sprintf(line, "%d: %d %d %d\n", v - zeroBasedVertexOffset, context->VI[v].pos, @@ -651,7 +673,7 @@ int _DrawPlanar_WritePostprocess(graphP theGraph, char **pExtraData) extraDataPos += (int)strlen(line); } - EsizeOccupied = gp_EdgeInUseIndexBound(theGraph); + EsizeOccupied = gp_EdgeInUseArraySize(theGraph); for (e = gp_GetFirstEdge(theGraph); e < EsizeOccupied; e++) { if (gp_EdgeInUse(theGraph, e)) diff --git a/planarity/c/graphLib/planarityRelated/graphEmbed.c b/planarity/c/graphLib/planarityRelated/graphEmbed.c index b65787a..d74ef84 100644 --- a/planarity/c/graphLib/planarityRelated/graphEmbed.c +++ b/planarity/c/graphLib/planarityRelated/graphEmbed.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -10,12 +10,12 @@ See the LICENSE.TXT file for licensing information. /* Imported functions */ -extern void _ClearVertexVisitedFlags(graphP theGraph, int); +extern void _ClearAnyTypeVertexVisitedFlags(graphP theGraph, int); extern int _IsolateKuratowskiSubgraph(graphP theGraph, int v, int R); extern int _IsolateOuterplanarObstruction(graphP theGraph, int v, int R); -extern void _InitVertexRec(graphP theGraph, int v); +extern void _InitAnyTypeVertexRec(graphP theGraph, int v); /* Private functions (some are exported to system only) */ @@ -103,7 +103,7 @@ int gp_Embed(graphP theGraph, int embedFlags) // Walkup calls establish Pertinence in Step v // Do the Walkup for each cycle edge from v to a DFS descendant W. e = gp_GetVertexFwdArcList(theGraph, v); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { theGraph->functions.fpWalkUp(theGraph, v, e); @@ -116,11 +116,11 @@ int gp_Embed(graphP theGraph, int embedFlags) // Work systematically through the DFS children of vertex v, using Walkdown // to add the back edges from v to its descendants in each of the DFS subtrees c = gp_GetVertexSortedDFSChildList(theGraph, v); - while (gp_IsVertex(c)) + while (gp_IsVertex(theGraph, c)) { - if (gp_IsVertex(gp_GetVertexPertinentRootsList(theGraph, c))) + if (gp_IsVertex(theGraph, gp_GetVertexPertinentRootsList(theGraph, c))) { - RetVal = theGraph->functions.fpWalkDown(theGraph, v, gp_GetRootFromDFSChild(theGraph, c)); + RetVal = theGraph->functions.fpWalkDown(theGraph, v, gp_GetBicompRootFromDFSChild(theGraph, c)); // If Walkdown returns OK, then it is OK to proceed with edge addition. // Otherwise, if Walkdown returns NONEMBEDDABLE then we stop edge addition. if (RetVal != OK) @@ -185,16 +185,16 @@ int _EmbeddingInitialize(graphP theGraph) sp_ClearStack(theStack); - _ClearVertexVisitedFlags(theGraph, FALSE); + _ClearAnyTypeVertexVisitedFlags(theGraph, FALSE); // This outer loop processes each connected component of a disconnected graph // No need to compare v < N since DFI will reach N when inner loop processes the // last connected component in the graph - for (DFI = v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, DFI); v++) + for (DFI = v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, DFI); v++) { // Skip numbered vertices to cause the outerloop to find the // next DFS tree root in a disconnected graph - if (gp_IsVertex(gp_GetVertexParent(theGraph, v))) + if (gp_IsVertex(theGraph, gp_GetVertexParent(theGraph, v))) continue; // DFS a connected component @@ -206,20 +206,20 @@ int _EmbeddingInitialize(graphP theGraph) // For vertex uparent and edge e, obtain the opposing endpoint u of e // If uparent is NIL, then e is also NIL and we have encountered the // false edge to the DFS tree root as pushed above. - u = gp_IsNotVertex(uparent) ? v : gp_GetNeighbor(theGraph, e); + u = gp_IsNotVertex(theGraph, uparent) ? v : gp_GetNeighbor(theGraph, e); // We popped an edge to an unvisited vertex, so it is either a DFS tree edge // or a false edge to the DFS tree root (u). - if (!gp_GetVertexVisited(theGraph, u)) + if (!gp_GetVisited(theGraph, u)) { gp_LogLine(gp_MakeLogStr3("v=%d, DFI=%d, parent=%d", u, DFI, uparent)); // (1) Set the DFI and DFS parent - gp_SetVertexVisited(theGraph, u); - gp_SetVertexIndex(theGraph, u, DFI++); + gp_SetVisited(theGraph, u); + gp_SetIndex(theGraph, u, DFI++); gp_SetVertexParent(theGraph, u, uparent); - if (gp_IsArc(e)) + if (gp_IsArc(theGraph, e)) { // (2) Set the edge type values for tree edges gp_SetEdgeType(theGraph, e, EDGE_TYPE_CHILD); @@ -227,26 +227,26 @@ int _EmbeddingInitialize(graphP theGraph) // (3) Record u in the sortedDFSChildList of uparent gp_SetVertexSortedDFSChildList(theGraph, uparent, - gp_AppendDFSChild(theGraph, uparent, gp_GetVertexIndex(theGraph, u))); + gp_AppendDFSChild(theGraph, uparent, gp_GetIndex(theGraph, u))); // (8) Record e as the first and last arc of the virtual vertex R, // a root copy of uparent uniquely associated with child u - R = gp_GetRootFromDFSChild(theGraph, gp_GetVertexIndex(theGraph, u)); + R = gp_GetBicompRootFromDFSChild(theGraph, gp_GetIndex(theGraph, u)); gp_SetFirstArc(theGraph, R, e); gp_SetLastArc(theGraph, R, e); } // (5) Initialize the least ancestor value - gp_SetVertexLeastAncestor(theGraph, u, gp_GetVertexIndex(theGraph, u)); + gp_SetVertexLeastAncestor(theGraph, u, gp_GetIndex(theGraph, u)); // Push edges to all unvisited neighbors. These will be either // tree edges to children or forward arcs of back edges // Edges not pushed are marked as back edges here, except the // edge leading back to the immediate DFS parent. e = gp_GetFirstArc(theGraph, u); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { - if (!gp_GetVertexVisited(theGraph, gp_GetNeighbor(theGraph, e))) + if (!gp_GetVisited(theGraph, gp_GetNeighbor(theGraph, e))) { sp_Push2(theStack, u, e); } @@ -262,16 +262,16 @@ int _EmbeddingInitialize(graphP theGraph) ePrev = gp_GetPrevArc(theGraph, eTwin); eNext = gp_GetNextArc(theGraph, eTwin); - if (gp_IsArc(ePrev)) + if (gp_IsArc(theGraph, ePrev)) gp_SetNextArc(theGraph, ePrev, eNext); else gp_SetFirstArc(theGraph, uneighbor, eNext); - if (gp_IsArc(eNext)) + if (gp_IsArc(theGraph, eNext)) gp_SetPrevArc(theGraph, eNext, ePrev); else gp_SetLastArc(theGraph, uneighbor, ePrev); - if (gp_IsArc(f = gp_GetVertexFwdArcList(theGraph, uneighbor))) + if (gp_IsArc(theGraph, f = gp_GetVertexFwdArcList(theGraph, uneighbor))) { ePrev = gp_GetPrevArc(theGraph, f); gp_SetPrevArc(theGraph, eTwin, ePrev); @@ -287,7 +287,7 @@ int _EmbeddingInitialize(graphP theGraph) } // (5) Update the leastAncestor value for the vertex u - uneighbor = gp_GetVertexIndex(theGraph, uneighbor); + uneighbor = gp_GetIndex(theGraph, uneighbor); if (uneighbor < gp_GetVertexLeastAncestor(theGraph, u)) gp_SetVertexLeastAncestor(theGraph, u, uneighbor); } @@ -315,7 +315,7 @@ int _EmbeddingInitialize(graphP theGraph) child = gp_GetVertexSortedDFSChildList(theGraph, v); gp_SetVertexFuturePertinentChild(theGraph, v, child); leastValue = gp_GetVertexLeastAncestor(theGraph, v); - while (gp_IsVertex(child)) + while (gp_IsVertex(theGraph, child)) { if (leastValue > gp_GetVertexLowpoint(theGraph, child)) leastValue = gp_GetVertexLowpoint(theGraph, child); @@ -334,7 +334,7 @@ int _EmbeddingInitialize(graphP theGraph) } else { - R = gp_GetRootFromDFSChild(theGraph, v); + R = gp_GetBicompRootFromDFSChild(theGraph, v); // Make the child edge the only edge in the virtual vertex adjacency list e = gp_GetFirstArc(theGraph, R); @@ -381,16 +381,16 @@ void _EmbedBackEdgeToDescendant(graphP theGraph, int RootSide, int RootVertex, i { int fwdArc, backArc, parentCopy; - /* We get the two edge records of the back edge to embed. + /* We get the two edge records of the back edge (v, W) to embed. The Walkup recorded in W's adjacentTo the index of the forward arc - from the root's parent copy to the descendant W. */ + that goes from the root's parent copy, v, to the descendant W. */ fwdArc = gp_GetVertexPertinentEdge(theGraph, W); backArc = gp_GetTwinArc(theGraph, fwdArc); /* The forward arc is removed from the fwdArcList of the root's parent copy. */ - parentCopy = gp_GetPrimaryVertexFromRoot(theGraph, RootVertex); + parentCopy = gp_GetVertexFromBicompRoot(theGraph, RootVertex); gp_LogLine(gp_MakeLogStr5("graphEmbed.c/_EmbedBackEdgeToDescendant() V=%d, R=%d, R_out=%d, W=%d, W_in=%d", parentCopy, RootVertex, RootSide, W, WPrevLink)); @@ -443,7 +443,7 @@ void _InvertVertex(graphP theGraph, int W) // Swap the links in all the arcs of the adjacency list e = gp_GetFirstArc(theGraph, W); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { temp = gp_GetNextArc(theGraph, e); gp_SetNextArc(theGraph, e, gp_GetPrevArc(theGraph, e)); @@ -498,7 +498,7 @@ void _MergeVertex(graphP theGraph, int W, int WPrevLink, int R) // All arcs leading into R from its neighbors must be changed // to say that they are leading into W e = gp_GetFirstArc(theGraph, R); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { eTwin = gp_GetTwinArc(theGraph, e); gp_GetNeighbor(theGraph, eTwin) = W; @@ -512,7 +512,7 @@ void _MergeVertex(graphP theGraph, int W, int WPrevLink, int R) e_ext = gp_GetArc(theGraph, R, WPrevLink); // If W has any edges, then join the list with that of R - if (gp_IsArc(e_w)) + if (gp_IsArc(theGraph, e_w)) { // The WPrevLink arc of W is e_w, so the 1^WPrevLink arc in e_w leads back to W. // Now it must lead to e_r. Likewise, e_r needs to lead back to e_w with the @@ -540,7 +540,7 @@ void _MergeVertex(graphP theGraph, int W, int WPrevLink, int R) } // Erase the entries in R, which is a root copy that is no longer needed - _InitVertexRec(theGraph, R); + _InitAnyTypeVertexRec(theGraph, R); } /******************************************************************** @@ -599,7 +599,7 @@ int _MergeBicomps(graphP theGraph, int v, int RootVertex, int W, int WPrevLink) _InvertVertex(theGraph, R); e = gp_GetFirstArc(theGraph, R); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) { @@ -624,7 +624,7 @@ int _MergeBicomps(graphP theGraph, int v, int RootVertex, int W, int WPrevLink) // If the merge will place the current future pertinence child into the same bicomp as Z, // then we advance to the next child (or NIL) because future pertinence is - if (gp_GetDFSChildFromRoot(theGraph, R) == gp_GetVertexFuturePertinentChild(theGraph, Z)) + if (gp_GetDFSChildFromBicompRoot(theGraph, R) == gp_GetVertexFuturePertinentChild(theGraph, Z)) { gp_SetVertexFuturePertinentChild(theGraph, Z, gp_GetVertexNextDFSChild(theGraph, Z, gp_GetVertexFuturePertinentChild(theGraph, Z))); @@ -738,7 +738,7 @@ void _WalkUp(graphP theGraph, int v, int e) gp_SetVertexVisitedInfo(theGraph, Zag, v); // If both directions found new non-root vertices, then proceed with parallel external face traversal - if (gp_IsNotVertex(R)) + if (gp_IsNotVirtualVertex(theGraph, R)) { ZigPrevLink = gp_GetExtFaceVertex(theGraph, nextZig, 0) == Zig ? 0 : 1; Zig = nextZig; @@ -751,12 +751,14 @@ void _WalkUp(graphP theGraph, int v, int e) // so walk up to the parent bicomp and continue else { - // Step up from the root (virtual) vertex to the primary (non-virtual) vertex - Zig = Zag = gp_GetPrimaryVertexFromRoot(theGraph, R); + // Step up from the bicomp root vertex (virtual) to the parent copy of + // the vertex (non-virtual; called parent copy because it is the one that + // is in a bicomp with a virtual or non-virtual copy of its DFS parent) + Zig = Zag = gp_GetVertexFromBicompRoot(theGraph, R); ZigPrevLink = 1; ZagPrevLink = 0; - // Add the new root vertex to the list of pertinent bicomp roots of the primary vertex. + // Add the new bicomp root o the list of pertinent bicomp roots of the parent copy vertex. // The new root vertex is appended if future pertinent and prepended if only pertinent // so that, by virtue of storage, the Walkdown will process all pertinent bicomps that // are not future pertinent before any future pertinent bicomps. @@ -766,7 +768,7 @@ void _WalkUp(graphP theGraph, int v, int e) // whether the DFS child or any of its descendants connect by a back edge to // ancestors of v. If so, then the bicomp rooted at RootVertex must contain a // future pertinent vertex that must be kept on the external face. - if (gp_GetVertexLowpoint(theGraph, gp_GetDFSChildFromRoot(theGraph, R)) < v) + if (gp_GetVertexLowpoint(theGraph, gp_GetDFSChildFromBicompRoot(theGraph, R)) < v) gp_AppendVertexPertinentRoot(theGraph, Zig, R); else gp_PrependVertexPertinentRoot(theGraph, Zag, R); @@ -845,7 +847,7 @@ void _WalkUp(graphP theGraph, int v, int e) int _WalkDown(graphP theGraph, int v, int RootVertex) { int RetVal, W, WPrevLink, R, X, XPrevLink, Y, YPrevLink, RootSide, e; - int RootEdgeChild = gp_GetDFSChildFromRoot(theGraph, RootVertex); + int RootEdgeChild = gp_GetDFSChildFromBicompRoot(theGraph, RootVertex); sp_ClearStack(theGraph->theStack); @@ -863,7 +865,7 @@ int _WalkDown(graphP theGraph, int v, int RootVertex) while (W != RootVertex) { // Detect unembedded back edge descendant endpoint W - if (gp_IsArc(gp_GetVertexPertinentEdge(theGraph, W))) + if (gp_IsArc(theGraph, gp_GetVertexPertinentEdge(theGraph, W))) { // Merge any bicomps whose cut vertices were traversed to reach W, then add the // edge to W to form a new proper face in the embedding. @@ -879,7 +881,9 @@ int _WalkDown(graphP theGraph, int v, int RootVertex) } // If W has a pertinent child bicomp, then we descend to the first one... - if (gp_IsVertex(gp_GetVertexPertinentRootsList(theGraph, W))) + // NOTE: Each pertinent root is stored as the DFS child with which it is + // associated, so we test gp_IsVertex, not gp_IsVirtualVertex here. + if (gp_IsVertex(theGraph, gp_GetVertexPertinentRootsList(theGraph, W))) { // Push the vertex W and the direction of entry, then descend to a root copy R of W sp_Push2(theGraph->theStack, W, WPrevLink); @@ -978,14 +982,14 @@ int _WalkDown(graphP theGraph, int v, int RootVertex) // Detect and handle the case in which Walkdown was blocked from embedding all the back edges from v // to descendants in the subtree of the child of v associated with the bicomp RootVertex. - if (gp_IsArc(e = gp_GetVertexFwdArcList(theGraph, v)) && RootEdgeChild < gp_GetNeighbor(theGraph, e)) + if (gp_IsArc(theGraph, e = gp_GetVertexFwdArcList(theGraph, v)) && RootEdgeChild < gp_GetNeighbor(theGraph, e)) { int nextChild = gp_GetVertexNextDFSChild(theGraph, v, RootEdgeChild); // The Walkdown was blocked from embedding all forward arcs into the RootEdgeChild subtree // if there the next child's DFI is greater than the descendant endpoint of the next forward arc, // or if there is no next child. - if (gp_IsNotVertex(nextChild) || nextChild > gp_GetNeighbor(theGraph, e)) + if (gp_IsNotVertex(theGraph, nextChild) || nextChild > gp_GetNeighbor(theGraph, e)) { // If an extension indicates it is OK to proceed despite the unembedded forward arcs, then // advance to the forward arcs for the next child, if any @@ -1095,7 +1099,7 @@ void _AdvanceFwdArcList(graphP theGraph, int v, int child, int nextChild) { int e = gp_GetVertexFwdArcList(theGraph, v); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { // 2) e finds an edge whose descendant endpoint is less than the child if (gp_GetNeighbor(theGraph, e) < child) @@ -1105,7 +1109,7 @@ void _AdvanceFwdArcList(graphP theGraph, int v, int child, int nextChild) } // 3) e finds an edge whose descendant endpoint is greater than the next child - else if (gp_IsVertex(nextChild) && nextChild < gp_GetNeighbor(theGraph, e)) + else if (gp_IsVertex(theGraph, nextChild) && nextChild < gp_GetNeighbor(theGraph, e)) { gp_SetVertexFwdArcList(theGraph, v, e); break; @@ -1204,7 +1208,7 @@ int _OrientVerticesInEmbedding(graphP theGraph) // For each vertex, obtain the associated bicomp root location and, // if it is still in use as a bicomp root, orient the vertices in the bicomp - for (R = gp_GetFirstVirtualVertex(theGraph); gp_VirtualVertexInRange(theGraph, R); R++) + for (R = gp_GetFirstVirtualVertex(theGraph); gp_VirtualVertexInRangeAscending(theGraph, R); R++) { if (gp_VirtualVertexInUse(theGraph, R)) { @@ -1265,7 +1269,7 @@ int _OrientVerticesInBicomp(graphP theGraph, int BicompRoot, int PreserveSigns) /* Push the vertex's DFS children that are in the bicomp */ e = gp_GetFirstArc(theGraph, W); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) { @@ -1295,12 +1299,12 @@ int _JoinBicomps(graphP theGraph) { int R; - for (R = gp_GetFirstVirtualVertex(theGraph); gp_VirtualVertexInRange(theGraph, R); R++) + for (R = gp_GetFirstVirtualVertex(theGraph); gp_VirtualVertexInRangeAscending(theGraph, R); R++) { - // If the root is still active (i.e. an in-use virtual vertex) - // then merge it with its primary (non-virtual) counterpart + // If the bicomp root is still active (i.e. an in-use virtual vertex) + // then merge it with its parent copy vertex (non-virtual) if (gp_VirtualVertexInUse(theGraph, R)) - _MergeVertex(theGraph, gp_GetPrimaryVertexFromRoot(theGraph, R), 0, R); + _MergeVertex(theGraph, gp_GetVertexFromBicompRoot(theGraph, R), 0, R); } return OK; diff --git a/planarity/c/graphLib/planarityRelated/graphIsolator.c b/planarity/c/graphLib/planarityRelated/graphIsolator.c index 4c53eff..d05c62f 100644 --- a/planarity/c/graphLib/planarityRelated/graphIsolator.c +++ b/planarity/c/graphLib/planarityRelated/graphIsolator.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -10,7 +10,7 @@ See the LICENSE.TXT file for licensing information. /* Imported functions */ -extern void _ClearVisitedFlags(graphP); +extern void _ClearAllVisitedFlagsInGraph(graphP); extern int _GetNeighborOnExtFace(graphP theGraph, int curVertex, int *pPrevLink); extern int _JoinBicomps(graphP theGraph); @@ -64,7 +64,7 @@ int _IsolateKuratowskiSubgraph(graphP theGraph, int v, int R) flags, set=keep edge/vertex and clear=omit. Here we initialize to omit all, then we subsequently set visited on all edges and vertices in the homeomorph. */ - _ClearVisitedFlags(theGraph); + _ClearAllVisitedFlagsInGraph(theGraph); /* Next, we determine which of the non-planarity Minors was encountered and the principal bicomp on which the isolator will focus attention. */ @@ -190,9 +190,9 @@ int _IsolateMinorC(graphP theGraph) { isolatorContextP IC = &theGraph->IC; - if (gp_GetVertexObstructionType(theGraph, IC->px) == VERTEX_OBSTRUCTIONTYPE_HIGH_RXW) + if (gp_GetObstructionMark(theGraph, IC->px) == ANYVERTEX_OBSTRUCTIONMARK_HIGH_RXW) { - int highY = gp_GetVertexObstructionType(theGraph, IC->py) == VERTEX_OBSTRUCTIONTYPE_HIGH_RYW + int highY = gp_GetObstructionMark(theGraph, IC->py) == ANYVERTEX_OBSTRUCTIONMARK_HIGH_RYW ? IC->py : IC->y; if (_MarkPathAlongBicompExtFace(theGraph, IC->r, highY) != OK) @@ -285,16 +285,16 @@ int _IsolateMinorE1(graphP theGraph) { isolatorContextP IC = &theGraph->IC; - if (gp_GetVertexObstructionType(theGraph, IC->z) == VERTEX_OBSTRUCTIONTYPE_LOW_RXW) + if (gp_GetObstructionMark(theGraph, IC->z) == ANYVERTEX_OBSTRUCTIONMARK_LOW_RXW) { - gp_ResetVertexObstructionType(theGraph, IC->px, VERTEX_OBSTRUCTIONTYPE_HIGH_RXW); + gp_ResetObstructionMark(theGraph, IC->px, ANYVERTEX_OBSTRUCTIONMARK_HIGH_RXW); IC->x = IC->z; IC->ux = IC->uz; IC->dx = IC->dz; } - else if (gp_GetVertexObstructionType(theGraph, IC->z) == VERTEX_OBSTRUCTIONTYPE_LOW_RYW) + else if (gp_GetObstructionMark(theGraph, IC->z) == ANYVERTEX_OBSTRUCTIONMARK_LOW_RYW) { - gp_ResetVertexObstructionType(theGraph, IC->py, VERTEX_OBSTRUCTIONTYPE_HIGH_RYW); + gp_ResetObstructionMark(theGraph, IC->py, ANYVERTEX_OBSTRUCTIONMARK_HIGH_RYW); IC->y = IC->z; IC->uy = IC->uz; IC->dy = IC->dz; @@ -325,7 +325,7 @@ int _IsolateMinorE2(graphP theGraph) // Note: The x-y path was already marked, due to identifying E as the type of non-planarity minor, // but we're reducing to Minor A, which does not include the x-y path, so the visited flags are // cleared as a convenient, if somewhat wasteful, way to clear the marking on the x-y path - _ClearVisitedFlags(theGraph); + _ClearAllVisitedFlagsInGraph(theGraph); IC->v = IC->uz; IC->dw = IC->dz; @@ -418,7 +418,7 @@ int _GetLeastAncestorConnection(graphP theGraph, int cutVertex) int ancestor = gp_GetVertexLeastAncestor(theGraph, cutVertex); child = gp_GetVertexFuturePertinentChild(theGraph, cutVertex); - while (gp_IsVertex(child)) + while (gp_IsVertex(theGraph, child)) { if (gp_IsSeparatedDFSChild(theGraph, child) && ancestor > gp_GetVertexLowpoint(theGraph, child)) @@ -453,7 +453,7 @@ int _FindUnembeddedEdgeToAncestor(graphP theGraph, int cutVertex, child = gp_GetVertexFuturePertinentChild(theGraph, cutVertex); foundChild = NIL; - while (gp_IsVertex(child)) + while (gp_IsVertex(theGraph, child)) { if (gp_IsSeparatedDFSChild(theGraph, child) && ancestor > gp_GetVertexLowpoint(theGraph, child)) @@ -488,7 +488,7 @@ int _FindUnembeddedEdgeToAncestor(graphP theGraph, int cutVertex, int _FindUnembeddedEdgeToCurVertex(graphP theGraph, int cutVertex, int *pDescendant) { - if (gp_IsArc(gp_GetVertexPertinentEdge(theGraph, cutVertex))) + if (gp_IsArc(theGraph, gp_GetVertexPertinentEdge(theGraph, cutVertex))) { *pDescendant = cutVertex; return TRUE; @@ -522,17 +522,17 @@ int _FindUnembeddedEdgeToSubtree(graphP theGraph, int ancestor, DFS tree root edge of the bicomp rooted by SubtreeRoot. */ SubtreeRoot = gp_IsVirtualVertex(theGraph, SubtreeRoot) - ? gp_GetDFSChildFromRoot(theGraph, SubtreeRoot) + ? gp_GetDFSChildFromBicompRoot(theGraph, SubtreeRoot) : SubtreeRoot; /* Find the least descendant of the cut vertex incident to the ancestor. */ e = gp_GetVertexFwdArcList(theGraph, ancestor); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (gp_GetNeighbor(theGraph, e) >= SubtreeRoot) { - if (gp_IsNotVertex(*pDescendant) || *pDescendant > gp_GetNeighbor(theGraph, e)) + if (gp_IsNotVertex(theGraph, *pDescendant) || *pDescendant > gp_GetNeighbor(theGraph, e)) *pDescendant = gp_GetNeighbor(theGraph, e); } @@ -541,7 +541,7 @@ int _FindUnembeddedEdgeToSubtree(graphP theGraph, int ancestor, e = NIL; } - if (gp_IsNotVertex(*pDescendant)) + if (gp_IsNotVertex(theGraph, *pDescendant)) return FALSE; /* Make sure the identified descendant actually descends from the cut vertex */ @@ -550,7 +550,7 @@ int _FindUnembeddedEdgeToSubtree(graphP theGraph, int ancestor, while (Z != SubtreeRoot) { ZNew = gp_GetVertexParent(theGraph, Z); - if (gp_IsNotVertex(ZNew) || ZNew == Z) + if (gp_IsNotVertex(theGraph, ZNew) || ZNew == Z) return FALSE; Z = ZNew; } @@ -574,7 +574,7 @@ int _MarkPathAlongBicompExtFace(graphP theGraph, int startVert, int endVert) /* Mark the start vertex (and if it is a root copy, mark the parent copy too. */ - gp_SetVertexVisited(theGraph, startVert); + gp_SetVisited(theGraph, startVert); /* For each vertex visited after the start vertex, mark the vertex and the edge used to get there. Stop after marking the ending vertex. */ @@ -589,7 +589,7 @@ int _MarkPathAlongBicompExtFace(graphP theGraph, int startVert, int endVert) gp_SetEdgeVisited(theGraph, ZPrevArc); gp_SetEdgeVisited(theGraph, gp_GetTwinArc(theGraph, ZPrevArc)); - gp_SetVertexVisited(theGraph, Z); + gp_SetVisited(theGraph, Z); } while (Z != endVert); @@ -614,26 +614,28 @@ int _MarkDFSPath(graphP theGraph, int ancestor, int descendant) { int e, parent; - // If we are marking from a root (virtual) vertex upward, then go up to the parent - // copy before starting the loop + // If we are marking from a root (virtual) vertex upward, then go up to the + // non-virtual parent copy before starting the loop if (gp_IsVirtualVertex(theGraph, descendant)) - descendant = gp_GetPrimaryVertexFromRoot(theGraph, descendant); + descendant = gp_GetVertexFromBicompRoot(theGraph, descendant); // Mark the lowest vertex (the one with the highest number). - gp_SetVertexVisited(theGraph, descendant); + gp_SetVisited(theGraph, descendant); // Mark all ancestors of the lowest vertex, and the edges used to reach // them, up to the given ancestor vertex. while (descendant != ancestor) { - if (gp_IsNotVertex(descendant)) + // This loop traverses all vertices from descendant to ancestor, + // including intervening bicomp roots (which are virtual vertices) + if (gp_IsNotAnyTypeVertex(theGraph, descendant)) return NOTOK; - // If we are at a bicomp root, then ascend to its parent copy and - // mark it as visited. + // If we are at a bicomp root, then ascend to its non-virtual + // counterpart, so that can also be marked as visited. if (gp_IsVirtualVertex(theGraph, descendant)) { - parent = gp_GetPrimaryVertexFromRoot(theGraph, descendant); + parent = gp_GetVertexFromBicompRoot(theGraph, descendant); } // If we are on a regular, non-virtual vertex then get the edge to the parent, @@ -643,7 +645,7 @@ int _MarkDFSPath(graphP theGraph, int ancestor, int descendant) // Scan the edges for the one marked as the DFS parent parent = NIL; e = gp_GetFirstArc(theGraph, descendant); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_PARENT) { @@ -654,7 +656,10 @@ int _MarkDFSPath(graphP theGraph, int ancestor, int descendant) } // Sanity check on the data structure integrity - if (gp_IsNotVertex(parent)) + // The found parent may be a non-virtual or a virtual vertex. + // If the latter, then it will be marked visited, and then the + // next iteration of the loop will hop up to its non-virtual + if (gp_IsNotAnyTypeVertex(theGraph, parent)) return NOTOK; // Mark the edge @@ -663,7 +668,7 @@ int _MarkDFSPath(graphP theGraph, int ancestor, int descendant) } // Mark the parent, then hop to the parent and reiterate - gp_SetVertexVisited(theGraph, parent); + gp_SetVisited(theGraph, parent); descendant = parent; } @@ -682,11 +687,11 @@ int _MarkDFSPathsToDescendants(graphP theGraph) theGraph->functions.fpMarkDFSPath(theGraph, IC->y, IC->dy) != OK) return NOTOK; - if (gp_IsVertex(IC->dw)) + if (gp_IsVertex(theGraph, IC->dw)) if (theGraph->functions.fpMarkDFSPath(theGraph, IC->w, IC->dw) != OK) return NOTOK; - if (gp_IsVertex(IC->dz)) + if (gp_IsVertex(theGraph, IC->dz)) if (theGraph->functions.fpMarkDFSPath(theGraph, IC->w, IC->dz) != OK) return NOTOK; @@ -705,11 +710,11 @@ int _AddAndMarkUnembeddedEdges(graphP theGraph) _AddAndMarkEdge(theGraph, IC->uy, IC->dy) != OK) return NOTOK; - if (gp_IsVertex(IC->dw)) + if (gp_IsVertex(theGraph, IC->dw)) if (_AddAndMarkEdge(theGraph, IC->v, IC->dw) != OK) return NOTOK; - if (gp_IsVertex(IC->dz)) + if (gp_IsVertex(theGraph, IC->dz)) if (_AddAndMarkEdge(theGraph, IC->uz, IC->dz) != OK) return NOTOK; @@ -729,10 +734,10 @@ int _AddAndMarkEdge(graphP theGraph, int ancestor, int descendant) /* Mark the edge so it is not deleted */ - gp_SetVertexVisited(theGraph, ancestor); + gp_SetVisited(theGraph, ancestor); gp_SetEdgeVisited(theGraph, gp_GetFirstArc(theGraph, ancestor)); gp_SetEdgeVisited(theGraph, gp_GetFirstArc(theGraph, descendant)); - gp_SetVertexVisited(theGraph, descendant); + gp_SetVisited(theGraph, descendant); return OK; } @@ -752,7 +757,7 @@ void _AddBackEdge(graphP theGraph, int ancestor, int descendant) /* We get the two edge records of the back edge to embed. */ fwdArc = gp_GetVertexFwdArcList(theGraph, ancestor); - while (gp_IsArc(fwdArc)) + while (gp_IsArc(theGraph, fwdArc)) { if (gp_GetNeighbor(theGraph, fwdArc) == descendant) break; @@ -762,7 +767,7 @@ void _AddBackEdge(graphP theGraph, int ancestor, int descendant) fwdArc = NIL; } - if (gp_IsNotArc(fwdArc)) + if (gp_IsNotArc(theGraph, fwdArc)) return; backArc = gp_GetTwinArc(theGraph, fwdArc); @@ -802,31 +807,31 @@ void _AddBackEdge(graphP theGraph, int ancestor, int descendant) int _DeleteUnmarkedVerticesAndEdges(graphP theGraph) { - int v, e; + int v, e, eNext; /* All of the forward and back arcs of all of the edge records were removed from the adjacency lists in the planarity algorithm preprocessing. We now put them back into the adjacency lists (and we do not mark them), so they can be properly deleted below. */ - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) { - while (gp_IsArc(e = gp_GetVertexFwdArcList(theGraph, v))) + while (gp_IsArc(theGraph, e = gp_GetVertexFwdArcList(theGraph, v))) _AddBackEdge(theGraph, v, gp_GetNeighbor(theGraph, e)); } /* Now we delete all unmarked edges. We don't delete vertices from the embedding, but the ones we should delete will become degree zero. */ - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) { e = gp_GetFirstArc(theGraph, v); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { - if (gp_GetEdgeVisited(theGraph, e)) - e = gp_GetNextArc(theGraph, e); - else - e = gp_DeleteEdge(theGraph, e, 0); + eNext = gp_GetNextArc(theGraph, e); + if (!gp_GetEdgeVisited(theGraph, e)) + gp_DeleteEdge(theGraph, e); + e = eNext; } } diff --git a/planarity/c/graphLib/planarityRelated/graphNonplanar.c b/planarity/c/graphLib/planarityRelated/graphNonplanar.c index 8d7ca7d..26931ba 100644 --- a/planarity/c/graphLib/planarityRelated/graphNonplanar.c +++ b/planarity/c/graphLib/planarityRelated/graphNonplanar.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -11,8 +11,8 @@ See the LICENSE.TXT file for licensing information. /* Imported functions */ extern void _InitIsolatorContext(graphP theGraph); -extern int _ClearVisitedFlagsInBicomp(graphP theGraph, int BicompRoot); -extern int _ClearVertexTypeInBicomp(graphP theGraph, int BicompRoot); +extern int _ClearAllVisitedFlagsInBicomp(graphP theGraph, int BicompRoot); +extern int _ClearObstructionMarkInBicomp(graphP theGraph, int BicompRoot); extern int _HideInternalEdges(graphP theGraph, int vertex); extern int _RestoreInternalEdges(graphP theGraph, int stackBottom); @@ -57,15 +57,16 @@ int _ChooseTypeOfNonplanarityMinor(graphP theGraph, int v, int R) then the Walkdown terminated because it couldn't find a viable path along a child bicomp, which is Minor A. */ - if (gp_GetPrimaryVertexFromRoot(theGraph, R) != v) + if (gp_GetVertexFromBicompRoot(theGraph, R) != v) { theGraph->IC.minorType |= MINORTYPE_A; return OK; } /* If W has a pertinent and future pertinent child bicomp, then we've found Minor B */ - - if (gp_IsVertex(gp_GetVertexPertinentRootsList(theGraph, W))) + // NOTE: Each pertinent root is stored as the DFS child with which it is + // associated, so we test gp_IsVertex, not gp_IsVirtualVertex here. + if (gp_IsVertex(theGraph, gp_GetVertexPertinentRootsList(theGraph, W))) { if (gp_GetVertexLowpoint(theGraph, gp_GetVertexLastPertinentRootChild(theGraph, W)) < v) { @@ -86,8 +87,8 @@ int _ChooseTypeOfNonplanarityMinor(graphP theGraph, int v, int R) or P_y closer to R than Y along external face), then we've matched Minor C. */ - if (gp_GetVertexObstructionType(theGraph, Px) == VERTEX_OBSTRUCTIONTYPE_HIGH_RXW || - gp_GetVertexObstructionType(theGraph, Py) == VERTEX_OBSTRUCTIONTYPE_HIGH_RYW) + if (gp_GetObstructionMark(theGraph, Px) == ANYVERTEX_OBSTRUCTIONMARK_HIGH_RXW || + gp_GetObstructionMark(theGraph, Py) == ANYVERTEX_OBSTRUCTIONMARK_HIGH_RYW) { theGraph->IC.minorType |= MINORTYPE_C; return OK; @@ -99,7 +100,7 @@ int _ChooseTypeOfNonplanarityMinor(graphP theGraph, int v, int R) if (_MarkZtoRPath(theGraph) != OK) return NOTOK; - if (gp_IsVertex(theGraph->IC.z)) + if (gp_IsVertex(theGraph, theGraph->IC.z)) { theGraph->IC.minorType |= MINORTYPE_D; return OK; @@ -109,7 +110,7 @@ int _ChooseTypeOfNonplanarityMinor(graphP theGraph, int v, int R) below the points of attachment of the X-Y path */ Z = _FindFuturePertinenceBelowXYPath(theGraph); - if (gp_IsVertex(Z)) + if (gp_IsVertex(theGraph, Z)) { theGraph->IC.z = Z; theGraph->IC.minorType |= MINORTYPE_E; @@ -171,7 +172,7 @@ int _InitializeNonplanarityContext(graphP theGraph, int v, int R) return NOTOK; } - if (_ClearVisitedFlagsInBicomp(theGraph, R) != OK) + if (_ClearAllVisitedFlagsInBicomp(theGraph, R) != OK) return NOTOK; // Now we find the active vertices along both external face paths @@ -184,8 +185,14 @@ int _InitializeNonplanarityContext(graphP theGraph, int v, int R) // Now we can classify the vertices along the external face of the bicomp // rooted at R as 'high RXW', 'low RXW', 'high RXY', 'low RXY' - if (_SetVertexTypesForMarkingXYPath(theGraph) != OK) - return NOTOK; + // NOTE: We do not need to set up for xy path identification when we + // have minor A, which occurs when the parent copy vertex of + // bicomp root R is a descendant of v (not v). + if (gp_GetVertexFromBicompRoot(theGraph, R) == v) + { + if (_SetVertexTypesForMarkingXYPath(theGraph) != OK) + return NOTOK; + } // All work is done, so return success return OK; @@ -323,34 +330,37 @@ int _SetVertexTypesForMarkingXYPath(graphP theGraph) W = theGraph->IC.w; // Ensure basic preconditions of this routine are met - if (gp_IsNotVertex(R) || gp_IsNotVertex(X) || gp_IsNotVertex(Y) || gp_IsNotVertex(W)) + if (gp_IsNotVirtualVertex(theGraph, R) || gp_IsNotVertex(theGraph, X) || + gp_IsNotVertex(theGraph, Y) || gp_IsNotVertex(theGraph, W)) + { return NOTOK; + } // Clear the type member of each vertex in the bicomp - if (_ClearVertexTypeInBicomp(theGraph, R) != OK) + if (_ClearObstructionMarkInBicomp(theGraph, R) != OK) return NOTOK; // Traverse from R to W in the X direction ZPrevLink = 1; Z = _GetNeighborOnExtFace(theGraph, R, &ZPrevLink); - ZType = VERTEX_OBSTRUCTIONTYPE_HIGH_RXW; + ZType = ANYVERTEX_OBSTRUCTIONMARK_HIGH_RXW; while (Z != W) { if (Z == X) - ZType = VERTEX_OBSTRUCTIONTYPE_LOW_RXW; - gp_ResetVertexObstructionType(theGraph, Z, ZType); + ZType = ANYVERTEX_OBSTRUCTIONMARK_LOW_RXW; + gp_ResetObstructionMark(theGraph, Z, ZType); Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); } // Traverse from R to W in the Y direction ZPrevLink = 0; Z = _GetNeighborOnExtFace(theGraph, R, &ZPrevLink); - ZType = VERTEX_OBSTRUCTIONTYPE_HIGH_RYW; + ZType = ANYVERTEX_OBSTRUCTIONMARK_HIGH_RYW; while (Z != W) { if (Z == Y) - ZType = VERTEX_OBSTRUCTIONTYPE_LOW_RYW; - gp_ResetVertexObstructionType(theGraph, Z, ZType); + ZType = ANYVERTEX_OBSTRUCTIONMARK_LOW_RYW; + gp_ResetObstructionMark(theGraph, Z, ZType); Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); } @@ -388,7 +398,7 @@ int _PopAndUnmarkVerticesAndEdges(graphP theGraph, int Z, int stackBottom) sp_Pop(theGraph->theStack, e); // Now unmark the vertex and edge (i.e. revert to "unvisited") - gp_ClearVertexVisited(theGraph, V); + gp_ClearVisited(theGraph, V); gp_ClearEdgeVisited(theGraph, e); gp_ClearEdgeVisited(theGraph, gp_GetTwinArc(theGraph, e)); } @@ -594,8 +604,8 @@ int _MarkClosestXYPath(graphP theGraph, int targetVertex) // the targetVertex on the RXW side of the bicomp) e = targetVertex == R ? gp_GetLastArc(theGraph, R) : gp_GetFirstArc(theGraph, W); - while (gp_GetVertexObstructionType(theGraph, Z) != VERTEX_OBSTRUCTIONTYPE_HIGH_RYW && - gp_GetVertexObstructionType(theGraph, Z) != VERTEX_OBSTRUCTIONTYPE_LOW_RYW) + while (gp_GetObstructionMark(theGraph, Z) != ANYVERTEX_OBSTRUCTIONMARK_HIGH_RYW && + gp_GetObstructionMark(theGraph, Z) != ANYVERTEX_OBSTRUCTIONMARK_LOW_RYW) { /* Advance e and Z along the proper face containing the targetVertex */ @@ -612,7 +622,7 @@ int _MarkClosestXYPath(graphP theGraph, int targetVertex) /* If Z is already visited, then pop everything since the last time we visited Z because its all part of a separable component. */ - if (gp_GetVertexVisited(theGraph, Z)) + if (gp_GetVisited(theGraph, Z)) { if (_PopAndUnmarkVerticesAndEdges(theGraph, Z, stackBottom2) != OK) return NOTOK; @@ -638,8 +648,8 @@ int _MarkClosestXYPath(graphP theGraph, int targetVertex) all the vertices we visited so far because they're not part of the obstructing path */ - if (gp_GetVertexObstructionType(theGraph, Z) == VERTEX_OBSTRUCTIONTYPE_HIGH_RXW || - gp_GetVertexObstructionType(theGraph, Z) == VERTEX_OBSTRUCTIONTYPE_LOW_RXW) + if (gp_GetObstructionMark(theGraph, Z) == ANYVERTEX_OBSTRUCTIONMARK_HIGH_RXW || + gp_GetObstructionMark(theGraph, Z) == ANYVERTEX_OBSTRUCTIONMARK_LOW_RXW) { theGraph->IC.px = Z; if (_PopAndUnmarkVerticesAndEdges(theGraph, NIL, stackBottom2) != OK) @@ -655,7 +665,7 @@ int _MarkClosestXYPath(graphP theGraph, int targetVertex) /* Mark the vertex Z as visited as well as its edge of entry (except the entry edge for P_x).*/ - gp_SetVertexVisited(theGraph, Z); + gp_SetVisited(theGraph, Z); if (Z != theGraph->IC.px) { gp_SetEdgeVisited(theGraph, e); @@ -666,8 +676,8 @@ int _MarkClosestXYPath(graphP theGraph, int targetVertex) identifying the closest X-Y path, so we record the point of attachment and break the loop. */ - if (gp_GetVertexObstructionType(theGraph, Z) == VERTEX_OBSTRUCTIONTYPE_HIGH_RYW || - gp_GetVertexObstructionType(theGraph, Z) == VERTEX_OBSTRUCTIONTYPE_LOW_RYW) + if (gp_GetObstructionMark(theGraph, Z) == ANYVERTEX_OBSTRUCTIONMARK_HIGH_RYW || + gp_GetObstructionMark(theGraph, Z) == ANYVERTEX_OBSTRUCTIONMARK_LOW_RYW) { theGraph->IC.py = Z; break; @@ -685,7 +695,7 @@ int _MarkClosestXYPath(graphP theGraph, int targetVertex) /* Return the result */ - if (!gp_IsVertex(theGraph->IC.py)) + if (!gp_IsVertex(theGraph, theGraph->IC.py)) theGraph->IC.px = NIL; return OK; @@ -776,7 +786,7 @@ int _MarkZtoRPath(graphP theGraph) /* If we ever encounter a non-internal vertex (other than the root R), then corruption has occurred, so we return NOTOK */ - if (gp_GetVertexObstructionType(theGraph, Z) != VERTEX_OBSTRUCTIONTYPE_UNKNOWN) + if (gp_GetObstructionMark(theGraph, Z) != ANYVERTEX_OBSTRUCTIONMARK_UNMARKED) return NOTOK; /* Go to the next vertex indicated by ZNextArc */ @@ -787,7 +797,7 @@ int _MarkZtoRPath(graphP theGraph) gp_SetEdgeVisited(theGraph, ZNextArc); gp_SetEdgeVisited(theGraph, ZPrevArc); - gp_SetVertexVisited(theGraph, Z); + gp_SetVisited(theGraph, Z); /* Go to the next edge in the proper face */ diff --git a/planarity/c/graphLib/planarityRelated/graphOuterplanarObstruction.c b/planarity/c/graphLib/planarityRelated/graphOuterplanarObstruction.c index 0f4b4e6..8bedcbf 100644 --- a/planarity/c/graphLib/planarityRelated/graphOuterplanarObstruction.c +++ b/planarity/c/graphLib/planarityRelated/graphOuterplanarObstruction.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -8,7 +8,7 @@ See the LICENSE.TXT file for licensing information. /* Imported functions */ -extern void _ClearVisitedFlags(graphP); +extern void _ClearAllVisitedFlagsInGraph(graphP); extern int _JoinBicomps(graphP theGraph); @@ -58,7 +58,7 @@ int _ChooseTypeOfNonOuterplanarityMinor(graphP theGraph, int v, int R) // If the root copy is not a root copy of the current vertex v, // then the Walkdown terminated on a descendant bicomp, which is Minor A. - if (gp_GetPrimaryVertexFromRoot(theGraph, R) != v) + if (gp_GetVertexFromBicompRoot(theGraph, R) != v) { theGraph->IC.minorType |= MINORTYPE_A; return OK; @@ -67,7 +67,9 @@ int _ChooseTypeOfNonOuterplanarityMinor(graphP theGraph, int v, int R) // If W has a pertinent child bicomp, then we've found Minor B. // Notice this is different from planarity, in which minor B is indicated // only if the pertinent child bicomp is also future pertinent. - if (gp_IsVertex(gp_GetVertexPertinentRootsList(theGraph, W))) + // NOTE: Each pertinent root is stored as the DFS child with which it is + // associated, so we test gp_IsVertex, not gp_IsVirtualVertex here. + if (gp_IsVertex(theGraph, gp_GetVertexPertinentRootsList(theGraph, W))) { theGraph->IC.minorType |= MINORTYPE_B; return OK; @@ -90,7 +92,7 @@ int _IsolateOuterplanarObstruction(graphP theGraph, int v, int R) flags, set=keep edge/vertex and clear=omit. Here we initialize to omit all, then we subsequently set visited on all edges and vertices in the homeomorph. */ - _ClearVisitedFlags(theGraph); + _ClearAllVisitedFlagsInGraph(theGraph); /* Next we determineg which of the non-outerplanarity Minors was encountered and the principal bicomp on which the isolator will focus attention. */ diff --git a/planarity/c/graphLib/planarityRelated/graphTests.c b/planarity/c/graphLib/planarityRelated/graphTests.c index efb4dc8..b6dfe4e 100644 --- a/planarity/c/graphLib/planarityRelated/graphTests.c +++ b/planarity/c/graphLib/planarityRelated/graphTests.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1997-2025, John M. Boyer +Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ @@ -9,7 +9,7 @@ See the LICENSE.TXT file for licensing information. #include "../graph.h" #include "../lowLevelUtils/stack.h" -extern void _ClearVertexVisitedFlags(graphP theGraph, int); +extern void _ClearAnyTypeVertexVisitedFlags(graphP theGraph, int); /* Private function declarations (some exported to system) */ @@ -182,7 +182,7 @@ int _CheckEmbeddingFacialIntegrity(graphP theGraph) /* Push all arcs and set them to unvisited */ - EsizeOccupied = gp_EdgeInUseIndexBound(theGraph); + EsizeOccupied = gp_EdgeInUseArraySize(theGraph); for (e = gp_GetFirstEdge(theGraph); e < EsizeOccupied; e += 2) { // Except skip edge holes @@ -230,7 +230,7 @@ int _CheckEmbeddingFacialIntegrity(graphP theGraph) so we do not subtract one. */ connectedComponents = 0; - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) { if (gp_IsDFSTreeRoot(theGraph, v)) { @@ -268,11 +268,11 @@ int _CheckAllVerticesOnExternalFace(graphP theGraph) int v; // Mark all vertices unvisited - _ClearVertexVisitedFlags(theGraph, FALSE); + _ClearAnyTypeVertexVisitedFlags(theGraph, FALSE); // For each connected component, walk its external face and // mark the vertices as visited - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) { if (gp_IsDFSTreeRoot(theGraph, v)) _MarkExternalFaceVertices(theGraph, v); @@ -280,8 +280,8 @@ int _CheckAllVerticesOnExternalFace(graphP theGraph) // If any vertex is unvisited, then the embedding is not an outerplanar // embedding, so we return NOTOK - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) - if (!gp_GetVertexVisited(theGraph, v)) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) + if (!gp_GetVisited(theGraph, v)) return NOTOK; // All vertices were found on external faces of the connected components @@ -310,16 +310,16 @@ void _MarkExternalFaceVertices(graphP theGraph, int startVertex) int eTwin; // Handle the case of an isolated vertex - if (gp_IsNotArc(e)) + if (gp_IsNotArc(theGraph, e)) { - gp_SetVertexVisited(theGraph, startVertex); + gp_SetVisited(theGraph, startVertex); return; } // Process a non-trivial connected component do { - gp_SetVertexVisited(theGraph, nextVertex); + gp_SetVisited(theGraph, nextVertex); // The arc out of the vertex just visited points to the next vertex nextVertex = gp_GetNeighbor(theGraph, e); @@ -424,7 +424,7 @@ int _getImageVertices(graphP theGraph, int *degrees, int maxDegree, imageVertPos = 0; - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) { degree = gp_GetVertexDegree(theGraph, v); if (degree == 1) @@ -481,7 +481,7 @@ int _TestForCompleteGraphObstruction(graphP theGraph, int numVerts, return FALSE; // We clear all the vertex visited flags - _ClearVertexVisitedFlags(theGraph, FALSE); + _ClearAnyTypeVertexVisitedFlags(theGraph, FALSE); // For each pair of image vertices, we test that there is a path // between the two vertices. If so, the visited flags of the @@ -497,8 +497,8 @@ int _TestForCompleteGraphObstruction(graphP theGraph, int numVerts, // The visited flags should have marked only degree two vertices, // so for every marked vertex, we subtract one from the count of // the degree two vertices. - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) - if (gp_GetVertexVisited(theGraph, v)) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) + if (gp_GetVisited(theGraph, v)) degrees[2]--; /* If every degree 2 vertex is used in a path between image @@ -562,7 +562,7 @@ int _TestForK33GraphObstruction(graphP theGraph, int *degrees, int *imageVerts) /* Now test the paths between each of the first three vertices and each of the last three vertices */ - _ClearVertexVisitedFlags(theGraph, FALSE); + _ClearAnyTypeVertexVisitedFlags(theGraph, FALSE); for (imageVertPos = 0; imageVertPos < 3; imageVertPos++) for (K = 3; K < 6; K++) @@ -570,8 +570,8 @@ int _TestForK33GraphObstruction(graphP theGraph, int *degrees, int *imageVerts) imageVerts[K]) != TRUE) return FALSE; - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) - if (gp_GetVertexVisited(theGraph, v)) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) + if (gp_GetVisited(theGraph, v)) degrees[2]--; /* If every degree 2 vertex is used in a path between image @@ -674,7 +674,7 @@ int _TestForK23GraphObstruction(graphP theGraph, int *degrees, int *imageVerts) // and hence must not be adjacent. e = gp_GetFirstArc(theGraph, imageVerts[0]); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { imageVerts[imageVertPos] = gp_GetNeighbor(theGraph, e); if (imageVerts[imageVertPos] == imageVerts[1]) @@ -688,7 +688,7 @@ int _TestForK23GraphObstruction(graphP theGraph, int *degrees, int *imageVerts) Now test the paths between each of the degree 2 image vertices and imageVerts[1]. */ - _ClearVertexVisitedFlags(theGraph, FALSE); + _ClearAnyTypeVertexVisitedFlags(theGraph, FALSE); for (imageVertPos = 2; imageVertPos < 5; imageVertPos++) { @@ -696,11 +696,11 @@ int _TestForK23GraphObstruction(graphP theGraph, int *degrees, int *imageVerts) imageVerts[1]) != TRUE) return FALSE; - gp_SetVertexVisited(theGraph, imageVerts[imageVertPos]); + gp_SetVisited(theGraph, imageVerts[imageVertPos]); } - for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++) - if (gp_GetVertexVisited(theGraph, v)) + for (v = gp_GetFirstVertex(theGraph); gp_VertexInRangeAscending(theGraph, v); v++) + if (gp_GetVisited(theGraph, v)) degrees[2]--; /* If every degree 2 vertex is used in a path between the @@ -777,7 +777,7 @@ int _TestPath(graphP theGraph, int U, int V) { int e = gp_GetFirstArc(theGraph, U); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { if (_TryPath(theGraph, e, V) == OK) { @@ -809,8 +809,8 @@ int _TryPath(graphP theGraph, int e, int V) nextVertex = gp_GetNeighbor(theGraph, e); // while nextVertex is strictly degree 2 - while (gp_IsArc(gp_GetFirstArc(theGraph, nextVertex)) && - gp_IsArc(gp_GetLastArc(theGraph, nextVertex)) && + while (gp_IsArc(theGraph, gp_GetFirstArc(theGraph, nextVertex)) && + gp_IsArc(theGraph, gp_GetLastArc(theGraph, nextVertex)) && gp_GetNextArc(theGraph, gp_GetFirstArc(theGraph, nextVertex)) == gp_GetLastArc(theGraph, nextVertex)) { eTwin = gp_GetTwinArc(theGraph, e); @@ -838,11 +838,11 @@ void _MarkPath(graphP theGraph, int e) nextVertex = gp_GetNeighbor(theGraph, e); // while nextVertex is strictly degree 2 - while (gp_IsArc(gp_GetFirstArc(theGraph, nextVertex)) && - gp_IsArc(gp_GetLastArc(theGraph, nextVertex)) && + while (gp_IsArc(theGraph, gp_GetFirstArc(theGraph, nextVertex)) && + gp_IsArc(theGraph, gp_GetLastArc(theGraph, nextVertex)) && gp_GetNextArc(theGraph, gp_GetFirstArc(theGraph, nextVertex)) == gp_GetLastArc(theGraph, nextVertex)) { - gp_SetVertexVisited(theGraph, nextVertex); + gp_SetVisited(theGraph, nextVertex); eTwin = gp_GetTwinArc(theGraph, e); e = gp_GetFirstArc(theGraph, nextVertex); @@ -894,24 +894,24 @@ int _TestSubgraph(graphP theSubgraph, graphP theGraph) /* We clear all visitation flags */ - _ClearVertexVisitedFlags(theGraph, FALSE); + _ClearAnyTypeVertexVisitedFlags(theGraph, FALSE); /* For each vertex... */ - for (v = gp_GetFirstVertex(theSubgraph), degreeCount = 0; gp_VertexInRange(theSubgraph, v); v++) + for (v = gp_GetFirstVertex(theSubgraph), degreeCount = 0; gp_VertexInRangeAscending(theSubgraph, v); v++) { /* For each neighbor w in the adjacency list of vertex v in the subgraph, set the visited flag in w in the graph */ e = gp_GetFirstArc(theSubgraph, v); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { - if (gp_IsNotVertex(gp_GetNeighbor(theSubgraph, e))) + if (gp_IsNotVertex(theSubgraph, gp_GetNeighbor(theSubgraph, e))) { Result = FALSE; break; } degreeCount++; - gp_SetVertexVisited(theGraph, gp_GetNeighbor(theSubgraph, e)); + gp_SetVisited(theGraph, gp_GetNeighbor(theSubgraph, e)); e = gp_GetNextArc(theSubgraph, e); } @@ -922,14 +922,14 @@ int _TestSubgraph(graphP theSubgraph, graphP theGraph) clear the visited flag in w in the graph */ e = gp_GetFirstArc(theGraph, v); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { - if (gp_IsNotVertex(gp_GetNeighbor(theGraph, e))) + if (gp_IsNotVertex(theGraph, gp_GetNeighbor(theGraph, e))) { Result = FALSE; break; } - gp_ClearVertexVisited(theGraph, gp_GetNeighbor(theGraph, e)); + gp_ClearVisited(theGraph, gp_GetNeighbor(theGraph, e)); e = gp_GetNextArc(theGraph, e); } @@ -941,9 +941,9 @@ int _TestSubgraph(graphP theSubgraph, graphP theGraph) would incorrectly contain an adjacency not contained in the ("super") graph) */ e = gp_GetFirstArc(theSubgraph, v); - while (gp_IsArc(e)) + while (gp_IsArc(theGraph, e)) { - if (gp_GetVertexVisited(theGraph, gp_GetNeighbor(theSubgraph, e))) + if (gp_GetVisited(theGraph, gp_GetNeighbor(theSubgraph, e))) { Result = FALSE; break; diff --git a/planarity/classic/cplanarity.pxd b/planarity/classic/cplanarity.pxd index 6b59c1b..8c2cfe8 100644 --- a/planarity/classic/cplanarity.pxd +++ b/planarity/classic/cplanarity.pxd @@ -12,7 +12,7 @@ cdef extern from "../c/graphLib/graphStructures.h": cdef int gp_GetLastVertex(graphP theGraph) cdef int gp_GetFirstArc(graphP theGraph, int v) cdef int gp_GetLastArc(graphP theGraph, int v) - cdef int gp_IsArc(int v) + cdef int gp_IsArc(graphP theGraph, int v) cdef int gp_GetNeighbor(graphP theGraph, int v) cdef int gp_GetPrevArc(graphP theGraph, int v) cdef int gp_GetNextArc(graphP theGraph, int v) diff --git a/planarity/classic/planarity.c b/planarity/classic/planarity.c index c5fbb3c..d2653f2 100644 --- a/planarity/classic/planarity.c +++ b/planarity/classic/planarity.c @@ -5242,7 +5242,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct * last=cplanarity.gp_GetLastVertex(self.theGraph)+1 * for n in range(first,last): # <<<<<<<<<<<<<< * e=cplanarity.gp_GetFirstArc(self.theGraph,n) - * isarc=cplanarity.gp_IsArc(e) + * isarc=cplanarity.gp_IsArc(self.theGraph, e) */ __pyx_t_2 = __pyx_v_last; __pyx_t_3 = __pyx_t_2; @@ -5253,7 +5253,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct * last=cplanarity.gp_GetLastVertex(self.theGraph)+1 * for n in range(first,last): * e=cplanarity.gp_GetFirstArc(self.theGraph,n) # <<<<<<<<<<<<<< - * isarc=cplanarity.gp_IsArc(e) + * isarc=cplanarity.gp_IsArc(self.theGraph, e) * while isarc > 0: */ __pyx_v_e = gp_GetFirstArc(__pyx_v_self->theGraph, __pyx_v_n); @@ -5261,15 +5261,15 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct /* "planarity/classic/planarity.pyx":139 * for n in range(first,last): * e=cplanarity.gp_GetFirstArc(self.theGraph,n) - * isarc=cplanarity.gp_IsArc(e) # <<<<<<<<<<<<<< + * isarc=cplanarity.gp_IsArc(self.theGraph, e) # <<<<<<<<<<<<<< * while isarc > 0: * nbr=cplanarity.gp_GetNeighbor(self.theGraph,e) */ - __pyx_v_isarc = gp_IsArc(__pyx_v_e); + __pyx_v_isarc = gp_IsArc(__pyx_v_self->theGraph, __pyx_v_e); /* "planarity/classic/planarity.pyx":140 * e=cplanarity.gp_GetFirstArc(self.theGraph,n) - * isarc=cplanarity.gp_IsArc(e) + * isarc=cplanarity.gp_IsArc(self.theGraph, e) * while isarc > 0: # <<<<<<<<<<<<<< * nbr=cplanarity.gp_GetNeighbor(self.theGraph,e) * if nbr > n: @@ -5279,7 +5279,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct if (!__pyx_t_5) break; /* "planarity/classic/planarity.pyx":141 - * isarc=cplanarity.gp_IsArc(e) + * isarc=cplanarity.gp_IsArc(self.theGraph, e) * while isarc > 0: * nbr=cplanarity.gp_GetNeighbor(self.theGraph,e) # <<<<<<<<<<<<<< * if nbr > n: @@ -5442,7 +5442,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct * else: * edges.append((r[n],r[nbr])) # <<<<<<<<<<<<<< * e=cplanarity.gp_GetNextArc(self.theGraph,e) - * isarc=cplanarity.gp_IsArc(e) + * isarc=cplanarity.gp_IsArc(self.theGraph, e) */ /*else*/ { if (unlikely(__pyx_v_r == Py_None)) { @@ -5489,7 +5489,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct * else: * edges.append((r[n],r[nbr])) * e=cplanarity.gp_GetNextArc(self.theGraph,e) # <<<<<<<<<<<<<< - * isarc=cplanarity.gp_IsArc(e) + * isarc=cplanarity.gp_IsArc(self.theGraph, e) * return edges */ __pyx_v_e = gp_GetNextArc(__pyx_v_self->theGraph, __pyx_v_e); @@ -5497,17 +5497,17 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct /* "planarity/classic/planarity.pyx":153 * edges.append((r[n],r[nbr])) * e=cplanarity.gp_GetNextArc(self.theGraph,e) - * isarc=cplanarity.gp_IsArc(e) # <<<<<<<<<<<<<< + * isarc=cplanarity.gp_IsArc(self.theGraph, e) # <<<<<<<<<<<<<< * return edges * */ - __pyx_v_isarc = gp_IsArc(__pyx_v_e); + __pyx_v_isarc = gp_IsArc(__pyx_v_self->theGraph, __pyx_v_e); } } /* "planarity/classic/planarity.pyx":154 * e=cplanarity.gp_GetNextArc(self.theGraph,e) - * isarc=cplanarity.gp_IsArc(e) + * isarc=cplanarity.gp_IsArc(self.theGraph, e) * return edges # <<<<<<<<<<<<<< * * @@ -6993,33 +6993,33 @@ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); { - const struct { const unsigned int length: 9; } index[] = {{1},{18},{1},{7},{6},{2},{23},{9},{25},{31},{30},{39},{37},{28},{65},{14},{13},{6},{24},{26},{12},{12},{23},{19},{16},{23},{14},{12},{12},{20},{5},{18},{5},{18},{7},{4},{7},{1},{5},{16},{12},{6},{3},{6},{5},{8},{12},{5},{13},{9},{5},{5},{4},{16},{4},{8},{7},{10},{1},{8},{3},{5},{4},{27},{3},{3},{8},{11},{12},{1},{10},{17},{13},{1},{4},{12},{10},{12},{19},{5},{6},{8},{6},{6},{4},{8},{5},{3},{39},{47},{30},{27},{73},{56},{9},{9},{182},{269}}; - #if (CYTHON_COMPRESS_STRINGS) == 3 && __PYX_LIMITED_VERSION_HEX >= 0x030e0000 /* compression: zstd (1031 bytes) */ -const char* const cstring = "(\265/\375`\350\005\355\037\000\326s\2577 \225\016@\264\005\n\211\004\302\365\245qf\272\372\330\002j\222Z\021IvYS\t#\262B\034\323\321\37756\340\272\306\315G\033\377\212\352#\270ct\024kd\014l\t\232\000\222\000\254\000\266\216\237\315s\262hX^fM7\323\305\320\344t5,)\266\3461\324[\237\200\261zE.\207/nW\333\343\n9\034\362l\032\rGw\266?8\254\234uaZ],\317f\275@\253\271\035b\216G\244\031\306\331\240\013\322\273/\276\\\270g4\177<\225\356\315\372>\312]\372\002\242\211,\217z\265\246`\365`\3450g\313\231\320\366\315\024SP\374\364\345,\354\263\034hA\220f*r0|s\210a\267\302\260\265\240\213\352\373\251X\221\266\271=\212\370rx\026\342\030\306\351\010\243\335s\3521\317\r\216\364e?='\220\235\031\244\243L\234S\333MsM\232\250CQ\014EVv\371P\014\216_8'\276\324\207\202\232fc\332\247f\252\357\324wN\330\254x|\315\271u\276\257\017[\373\205\025[K7\3756\016k\254R\227\2554\357\211\357\004+\317\246\242K[|\367\030\346\260\262\302[1M\323\227\255\331@vf\356zY\200hv\337<\373B,\212\324g\336\230\236\205\233\3461\246\357\374\254\313G\337[5\335t\353m\365\234u\006~\343\341\366P*\242$C\351\217\270\212t\363\310\215\032\001\351\217\206Z\344\236\221@^\255\353H\242\021\321\216-e\033\331H<.a\272\231\310\006\212\004\224\277\351]/\341_\306;\310\221\222T\312\274\007\304\r\202\325\361W\245P\017\351\253\356\300\0350\310\257v \253!\224F\036\205\027\220,25S\251\250\033\222q\3129\310\004SQ\253[\356\361\0372\304\313p\010\022e\360[\244\202\351\243xP\313\357N\373\005\303'\031\371^\231*G%\255c\234n'\323\367x\005\027\252\205\324\nJ\277\033\022o\020\316t\246\355\010\322\037\273\351'\006\262\032B\351\257<\312\017t\356\364Q\266\240\031\036q\372^\321\252\304\361]\000\355+=\207#\343\257l\0005%\314\2632\\\037\245\213@\347\"~\327)\372\010\207P\251R\231\014\351l\032\345\347=\037\362\211\323_q\000~A\273\327_x\204\t\306\223\274\254#p\325(\240\257\360\034\013\356\267\312\004\033\017\353\027\334G\225\331S\017\342]:\251\313\270\000W\245~\307)\370\010\251p\372\036\271p\372?$%\027\310\026Jk\0265\002\233\254\324\361)?\362\031\r7\231\017""\361+\257\241\272\251J\257\024\341\370\035\034\177T\262\370V\200\217\2501\241RJ\251\221\021\031)L\212\031\003 \204\030\246\356:!9E45#)H\261>s\310\025\307e\345B\352\362\356h\344\366\275\026\214\255,\231\004(\030N\235N\000tb\274\374\026\tz\325\005\270i\"\274S/\267\300\230^s{@\276\246\352 \273\327\314\235~b\267\017\345\204}(j\215\264\014\345>\346\223\026Z\207\036\301\362s\2710\204\223\304\375\324\315\264\003\240\260B\354f\010\200\"\261\237\022\366\003`u\211\2209X\243\035\325>\217\025d\375\302\0203\254kLWm\236-\331r&C\320|B\375\245\343j"; - PyObject *data = __Pyx_DecompressString(cstring, 1031, 3); + const struct { const unsigned int length: 9; } index[] = {{1},{18},{1},{7},{6},{2},{23},{9},{25},{31},{30},{39},{37},{28},{65},{14},{13},{6},{24},{26},{12},{12},{23},{19},{16},{23},{14},{12},{12},{20},{5},{18},{5},{18},{7},{4},{7},{1},{5},{16},{12},{6},{3},{6},{5},{8},{12},{5},{13},{9},{5},{5},{4},{16},{4},{8},{7},{10},{1},{8},{3},{5},{4},{27},{3},{3},{8},{11},{12},{1},{10},{17},{13},{1},{4},{12},{10},{12},{19},{5},{6},{8},{6},{6},{4},{8},{5},{3},{39},{47},{30},{27},{73},{56},{9},{9},{182},{277}}; + #if (CYTHON_COMPRESS_STRINGS) == 3 && __PYX_LIMITED_VERSION_HEX >= 0x030e0000 /* compression: zstd (1038 bytes) */ +const char* const cstring = "(\265/\375`\360\005% \0006\264\2607\000\265\033<\356\273_\377\377\375\373u\337~\335\267\337\372W\275\237+\022\333\311\377\312f2Y\310\016\010-\202\306\316\217\014\030\242K\302`\000\246\nH\020\321\202\004\360hy\232\000\222\000\255\000\364Z\022\274\232R\225L\253\205\316x1\336\213\314\2157\323B\271V\223\342\346\333$\224Y\3443\032r4\317\362)\257\201\312\241\316\357\014\341\370\035\034?\200\220\2501\241RJ\261\tFd\2440)f\014 \204\030\246\356:!9E45#)H\262\317\034\314\025\343J\3472\352\362\3564\"\375\177\013V\236\362 1z|\364\255n>\337\345\t\201\027\265\316\215^D\021\335,\200\347\324\234m%\267\370:kO_\216~$$\273\205b\264u_\037r\204\365\363w2\227/h\247\0074sT\004A$\260\217e\375'\331i \002\330 D\323=\034\370\302)r\243\273\353\036\217P\242\335\235\242\025,\276\270@\245\246\276\273i\245\235\035\313\317\355\022q\301G\376##_\303\211@\016\202g\322L\272/Bf\017d\372IC\002aM\303A\201Z\272\302j\256\234\024\033\377>\255,\231\004\024\014\242N\017\000\0161~~\333\004\315\352\002\3344\021\336\251\227[`L\257\271= _Su\220\335k\346N?\261\333\207r\302>\024\265FZ\206r\037\363I\013\255C\217`\371\271\\\030\302I\342~\352f\332\001PX!v3\004@\221\330O\t\373\001\260\272D\310\034\254\321N\325>\217\025d\335\205O\014\260\2161\265\265)\266T\313\231\001A\363\t\365\227\216\253\001"; + PyObject *data = __Pyx_DecompressString(cstring, 1038, 3); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif - #elif (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (1119 bytes) */ -const char* const cstring = "BZh91AY&SY\371%7L\000\000\206\177\377|\377\377\377}\337\276\367\266\267~\230\277\377\377\370@@@@@@@@\000@@@@\000P\003\336<\355Z\305R\275\267\207\004\251\252M\000\003OD\323h\201\246\232\000\321\247\251\240h= 2\003OP\323M\007\251\265\003OSOH\022\246\201\032\024\360I\341\023S\332\246G\251\240\000\000\000\000\000\000\320\000\000\310!\030\232T3Q\352h\000\003L\2152\000\000\014\203M\003@\000\000\003@\006\205M\350\211\036\24046\210\032\000\320\001\240\003F\200\000\014\2004\031\031\006\200J\010$\304#S\312zOj\233S\305\000\014\200\000\000\000\000\000\000\003F\231;a\250\177\017\356\257\355\215]RNHv\204\rma\334\224\236\"\032\352\210\212\242\212\215\236g(k\301\"\250\226\240#(\233\025(t\212\204c\206\251\\Q\253\266\354\364L\036\2261*\300\211\031\301+#2\241q\250\345\265\201p\215RJ\3420\246f\264\243\254\206jI\010N\227C\264S\237\341?\324\350\272L5u\304j2\223^\007\220\375\250\214\005\224\021\202IT\376\022\240\306D\207h1\304\002\251\334\220\2404\264\222\234!,E/\310\350E\0269\320T\242\273\025j\376L\271\021\001\n\257\020aX\321\243\025AP\341\327\307\333\027*\214\027Y\351\326\366\311<\346\231\235q\203%Rv\030\365\371n\323H\245\317p$\310\034;M\t?\242-\211\217\276\2464[S[\346\375T\204\363\332\026\320\340[V\330Q\272c\243\223M\217\201\001\205\363\0069Vk\242\215#\013\006fu\212\253_v[\352`\361m\336oL\347\013\032A\246b\032\330\2662\023Ua\232\021\007\215\343\263G\r\366\322T\254/\227\331\367Q\342\224@\010\212\000\r\016\020\250\372\001?\305x-\322\226\357E\005\264T]\204\334,,\023\032l\314\246E\035\210\230\251\330\006\227\035VY\222\006!\221\321\214#3@{\233\025\336\214\317\327\227A\364\306\300X\027_-LBA\302\261\374\226\371`0\"\272\3746,0\243\025,C6E\240\305\242%i\260\341\251 RYUH\353\302u\331\265E\350&B\010\221L\311\030\214\227RRF\310\301\214\313\0055\006hoV\374\255\226\351Z[$\324V$ 2\207[\034\244\2613Y\211\021+4\024F\242\340\355\234Cx\365`\023S\031\226\233\233\003;)\250\2276y\264\255\232\021\244i\004PM\262mjG\020d'P\021\036\313\351BZ\231,\027\322kv\245\220:3^2\205Pf\200\364\254\220\005\217U\312x*\224""\376\221J\334\325\342\240\216q\367\214uQ\032\230\3240\266\370=\243V\\\321d\206i/}\226b\000t\205\353K\204B\214\366\344\333\254jI\t\013j\236X\255\316\304\257f\200\241\223r\220\3359\024uz\212\320\243\013~\261\250\"\232\006\000XH\333\014QCh\010(\310\232N4\361#g\250`L\345\013q\243c\0338N\323\t\314qV\223\307)B\031B\014`\372\022\242\333\262\252\324\240\013\266>\235\344\"\343\204\304\"\264\340\201-\021\261\220A\245\0242\016N\252\202\250\023\002Kf\217&\300\317Y\346\257j`\277\225\213\267\364QoS\021S\003\270\353\"A\025T\200o\345\215\203\260v0G\2326>\030#}\343\356U)\337W\200:\21284O\021\032\024\341*\261\335\311\216\212\335\"R\025\201V\232\216R\201vd\031\364\006\320v\254\335//\010\037\334\306%Y\343O\323\205\264q\037+s\255\321\n\376\320\301\304\242&\202\231/\240\254\303\236\343\266\220\211^\264\245\254GY$@\026\323}\035\375C\363\004>d\275\364V;\3460\271,h\214\246\002B\344\365\372\223\340t\214\3158\204Q\036\347d\213\254D&Te\230d\032\345qhK<\212\2607b\374hI\320'I\211\374n\250\333\245\260\023\302\220O\007\205\315\340\302\311\204q\032\007*R\024\n@J\nm$\023 D\00378\234\215V\223\r\350o5r\230\315\006\222\272\230T\023\374]\311\024\341BC\344\224\3350"; - PyObject *data = __Pyx_DecompressString(cstring, 1119, 2); + #elif (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (1129 bytes) */ +const char* const cstring = "BZh91AY&SY\240\354>\212\000\000\207\177\377|\377\377\377}\337\276\367\266\267~\230\277\377\377\370@@@@@@@@\000@@@@\000P\003\336&\324EP\226\014%\022h\232\232\236Pzz\232a\252z\206\324bd6\232\230F\215\036\247\251\352\017$df\243jbi\265=\242\215\247\252z\236\232\tSM\010\320\247\243D\362e56S&\324\310\032\000\000\000\000\000\006\200\000\006\201\300\003M4\000\031\000\000\r\000\000\r\000\0002\000\001\241\240\007\000\r4\320\000d\000\0004\000\0004\000\000\310\000\006\206\200\tA\0050\"M\222\036\324\002\000\r\000\000\000\000\000\000\000\006\233SGl5O\341\255\223\366\306L\204\234\220\355\010\032\372\343\271)\364\225u\030\341\303Z\377\031\207\233\227\232%\300\372<\256\276\326Hc\334\3622\205\325\227\tA3'\320\031\244\3532\032\362'\3528\3119\245By+*\251%\340}=,\302\341X\234\230\350\261\022u\025\276\3530;b\207\303\221=(\200\205V\210)\200p\341Yx\250x\373e\355\r\235\206V\340=\033\036\311\255\264\3240Z\301\243T\235\206=~[\364\322)o\270\022d\016\035\r\t?\242-\215\217\276\256{\022\304\330\371CU#M6\005\227\236\305EsV7\267J\371f\322XD\210\245\264\005\323\264\331T7\346\305\203M\235b\252\330]\227\n\230\274[g\233\3239\302\346\220j\030\306\260[\231\t\254d\252\310\205\013B\3464\026\311\376b\326\246\255\222\326\311BqP\0141\000\231\0042X\300\237\322\274VR\226l\"\202\320T_\204\334..\023=3M#EE\"c\247,5\370\314\256\275\010\230E\226\365\301)\222$\036\3511y\362Cf|\350_\225A\240b\266z\225\t\207\214\273\342\330O\021BK-\267/\366\303-\374\372\225\014\230\332\202\265\0210\247\365\343\222`\250\263\006\004}\301Kl\324F\347&2(\222P\263*,\372s\223:e\025tb\307 \271\332\355,\346\322\276V\226\022k\325\211\010\014\241\326\320\224\226%\327cDJ\315\222\210\327\255\035\260\016\334\301\231B\213\362\233K\370\235\0232\337\250\237&j1\331DeIR(\300\243E\330\030\217\"\270\251\276\200H\205\330\222\204\246d\2631$\327\005k tf\3134\202\2503@zVH\002K\252""\366@\031R\177\t'vL9\367\211i!p\257\252COA\202\226]\0308sLN\032Ld\232\330W^\020\007\314Z\324\304\"\027\263Y\217Y\243\222h\314YU3\311feL\033T\004\014\232\254v\262\217b\242\316P\302\\M\373\344@b\026\225\202:\006\240\322Y[h\203\r\004\306\363K\n:\232\205\n\036\301\2573\353WR\024\270\313It\230\022\231j/\254\037(UO\273\3163\320\\\031\317i\264[\324\336tIC*\010X\320\266\330\346\305\262\342\203=\206\210\344\352\250*\2010$\267grn\014\245\236\235{C\026\035&/\341\316E\330S\021YZ\250\372\344A\031T\300o\247\225G\345}\300\2203\353\204r\243\275\30412\372w\231\337\017r\025w\317\310\266\304\210\251\204\341\263\234\251X\241pL\273\334H|\215\302Y\337<{\205\325#\275\267\253\313\3073'\314\356^\264[j\373\356\254J\304\365\360F)\212\374\340\211w\305\362%s\263\231\006\274X\010\336\232T\375\334\362\300S\201|\023\010*\262\233y\017\366h\177t1\363\230O\306\316\316\304&\261l\244\233\001\237\tj\037\252\377\010\312U\363\270\241)\013\217v\271K\316By\271(\327\236M\304b!\233:n5N\222\357L\302\330\267,Ac\303/#dJ\335\216\321d\214\262>S\321I\213\250\343e0k|N\271-\256\016<<\326x\203\021\200\361\224\236Qm\363:\302\364az\023\224\340\2351\236r\241&G\376.\344\212p\241!A\330}\024"; + PyObject *data = __Pyx_DecompressString(cstring, 1129, 2); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif - #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (1009 bytes) */ -const char* const cstring = "x\332\205R\317O\033G\024\226\023\244\320\304m\200\220\340\004Z\255iDP\002Fn\251H\253\376\320FT(U\2030m\204\324\036F\343\335\261\231z\231]\317\314bL.\034}\334\343\034\3678\307=\372O\310\321\3079\362\247\364\315\372\007&\240\326\322\216g\336{\363\275\357}\363m\276g-\026v\230CY\024KGv#\362\213O\005\256\007\2040\2736=\332d!\247\254\351D\230\343 \201C\374&q\250\030\026\370Q\200\031\346Tv\177p\306`\204\363\220W&\211-/\300BPok\022\251D\335\263\251{\rL\001\310\301\276o\373X\370\312-Y)\261wl\013|\216;\303\374-e2\204Y\250\2448\240\347\304ir\034\035O\025\345g\207\205\322\031\001\010\0224*\362\230\354\345\t\0173\233\253\023\307\013\331)\341r\010\210\235\203\256<\016\231\023\326\377!\236t\032!w\"\352\265\002`\363\243\220V\035\021\306\334#?\357\036\272G\007\277\273\373\356!z\273{\220\203\016\327\nB\234\370\261G\220\227C!4\211\013\"\205\304\362F\006\013\217\322\321\336j\"\306\373\223:\361\321\225\010\327\302\327BT\\?\267b\216e\330\021-\212\246\001Op\024\301\010\243\023\013\375I\246\003\252\021 \324=\203o\227z\022\355\2233yH\03297,\272\314\243a\305\013y\030K\312\210\250GX\036{ \013A\224!\311\261G\352\330k\201\230\022\356\371XbK\033z\221\274\377\247\223L\217@\230\007D\010\363\341\"\254\r\312\205D\250\0213\017\301\2579\326\014\345/\212`\322\t\213\311\324\340c\356\301\000'\242E\272\342\323\341\301\223\000x\202\201(\032)\000\233\320\217\003@\205\030\303'vS\347\271 v\260+\373\216\014}e\277(\214\242PD]T\357J\"\020\002\177\243\021\301v\214\203!\026\237x\000\335p\303$@\316\300\021\326\225\2711F,`\347\203\350q \247\354\202n\261\016\234x\036\212\201\0040\201\3728\002\335\311)\016b\":\2303\373Y\303\346o{N\243\013\327\314>\350m\367>\250\257U\315\024\347\006s/\322nV\310\026\263\232\331ym\236\254\2458\225\272:.;W\363\246\370(\251\232\317\347\223e\365N\347\247\355\344T\325\024I\253\227\305\205dCa\325\276p/g\213\275wP\014\177\273\311\003\365\223.\014\357\315>\354\265-\330\027=?ya\363O\325\323\264\234n\247\037\262\262\331\254\330\324\362`yK\267\263\231,\357\271\223l\252\266\031\003CV}\237\272\351""\237\320\031\350\335\314/\254\346hy\217\245\004\352\213\203\342\2270\231E}\335/\364\027\373\177\177,|\204\276@&q-=\267W\263\254\316\222\316\220\271=\310\244zQ03\367{\257\222\332`\246\244\nf\366I\202/g\237\r\236\275\322U\275\233\025\314\306\246\331\370.\253e\020-\rJ/uYokh\2674XZ\327\005\275\250\377\312\332}\270v\277\367\274\207\355\270\330\366\3725y\234`\253\226)\202\016f\356qR3s\217\222\035\265\252\\\263XR\367T;\235I\367\364\267\032k\236\315\033g-m\352?\3409\026\262\252q\236Oe\340\352\221zc\031\247wA\370\251c!\327\370\377X\217(\215\350\375\327\004\327X\227\324\303\264\255g\364o\200P\\Qo\323Z\212\255\370k\352\216*\233\271\257T\250k\332\317^\366];\327v\302\341\211\027\355;\224\354#\224\226\325N\272\232\272f\305I\357\3458{\3317\300\246\016}\326+\272\231\035B\313;\375\262Y\337\230\312\300\325\243\364\r\370\260\255\357\302\030\256~\237\225/o\004A\310\025\265\237\017q\336\007}\234\3643=\257\313\271\030\377\002`\300\275\203"; - PyObject *data = __Pyx_DecompressString(cstring, 1009, 1); + #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (1014 bytes) */ +const char* const cstring = "x\332\205RMO\033G\030\226\023\244\320\304m\200\220\340\004Z\255)\"(\200\221[*\322\252\037\332\210\n\245j\020\246\215\220\332\303h\274;6S/\273\353\231Y\214\311\205\243\217{\234\343\034\347\270G\377\204\034}\234#?\245\357\254\2151\001\265H^\346\375\230\347}\336g\236\315\367a+\214:\241C\3038\021\216\350\306\344\027\237r\\\017\010\t\355\267\351\321f\0301\0326\235\0303\034\004$p\210\337$\016\345\303\006?\016p\210\031\025\335\037\234+0\302X\304*\343\302\226\027`\316\251\2675\316T\342\356\331\304\275\006\246\000\344`\337\267s,|\345\216\252\020\330;\266\r>\303\235a\375\2166\021\301.TP\034\320s\3424\031\216\217'\232\362\330\t#\341\214\0008\t\032\025qL\366\362\202\207C[\253\023\307\213\302S\302\304\020\020;\007]q\034\205NT\377\207x\302iD\314\211\251\327\n\200\315\217\\Xux\2240\217\374\274{\350\036\035\374\356\356\273\207\350\355\356A\016:\374V\020b\304O<\202\274\034\n\241q\236\023\301\005\026\267*\230{\224\216\316V\023~u>\251\023\037]\213p#}#E\371\315\270\2250,\242\016oQ4\tx\202\343\030V\030Ea\344\217+\035P\215\000\241\356\031\374v\251'\320>9\023\207\244\221s\303\274\033z4\252x\021\213\022AC\302\3531\026\307\036\310B\020\r\221`\330#u\354\265@L\001\367|,\260\245\r\263H>\377\323M&W \241\007DH\350\303E\3706(\343\002\241F\022z\010\376\232W\232\241\374E\021l:f1\336\032|\314\222?\351\302\360\336\364\343^\333\202}\321\363\323\227\266\376\\>We\265\255>de\263Y\261\245\305\301\342\226ngSY>s'\335\224ms\005\014U\371\275r\325""\2370\031\350\335\256\317-\347h\371\214\205\024\372\213\203\342\227\260\231E}\335/\364\347\373\177\177,|\204\271@&u-=\267W\263\254\316\322\316\220\271\rDZ\275(\230\251\207\275\365\2646\230*\311\202\231~\226\342\313\351\027\203\027\353\272\252w\263\202\331\3304\033\337e\265\014\262\245A\351\225.\353m\r\343\026\006\013k\272\240\347\365_Y\273\017\327\036\366Vz\330\256\213\355\254_\323\247)\266j\231\"\350`f\236\24653\363$\335\221\313\3225\363%\371@\266\325\224\332\323\337j\254Y6k\234U\325\324\177\300s\314eU\343\254LT\340\352\221|c\031\253\373 \374DX\3105\376?\326#J#z\377\265\301\r\326%\371X\265\365\224\376\r\020\212K\362\255\252)_\257\203W\340\001V\345=Y63_\311H\327\264\237\275\352\273v\267\355\224\3013\317\333\267(\331\207(-\312\035\265\254\\\263\344\250\0079\326^\366\r0\252\303\254\265\212nf\2070\366^\277l\3266&*p\365H\275\001/\266\365}X\305\325\357\263\362\345\255$\210\271$\367\363E\316\373\240\221\243>\323\263zE\267 \260\242\374\013{\331\3019"; + PyObject *data = __Pyx_DecompressString(cstring, 1014, 1); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif - #else /* compression: none (1768 bytes) */ -const char* const bytes = "-Unknown input type?disableenablegcignoring parallel edge isenabledplanarity: Unknown error.planarity/classic/planarity.pyxplanarity: failed adding edge.planarity: failed attaching drawplanar.planarity: failed to initialize graphplanarity: graph not planar.self.theGraph cannot be converted to a Python object for picklingDRAWPLANAR_IDPGraphPGraph.__reduce_cython__PGraph.__setstate_cython__PGraph.asciiPGraph.edgesPGraph.embed_drawplanarPGraph.embed_planarPGraph.is_planarPGraph.kuratowski_edgesPGraph.mappingPGraph.nodesPGraph.write__Pyx_PyDict_NextRefasciiasyncio.coroutinesbpathcline_in_tracebackcontextdatadrawingeedgesembed_drawplanarembed_planarencodeendextendfirst__func____getstate__graph_is_coroutineis_planarisarcitemskeyskuratowski_edgeslast__main__mapping__module__n__name__nbrnodespathplanarity.classic.planaritypoppospy_bytes__pyx_state__qualname__r__reduce____reduce_cython____reduce_ex__sself__set_name__setdefault__setstate____setstate_cython__startstatus__test__updatevalueswarnwarningswritezip\200A\330\010\013\2104\210{\230#\230Q\330\014\020\320\020'\240y\260\001\260\024\260Q\33078\330\026&\240a\240t\2501\200A\330\010\013\2104\210z\230\021\330\014\023\2201\330\r\021\220\033\230M\250\021\330\014\023\2204\220v\230Q\230e\2401\340\014\022\220,\230a\230q\200A\340\010\014\210M\230\021\330\010\014\210D\220\013\230=\250\001\330\014\023\2201\330\010\017\210q\200A\330\010\016\210d\220'\230\021\330\010\031\230\031\240!\2404\240{\260!\330-.\200A\330\010\033\320\033/\250q\260\004\260A\330\010\013\2107\220-\230q\330\014\022\220,\230a\230q\330\010\033\2309\240A\240T\250\021\33078\330\010\013\2107\220-\230q\330\014\022\220,\230a\230q\330\022\"\240!\2404\240q\200A\330\010\027\220q\330\010\014\320\014\035\230Q\330\010\033\320\0338\270\001\270\024\270[\310\001\310\021\330\010\023\2201\220A\330\010\014\210A\210Q\330\010\017\210x\220w\230a\230q\200A\330\010\017\210t\2201\200\001\330\004\n\210+\220Q\320\004\030\230\001\330\010\026\220a\340\010\032\320\032+\2501\250D""\260\001\330,-\330,5\260Q\260a\340\010\030\320\030*\250!\2504\250q\330\010\027\320\027(\250\001\250\024\250Z\260q\270\001\330\010\n\210$\210a\330\010\016\210a\330\010\014\210E\220\025\220a\220v\230Q\330\014\017\210q\330\020\025\220Q\330\020\023\2207\230\"\230A\330\024\030\230\007\230q\240\004\240G\2503\250a\250r\260\021\330 &\240g\250S\260\001\260\022\2601\330 $\240G\2503\250a\250r\260\021\330\020\025\220W\230B\230a\230q\240\003\2401\340\020\025\220W\230B\230a\230q\240\001\330\010\017\210q\320\004\030\230\001\330\010\026\220a\340\010\032\320\032+\2501\250D\260\001\330,-\330,5\260Q\260a\330\010\016\210a\330\010\n\210$\210a\330\010\030\320\030*\250!\2504\250q\330\010\027\320\027(\250\001\250\024\250Z\260q\270\001\330\010\014\210E\220\025\220a\220v\230Q\330\014\030\230\017\240q\250\004\250J\260a\330\014\034\230I\240Q\240a\330\014\022\220&\230\002\230!\330\020\036\230o\250Q\250d\260*\270A\330\020\023\2204\220r\230\021\330\024\027\220q\330\030\035\230Q\330\030\033\2307\240\"\240A\330\034 \240\007\240q\250\004\250G\2602\260Q\260b\270\001\330(.\250g\260R\260q\270\002\270!\330(,\250G\2602\260Q\260b\270\001\330\030\035\230W\240B\240a\240q\250\003\2501\250A\250U\260!\340\030\035\230W\240B\240a\240q\250\003\2501\250A\250Q\330\020\034\230N\250!\2504\250z\270\021\330\020 \240\t\250\021\250!\330\010\017\210q"; + #else /* compression: none (1776 bytes) */ +const char* const bytes = "-Unknown input type?disableenablegcignoring parallel edge isenabledplanarity: Unknown error.planarity/classic/planarity.pyxplanarity: failed adding edge.planarity: failed attaching drawplanar.planarity: failed to initialize graphplanarity: graph not planar.self.theGraph cannot be converted to a Python object for picklingDRAWPLANAR_IDPGraphPGraph.__reduce_cython__PGraph.__setstate_cython__PGraph.asciiPGraph.edgesPGraph.embed_drawplanarPGraph.embed_planarPGraph.is_planarPGraph.kuratowski_edgesPGraph.mappingPGraph.nodesPGraph.write__Pyx_PyDict_NextRefasciiasyncio.coroutinesbpathcline_in_tracebackcontextdatadrawingeedgesembed_drawplanarembed_planarencodeendextendfirst__func____getstate__graph_is_coroutineis_planarisarcitemskeyskuratowski_edgeslast__main__mapping__module__n__name__nbrnodespathplanarity.classic.planaritypoppospy_bytes__pyx_state__qualname__r__reduce____reduce_cython____reduce_ex__sself__set_name__setdefault__setstate____setstate_cython__startstatus__test__updatevalueswarnwarningswritezip\200A\330\010\013\2104\210{\230#\230Q\330\014\020\320\020'\240y\260\001\260\024\260Q\33078\330\026&\240a\240t\2501\200A\330\010\013\2104\210z\230\021\330\014\023\2201\330\r\021\220\033\230M\250\021\330\014\023\2204\220v\230Q\230e\2401\340\014\022\220,\230a\230q\200A\340\010\014\210M\230\021\330\010\014\210D\220\013\230=\250\001\330\014\023\2201\330\010\017\210q\200A\330\010\016\210d\220'\230\021\330\010\031\230\031\240!\2404\240{\260!\330-.\200A\330\010\033\320\033/\250q\260\004\260A\330\010\013\2107\220-\230q\330\014\022\220,\230a\230q\330\010\033\2309\240A\240T\250\021\33078\330\010\013\2107\220-\230q\330\014\022\220,\230a\230q\330\022\"\240!\2404\240q\200A\330\010\027\220q\330\010\014\320\014\035\230Q\330\010\033\320\0338\270\001\270\024\270[\310\001\310\021\330\010\023\2201\220A\330\010\014\210A\210Q\330\010\017\210x\220w\230a\230q\200A\330\010\017\210t\2201\200\001\330\004\n\210+\220Q\320\004\030\230\001\330\010\026\220a\340\010\032\320\032+\2501\250D""\260\001\330,-\330,5\260Q\260a\340\010\030\320\030*\250!\2504\250q\330\010\027\320\027(\250\001\250\024\250Z\260q\270\001\330\010\n\210$\210a\330\010\016\210a\330\010\014\210E\220\025\220a\220v\230Q\330\014\017\210q\330\020\025\220Q\330\020\023\2207\230\"\230A\330\024\030\230\007\230q\240\004\240G\2503\250a\250r\260\021\330 &\240g\250S\260\001\260\022\2601\330 $\240G\2503\250a\250r\260\021\330\020\025\220W\230B\230a\230q\240\003\2401\340\020\025\220W\230B\230a\230q\240\001\330\010\017\210q\320\004\030\230\001\330\010\026\220a\340\010\032\320\032+\2501\250D\260\001\330,-\330,5\260Q\260a\330\010\016\210a\330\010\n\210$\210a\330\010\030\320\030*\250!\2504\250q\330\010\027\320\027(\250\001\250\024\250Z\260q\270\001\330\010\014\210E\220\025\220a\220v\230Q\330\014\030\230\017\240q\250\004\250J\260a\330\014\034\230I\240Q\240d\250+\260Q\330\014\022\220&\230\002\230!\330\020\036\230o\250Q\250d\260*\270A\330\020\023\2204\220r\230\021\330\024\027\220q\330\030\035\230Q\330\030\033\2307\240\"\240A\330\034 \240\007\240q\250\004\250G\2602\260Q\260b\270\001\330(.\250g\260R\260q\270\002\270!\330(,\250G\2602\260Q\260b\270\001\330\030\035\230W\240B\240a\240q\250\003\2501\250A\250U\260!\340\030\035\230W\240B\240a\240q\250\003\2501\250A\250Q\330\020\034\230N\250!\2504\250z\270\021\330\020 \240\t\250\021\250$\250k\270\021\330\010\017\210q"; PyObject *data = NULL; CYTHON_UNUSED_VAR(__Pyx_DecompressString); #endif diff --git a/planarity/classic/planarity.pyx b/planarity/classic/planarity.pyx index 7f8d9fa..20643d3 100644 --- a/planarity/classic/planarity.pyx +++ b/planarity/classic/planarity.pyx @@ -136,7 +136,7 @@ cdef class PGraph: last=cplanarity.gp_GetLastVertex(self.theGraph)+1 for n in range(first,last): e=cplanarity.gp_GetFirstArc(self.theGraph,n) - isarc=cplanarity.gp_IsArc(e) + isarc=cplanarity.gp_IsArc(self.theGraph, e) while isarc > 0: nbr=cplanarity.gp_GetNeighbor(self.theGraph,e) if nbr > n: @@ -150,7 +150,7 @@ cdef class PGraph: else: edges.append((r[n],r[nbr])) e=cplanarity.gp_GetNextArc(self.theGraph,e) - isarc=cplanarity.gp_IsArc(e) + isarc=cplanarity.gp_IsArc(self.theGraph, e) return edges diff --git a/planarity/full/cg6IterationDefs.pxd b/planarity/full/cg6IterationDefs.pxd index efb4a61..3739229 100644 --- a/planarity/full/cg6IterationDefs.pxd +++ b/planarity/full/cg6IterationDefs.pxd @@ -12,14 +12,14 @@ cdef extern from "../c/graphLib/io/g6-read-iterator.h": pass ctypedef G6ReadIterator * G6ReadIteratorP - bint contentsExhausted(G6ReadIteratorP) + int g6_NewReader(G6ReadIteratorP *, graphP) + bint g6_EndReached(G6ReadIteratorP) - int allocateG6ReadIterator(G6ReadIteratorP *, graphP) - int beginG6ReadIterationFromG6FilePath(G6ReadIteratorP, char *) + int g6_InitReaderWithFileName(G6ReadIteratorP, char *) - int readGraphUsingG6ReadIterator(G6ReadIteratorP) - int endG6ReadIteration(G6ReadIteratorP) - int freeG6ReadIterator(G6ReadIteratorP *) + int g6_ReadGraph(G6ReadIteratorP) + + int g6_FreeReader(G6ReadIteratorP *) cdef extern from "../c/graphLib/io/g6-write-iterator.h": @@ -27,9 +27,9 @@ cdef extern from "../c/graphLib/io/g6-write-iterator.h": pass ctypedef G6WriteIterator * G6WriteIteratorP - int allocateG6WriteIterator(G6WriteIteratorP *, graphP) - int beginG6WriteIterationToG6FilePath(G6WriteIteratorP, char *) + int g6_NewWriter(G6WriteIteratorP *, graphP) + int g6_InitWriterWithFileName(G6WriteIteratorP, char *) - int writeGraphUsingG6WriteIterator(G6WriteIteratorP) - int endG6WriteIteration(G6WriteIteratorP) - int freeG6WriteIterator(G6WriteIteratorP *) + int g6_WriteGraph(G6WriteIteratorP) + + int g6_FreeWriter(G6WriteIteratorP *) diff --git a/planarity/full/cgraphLib.pxd b/planarity/full/cgraphLib.pxd index 45bca9f..614d9c8 100644 --- a/planarity/full/cgraphLib.pxd +++ b/planarity/full/cgraphLib.pxd @@ -11,22 +11,22 @@ cdef extern from "../c/graphLib/graphStructures.h": pass ctypedef baseGraphStructure * graphP - int gp_IsArc(int e) + int gp_IsArc(graphP theGraph, int e) int gp_GetFirstEdge(graphP theGraph) int gp_EdgeInUse(graphP theGraph, int e) - int gp_EdgeIndexBound(graphP theGraph) - int gp_EdgeInUseIndexBound(graphP theGraph) + int gp_EdgeArraySize(graphP theGraph) + int gp_EdgeInUseArraySize(graphP theGraph) int gp_GetFirstArc(graphP theGraph, int v) int gp_GetNextArc(graphP theGraph, int e) int gp_GetNeighbor(graphP theGraph, int e) - int gp_IsVertex(int v) + int gp_IsVertex(graphP theGraph, int v) int gp_GetFirstVertex(graphP theGraph) int gp_GetLastVertex(graphP theGraph) - int gp_VertexInRange(graphP theGraph, int v) + int gp_VertexInRangeAscending(graphP theGraph, int v) - int gp_getN(graphP theGraph) + int gp_GetN(graphP theGraph) cdef extern from "../c/graphLib/graph.h": @@ -56,7 +56,7 @@ cdef extern from "../c/graphLib/graph.h": int gp_EnsureArcCapacity(graphP theGraph, int requiredArcCapacity) int gp_AddEdge(graphP theGraph, int u, int ulink, int v, int vlink) - int gp_DeleteEdge(graphP theGraph, int e, int nextLink) + int gp_DeleteEdge(graphP theGraph, int e) int gp_Embed(graphP theGraph, int embedFlags) int gp_TestEmbedResultIntegrity(graphP theGraph, graphP origGraph, int embedResult) diff --git a/planarity/full/g6IterationUtils.c b/planarity/full/g6IterationUtils.c index 7ca61d2..93e0d1d 100644 --- a/planarity/full/g6IterationUtils.c +++ b/planarity/full/g6IterationUtils.c @@ -1593,7 +1593,7 @@ struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator { }; -/* "planarity/full/g6IterationUtils.pyx":65 +/* "planarity/full/g6IterationUtils.pyx":61 * * * cdef class G6WriteIterator: # <<<<<<<<<<<<<< @@ -1883,14 +1883,6 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject /* RaiseException.export */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); -/* PyRuntimeError_Check.proto */ -#define __Pyx_PyExc_RuntimeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_RuntimeError) - -/* WriteUnraisableException.proto */ -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename, - int full_traceback, int nogil); - /* PyObjectFastCallMethod.proto */ #if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000 #define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL) @@ -1960,6 +1952,9 @@ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *nam ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ __Pyx__ArgTypeTest(obj, type, name, exact)) +/* PyRuntimeError_Check.proto */ +#define __Pyx_PyExc_RuntimeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_RuntimeError) + /* PyTypeError_Check.proto */ #define __Pyx_PyExc_TypeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_TypeError) @@ -2424,19 +2419,19 @@ static const char __pyx_k_Cython_wrapper_for_the_Edge_Add[] = "\nCython wrapper /* #### Code section: decls ### */ static int __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator___cinit__(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self); /* proto */ static void __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_2__dealloc__(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_4contents_exhausted(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self); /* proto */ -static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_6get_currGraph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self); /* proto */ -static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_8duplicate_currGraph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_10begin_iteration(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self, PyObject *__pyx_v_infile_name); /* proto */ -static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_12read_graph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self); /* proto */ +static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_4get_currGraph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self); /* proto */ +static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_6duplicate_currGraph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_8g6_EndReached(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_10g6_InitReaderWithFileName(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self, PyObject *__pyx_v_infile_name); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_12g6_ReadGraph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static int __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator___cinit__(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self, struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_graph_to_write); /* proto */ static void __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_2__dealloc__(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_4begin_iteration(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self, PyObject *__pyx_v_outfile_name); /* proto */ -static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_6write_graph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_8reinitialize_currGraph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_10update_graph_to_write(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self, struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_next_graph); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_4reinitialize_currGraph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_6update_graph_to_write(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self, struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_next_graph); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_8g6_InitWriterWithFileName(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self, PyObject *__pyx_v_outfile_name); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_10g6_WriteGraph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_12__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_14__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_tp_new_9planarity_4full_16g6IterationUtils_G6ReadIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ @@ -2470,7 +2465,7 @@ typedef struct { __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; PyObject *__pyx_codeobj_tab[13]; - PyObject *__pyx_string_tab[94]; + PyObject *__pyx_string_tab[91]; PyObject *__pyx_number_tab[1]; /* #### Code section: module_state_contents ### */ /* CommonTypesMetaclass.module_state_decls */ @@ -2516,96 +2511,93 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati #define __pyx_kp_u_Failed_to_copy_next_graph_into_G __pyx_string_tab[1] #define __pyx_kp_u_Graph_to_write_is_invalid_either __pyx_string_tab[2] #define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[3] -#define __pyx_kp_u_add_note __pyx_string_tab[4] -#define __pyx_kp_u_allocateG6ReadIterator_failed __pyx_string_tab[5] -#define __pyx_kp_u_allocateG6WriteIterator_failed __pyx_string_tab[6] -#define __pyx_kp_u_beginG6ReadIteration_failed __pyx_string_tab[7] -#define __pyx_kp_u_beginG6WriteIteration_failed __pyx_string_tab[8] -#define __pyx_kp_u_disable __pyx_string_tab[9] -#define __pyx_kp_u_enable __pyx_string_tab[10] -#define __pyx_kp_u_endG6ReadIteration_failed __pyx_string_tab[11] -#define __pyx_kp_u_endG6WriteIteration_failed __pyx_string_tab[12] -#define __pyx_kp_u_freeG6ReadIterator_failed __pyx_string_tab[13] -#define __pyx_kp_u_freeG6WriteIterator_failed __pyx_string_tab[14] -#define __pyx_kp_u_gc __pyx_string_tab[15] -#define __pyx_kp_u_graph_Graph __pyx_string_tab[16] -#define __pyx_kp_u_isenabled __pyx_string_tab[17] -#define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[18] -#define __pyx_kp_u_planarity_full_g6IterationUtils_2 __pyx_string_tab[19] -#define __pyx_kp_u_readGraphUsingG6ReadIterator_fai __pyx_string_tab[20] -#define __pyx_kp_u_stringsource __pyx_string_tab[21] -#define __pyx_kp_u_writeGraphUsingG6WriteIterator_f __pyx_string_tab[22] -#define __pyx_n_u_FileName __pyx_string_tab[23] -#define __pyx_n_u_G6ReadIterator __pyx_string_tab[24] -#define __pyx_n_u_G6ReadIterator___reduce_cython __pyx_string_tab[25] -#define __pyx_n_u_G6ReadIterator___setstate_cython __pyx_string_tab[26] -#define __pyx_n_u_G6ReadIterator_begin_iteration __pyx_string_tab[27] -#define __pyx_n_u_G6ReadIterator_contents_exhauste __pyx_string_tab[28] -#define __pyx_n_u_G6ReadIterator_duplicate_currGra __pyx_string_tab[29] -#define __pyx_n_u_G6ReadIterator_get_currGraph __pyx_string_tab[30] -#define __pyx_n_u_G6ReadIterator_read_graph __pyx_string_tab[31] -#define __pyx_n_u_G6WriteIterator __pyx_string_tab[32] -#define __pyx_n_u_G6WriteIterator___reduce_cython __pyx_string_tab[33] -#define __pyx_n_u_G6WriteIterator___setstate_cytho __pyx_string_tab[34] -#define __pyx_n_u_G6WriteIterator_begin_iteration __pyx_string_tab[35] -#define __pyx_n_u_G6WriteIterator_reinitialize_cur __pyx_string_tab[36] -#define __pyx_n_u_G6WriteIterator_update_graph_to __pyx_string_tab[37] -#define __pyx_n_u_G6WriteIterator_write_graph __pyx_string_tab[38] -#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[39] -#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[40] -#define __pyx_n_u_begin_iteration __pyx_string_tab[41] -#define __pyx_n_u_cline_in_traceback __pyx_string_tab[42] -#define __pyx_n_u_contents_exhausted __pyx_string_tab[43] -#define __pyx_n_u_copy_graph_error __pyx_string_tab[44] -#define __pyx_n_u_duplicate_currGraph __pyx_string_tab[45] -#define __pyx_n_u_encoded __pyx_string_tab[46] -#define __pyx_n_u_func __pyx_string_tab[47] -#define __pyx_n_u_get_currGraph __pyx_string_tab[48] -#define __pyx_n_u_get_wrapper_for_graphP __pyx_string_tab[49] -#define __pyx_n_u_getstate __pyx_string_tab[50] -#define __pyx_n_u_gp_CopyGraph __pyx_string_tab[51] -#define __pyx_n_u_gp_DupGraph __pyx_string_tab[52] +#define __pyx_kp_u_Unable_to_initialize_G6ReadItera __pyx_string_tab[4] +#define __pyx_kp_u_Unable_to_initialize_G6WriteIter __pyx_string_tab[5] +#define __pyx_kp_u_Unable_to_initialize_reader_with __pyx_string_tab[6] +#define __pyx_kp_u_Unable_to_initialize_writer_with __pyx_string_tab[7] +#define __pyx_kp_u_Unable_to_read_graph_as_g6_ReadG __pyx_string_tab[8] +#define __pyx_kp_u_Unable_to_write_graph_as_g6_Writ __pyx_string_tab[9] +#define __pyx_kp_u_add_note __pyx_string_tab[10] +#define __pyx_kp_u_disable __pyx_string_tab[11] +#define __pyx_kp_u_enable __pyx_string_tab[12] +#define __pyx_kp_u_gc __pyx_string_tab[13] +#define __pyx_kp_u_graph_Graph __pyx_string_tab[14] +#define __pyx_kp_u_isenabled __pyx_string_tab[15] +#define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[16] +#define __pyx_kp_u_planarity_full_g6IterationUtils_2 __pyx_string_tab[17] +#define __pyx_kp_u_stringsource __pyx_string_tab[18] +#define __pyx_n_u_FileName __pyx_string_tab[19] +#define __pyx_n_u_G6ReadIterator __pyx_string_tab[20] +#define __pyx_n_u_G6ReadIterator___reduce_cython __pyx_string_tab[21] +#define __pyx_n_u_G6ReadIterator___setstate_cython __pyx_string_tab[22] +#define __pyx_n_u_G6ReadIterator_duplicate_currGra __pyx_string_tab[23] +#define __pyx_n_u_G6ReadIterator_g6_EndReached __pyx_string_tab[24] +#define __pyx_n_u_G6ReadIterator_g6_InitReaderWith __pyx_string_tab[25] +#define __pyx_n_u_G6ReadIterator_g6_ReadGraph __pyx_string_tab[26] +#define __pyx_n_u_G6ReadIterator_get_currGraph __pyx_string_tab[27] +#define __pyx_n_u_G6WriteIterator __pyx_string_tab[28] +#define __pyx_n_u_G6WriteIterator___reduce_cython __pyx_string_tab[29] +#define __pyx_n_u_G6WriteIterator___setstate_cytho __pyx_string_tab[30] +#define __pyx_n_u_G6WriteIterator_g6_InitWriterWit __pyx_string_tab[31] +#define __pyx_n_u_G6WriteIterator_g6_WriteGraph __pyx_string_tab[32] +#define __pyx_n_u_G6WriteIterator_reinitialize_cur __pyx_string_tab[33] +#define __pyx_n_u_G6WriteIterator_update_graph_to __pyx_string_tab[34] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[35] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[36] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[37] +#define __pyx_n_u_copy_graph_error __pyx_string_tab[38] +#define __pyx_n_u_duplicate_currGraph __pyx_string_tab[39] +#define __pyx_n_u_encoded __pyx_string_tab[40] +#define __pyx_n_u_func __pyx_string_tab[41] +#define __pyx_n_u_g6_EndReached __pyx_string_tab[42] +#define __pyx_n_u_g6_InitReaderWithFileName __pyx_string_tab[43] +#define __pyx_n_u_g6_InitWriterWithFileName __pyx_string_tab[44] +#define __pyx_n_u_g6_ReadGraph __pyx_string_tab[45] +#define __pyx_n_u_g6_WriteGraph __pyx_string_tab[46] +#define __pyx_n_u_get_currGraph __pyx_string_tab[47] +#define __pyx_n_u_get_wrapper_for_graphP __pyx_string_tab[48] +#define __pyx_n_u_getstate __pyx_string_tab[49] +#define __pyx_n_u_gp_CopyGraph __pyx_string_tab[50] +#define __pyx_n_u_gp_DupGraph __pyx_string_tab[51] +#define __pyx_n_u_gp_GetN __pyx_string_tab[52] #define __pyx_n_u_gp_ReinitializeGraph __pyx_string_tab[53] -#define __pyx_n_u_gp_getN __pyx_string_tab[54] -#define __pyx_n_u_graph_to_write __pyx_string_tab[55] -#define __pyx_n_u_infile_name __pyx_string_tab[56] -#define __pyx_n_u_is_coroutine __pyx_string_tab[57] -#define __pyx_n_u_is_graph_NULL __pyx_string_tab[58] -#define __pyx_n_u_items __pyx_string_tab[59] -#define __pyx_n_u_main __pyx_string_tab[60] -#define __pyx_n_u_module __pyx_string_tab[61] -#define __pyx_n_u_name __pyx_string_tab[62] -#define __pyx_n_u_next_graph __pyx_string_tab[63] -#define __pyx_n_u_outfile_name __pyx_string_tab[64] -#define __pyx_n_u_planarity_full_g6IterationUtils __pyx_string_tab[65] -#define __pyx_n_u_pop __pyx_string_tab[66] -#define __pyx_n_u_pyx_state __pyx_string_tab[67] -#define __pyx_n_u_qualname __pyx_string_tab[68] -#define __pyx_n_u_read_graph __pyx_string_tab[69] -#define __pyx_n_u_reduce __pyx_string_tab[70] -#define __pyx_n_u_reduce_cython __pyx_string_tab[71] -#define __pyx_n_u_reduce_ex __pyx_string_tab[72] -#define __pyx_n_u_reinitialize_currGraph __pyx_string_tab[73] -#define __pyx_n_u_return __pyx_string_tab[74] -#define __pyx_n_u_self __pyx_string_tab[75] -#define __pyx_n_u_set_name __pyx_string_tab[76] -#define __pyx_n_u_setdefault __pyx_string_tab[77] -#define __pyx_n_u_setstate __pyx_string_tab[78] -#define __pyx_n_u_setstate_cython __pyx_string_tab[79] -#define __pyx_n_u_test __pyx_string_tab[80] -#define __pyx_n_u_update_graph_to_write __pyx_string_tab[81] -#define __pyx_n_u_values __pyx_string_tab[82] -#define __pyx_n_u_write_graph __pyx_string_tab[83] -#define __pyx_kp_b_iso88591_A_1_a __pyx_string_tab[84] -#define __pyx_kp_b_iso88591_A_3c_83c_A_q_a __pyx_string_tab[85] -#define __pyx_kp_b_iso88591_A_4_RR___aq __pyx_string_tab[86] -#define __pyx_kp_b_iso88591_A_8_O_aq __pyx_string_tab[87] -#define __pyx_kp_b_iso88591_A_A_QdBUU__kkl_aq __pyx_string_tab[88] -#define __pyx_kp_b_iso88591_A_K_A __pyx_string_tab[89] -#define __pyx_kp_b_iso88591_A_q_A_atCUU__kkl_aq __pyx_string_tab[90] -#define __pyx_kp_b_iso88591_Q __pyx_string_tab[91] -#define __pyx_kp_b_iso88591_Q_t_l __pyx_string_tab[92] -#define __pyx_kp_b_iso88591_q_t_5Q __pyx_string_tab[93] +#define __pyx_n_u_graph_to_write __pyx_string_tab[54] +#define __pyx_n_u_infile_name __pyx_string_tab[55] +#define __pyx_n_u_is_coroutine __pyx_string_tab[56] +#define __pyx_n_u_is_graph_NULL __pyx_string_tab[57] +#define __pyx_n_u_items __pyx_string_tab[58] +#define __pyx_n_u_main __pyx_string_tab[59] +#define __pyx_n_u_module __pyx_string_tab[60] +#define __pyx_n_u_name __pyx_string_tab[61] +#define __pyx_n_u_next_graph __pyx_string_tab[62] +#define __pyx_n_u_outfile_name __pyx_string_tab[63] +#define __pyx_n_u_planarity_full_g6IterationUtils __pyx_string_tab[64] +#define __pyx_n_u_pop __pyx_string_tab[65] +#define __pyx_n_u_pyx_state __pyx_string_tab[66] +#define __pyx_n_u_qualname __pyx_string_tab[67] +#define __pyx_n_u_reduce __pyx_string_tab[68] +#define __pyx_n_u_reduce_cython __pyx_string_tab[69] +#define __pyx_n_u_reduce_ex __pyx_string_tab[70] +#define __pyx_n_u_reinitialize_currGraph __pyx_string_tab[71] +#define __pyx_n_u_return __pyx_string_tab[72] +#define __pyx_n_u_self __pyx_string_tab[73] +#define __pyx_n_u_set_name __pyx_string_tab[74] +#define __pyx_n_u_setdefault __pyx_string_tab[75] +#define __pyx_n_u_setstate __pyx_string_tab[76] +#define __pyx_n_u_setstate_cython __pyx_string_tab[77] +#define __pyx_n_u_test __pyx_string_tab[78] +#define __pyx_n_u_update_graph_to_write __pyx_string_tab[79] +#define __pyx_n_u_values __pyx_string_tab[80] +#define __pyx_kp_b_iso88591_A_1_aq __pyx_string_tab[81] +#define __pyx_kp_b_iso88591_A_3c_83c_A_q_a __pyx_string_tab[82] +#define __pyx_kp_b_iso88591_A_A_5Qd_MZWccd_aq __pyx_string_tab[83] +#define __pyx_kp_b_iso88591_A_A_Q_aq __pyx_string_tab[84] +#define __pyx_kp_b_iso88591_A_K_A __pyx_string_tab[85] +#define __pyx_kp_b_iso88591_A_Qd __pyx_string_tab[86] +#define __pyx_kp_b_iso88591_A_q_A_5Qd_LJVbbc_aq __pyx_string_tab[87] +#define __pyx_kp_b_iso88591_Q __pyx_string_tab[88] +#define __pyx_kp_b_iso88591_Q_t_l __pyx_string_tab[89] +#define __pyx_kp_b_iso88591_q_t_5Q __pyx_string_tab[90] #define __pyx_int_0 __pyx_number_tab[0] /* #### Code section: module_state_clear ### */ #if CYTHON_USE_MODULE_STATE @@ -2627,7 +2619,7 @@ static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator); Py_CLEAR(clear_module_state->__pyx_type_9planarity_4full_16g6IterationUtils_G6WriteIterator); for (int i=0; i<13; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } - for (int i=0; i<94; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } + for (int i=0; i<91; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); } /* #### Code section: module_state_clear_contents ### */ /* CommonTypesMetaclass.module_state_clear */ @@ -2657,7 +2649,7 @@ static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void Py_VISIT(traverse_module_state->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator); Py_VISIT(traverse_module_state->__pyx_type_9planarity_4full_16g6IterationUtils_G6WriteIterator); for (int i=0; i<13; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } - for (int i=0; i<94; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } + for (int i=0; i<91; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); } /* #### Code section: module_state_traverse_contents ### */ /* CommonTypesMetaclass.module_state_traverse */ @@ -2732,7 +2724,7 @@ static int __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator___cinit * * cdef graph.Graph currGraph = graph.Graph() # <<<<<<<<<<<<<< * - * if cg6IterationDefs.allocateG6ReadIterator(&self._g6ReadIterator, currGraph._theGraph) != cappconst.OK: + * if cg6IterationDefs.g6_NewReader(&self._g6ReadIterator, currGraph._theGraph) != cappconst.OK: */ __pyx_t_2 = NULL; __pyx_t_3 = 1; @@ -2749,24 +2741,24 @@ static int __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator___cinit /* "planarity/full/g6IterationUtils.pyx":26 * cdef graph.Graph currGraph = graph.Graph() * - * if cg6IterationDefs.allocateG6ReadIterator(&self._g6ReadIterator, currGraph._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< - * raise MemoryError("allocateG6ReadIterator() failed.") + * if cg6IterationDefs.g6_NewReader(&self._g6ReadIterator, currGraph._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< + * raise MemoryError("Unable to initialize G6ReadIterator, as call to g6_NewReader() in EAPS graphLib failed.") * */ - __pyx_t_4 = (allocateG6ReadIterator((&__pyx_v_self->_g6ReadIterator), __pyx_v_currGraph->_theGraph) != OK); + __pyx_t_4 = (g6_NewReader((&__pyx_v_self->_g6ReadIterator), __pyx_v_currGraph->_theGraph) != OK); if (unlikely(__pyx_t_4)) { /* "planarity/full/g6IterationUtils.pyx":27 * - * if cg6IterationDefs.allocateG6ReadIterator(&self._g6ReadIterator, currGraph._theGraph) != cappconst.OK: - * raise MemoryError("allocateG6ReadIterator() failed.") # <<<<<<<<<<<<<< + * if cg6IterationDefs.g6_NewReader(&self._g6ReadIterator, currGraph._theGraph) != cappconst.OK: + * raise MemoryError("Unable to initialize G6ReadIterator, as call to g6_NewReader() in EAPS graphLib failed.") # <<<<<<<<<<<<<< * * self._currGraph = currGraph */ __pyx_t_2 = NULL; __pyx_t_3 = 1; { - PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_allocateG6ReadIterator_failed}; + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Unable_to_initialize_G6ReadItera}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error) @@ -2779,14 +2771,14 @@ static int __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator___cinit /* "planarity/full/g6IterationUtils.pyx":26 * cdef graph.Graph currGraph = graph.Graph() * - * if cg6IterationDefs.allocateG6ReadIterator(&self._g6ReadIterator, currGraph._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< - * raise MemoryError("allocateG6ReadIterator() failed.") + * if cg6IterationDefs.g6_NewReader(&self._g6ReadIterator, currGraph._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< + * raise MemoryError("Unable to initialize G6ReadIterator, as call to g6_NewReader() in EAPS graphLib failed.") * */ } /* "planarity/full/g6IterationUtils.pyx":29 - * raise MemoryError("allocateG6ReadIterator() failed.") + * raise MemoryError("Unable to initialize G6ReadIterator, as call to g6_NewReader() in EAPS graphLib failed.") * * self._currGraph = currGraph # <<<<<<<<<<<<<< * @@ -2825,7 +2817,7 @@ static int __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator___cinit * * def __dealloc__(self): # <<<<<<<<<<<<<< * if self._g6ReadIterator != NULL: - * if cg6IterationDefs.endG6ReadIteration(self._g6ReadIterator) != cappconst.OK: + * # NOTE: g6_FreeReader() NULLs out the pointer to currGraph on */ /* Python wrapper */ @@ -2842,110 +2834,33 @@ static void __pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_3__dea } static void __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_2__dealloc__(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self) { - __Pyx_RefNannyDeclarations int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - size_t __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__dealloc__", 0); /* "planarity/full/g6IterationUtils.pyx":32 * * def __dealloc__(self): * if self._g6ReadIterator != NULL: # <<<<<<<<<<<<<< - * if cg6IterationDefs.endG6ReadIteration(self._g6ReadIterator) != cappconst.OK: - * raise RuntimeError("endG6ReadIteration() failed.") + * # NOTE: g6_FreeReader() NULLs out the pointer to currGraph on + * # the C layer; Python will then clean up the instance variables */ __pyx_t_1 = (__pyx_v_self->_g6ReadIterator != NULL); if (__pyx_t_1) { - /* "planarity/full/g6IterationUtils.pyx":33 - * def __dealloc__(self): - * if self._g6ReadIterator != NULL: - * if cg6IterationDefs.endG6ReadIteration(self._g6ReadIterator) != cappconst.OK: # <<<<<<<<<<<<<< - * raise RuntimeError("endG6ReadIteration() failed.") - * -*/ - __pyx_t_1 = (endG6ReadIteration(__pyx_v_self->_g6ReadIterator) != OK); - if (unlikely(__pyx_t_1)) { - - /* "planarity/full/g6IterationUtils.pyx":34 - * if self._g6ReadIterator != NULL: - * if cg6IterationDefs.endG6ReadIteration(self._g6ReadIterator) != cappconst.OK: - * raise RuntimeError("endG6ReadIteration() failed.") # <<<<<<<<<<<<<< - * - * # NOTE: freeG6ReadIterator() NULLs out the pointer to currGraph on -*/ - __pyx_t_3 = NULL; - __pyx_t_4 = 1; - { - PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_endG6ReadIteration_failed}; - __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 34, __pyx_L1_error) - - /* "planarity/full/g6IterationUtils.pyx":33 - * def __dealloc__(self): - * if self._g6ReadIterator != NULL: - * if cg6IterationDefs.endG6ReadIteration(self._g6ReadIterator) != cappconst.OK: # <<<<<<<<<<<<<< - * raise RuntimeError("endG6ReadIteration() failed.") - * -*/ - } - - /* "planarity/full/g6IterationUtils.pyx":40 - * # by calling their respective __dealloc__, so at that point the - * # graphP will be cleaned up with gp_Free() - * if cg6IterationDefs.freeG6ReadIterator(&self._g6ReadIterator) != cappconst.OK: # <<<<<<<<<<<<<< - * raise MemoryError("freeG6ReadIterator() failed.") - * -*/ - __pyx_t_1 = (freeG6ReadIterator((&__pyx_v_self->_g6ReadIterator)) != OK); - if (unlikely(__pyx_t_1)) { - - /* "planarity/full/g6IterationUtils.pyx":41 - * # graphP will be cleaned up with gp_Free() - * if cg6IterationDefs.freeG6ReadIterator(&self._g6ReadIterator) != cappconst.OK: - * raise MemoryError("freeG6ReadIterator() failed.") # <<<<<<<<<<<<<< - * - * def contents_exhausted(self): -*/ - __pyx_t_3 = NULL; - __pyx_t_4 = 1; - { - PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_freeG6ReadIterator_failed}; - __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 41, __pyx_L1_error) - - /* "planarity/full/g6IterationUtils.pyx":40 + /* "planarity/full/g6IterationUtils.pyx":37 * # by calling their respective __dealloc__, so at that point the * # graphP will be cleaned up with gp_Free() - * if cg6IterationDefs.freeG6ReadIterator(&self._g6ReadIterator) != cappconst.OK: # <<<<<<<<<<<<<< - * raise MemoryError("freeG6ReadIterator() failed.") + * cg6IterationDefs.g6_FreeReader(&self._g6ReadIterator) # <<<<<<<<<<<<<< * + * def get_currGraph(self) -> graph.Graph: */ - } + (void)(g6_FreeReader((&__pyx_v_self->_g6ReadIterator))); /* "planarity/full/g6IterationUtils.pyx":32 * * def __dealloc__(self): * if self._g6ReadIterator != NULL: # <<<<<<<<<<<<<< - * if cg6IterationDefs.endG6ReadIteration(self._g6ReadIterator) != cappconst.OK: - * raise RuntimeError("endG6ReadIteration() failed.") + * # NOTE: g6_FreeReader() NULLs out the pointer to currGraph on + * # the C layer; Python will then clean up the instance variables */ } @@ -2954,38 +2869,31 @@ static void __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_2__dea * * def __dealloc__(self): # <<<<<<<<<<<<<< * if self._g6ReadIterator != NULL: - * if cg6IterationDefs.endG6ReadIteration(self._g6ReadIterator) != cappconst.OK: + * # NOTE: g6_FreeReader() NULLs out the pointer to currGraph on */ /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_WriteUnraisable("planarity.full.g6IterationUtils.G6ReadIterator.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __pyx_L0:; - __Pyx_RefNannyFinishContext(); } -/* "planarity/full/g6IterationUtils.pyx":43 - * raise MemoryError("freeG6ReadIterator() failed.") +/* "planarity/full/g6IterationUtils.pyx":39 + * cg6IterationDefs.g6_FreeReader(&self._g6ReadIterator) * - * def contents_exhausted(self): # <<<<<<<<<<<<<< - * return cg6IterationDefs.contentsExhausted(self._g6ReadIterator) + * def get_currGraph(self) -> graph.Graph: # <<<<<<<<<<<<<< + * return self._currGraph.get_wrapper_for_graphP() * */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_5contents_exhausted(PyObject *__pyx_v_self, +static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_5get_currGraph(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_4contents_exhausted, "G6ReadIterator.contents_exhausted(self)"); -static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_5contents_exhausted = {"contents_exhausted", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_5contents_exhausted, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_4contents_exhausted}; -static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_5contents_exhausted(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_4get_currGraph, "G6ReadIterator.get_currGraph(self) -> graph.Graph"); +static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_5get_currGraph = {"get_currGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_5get_currGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_4get_currGraph}; +static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_5get_currGraph(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -2996,9 +2904,9 @@ PyObject *__pyx_args, PyObject *__pyx_kwds CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject *__pyx_r = 0; + struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("contents_exhausted (wrapper)", 0); + __Pyx_RefNannySetupContext("get_currGraph (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -3007,78 +2915,90 @@ PyObject *__pyx_args, PyObject *__pyx_kwds #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("contents_exhausted", 1, 0, 0, __pyx_nargs); return NULL; } + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_currGraph", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; - if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("contents_exhausted", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_4contents_exhausted(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *)__pyx_v_self)); + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_currGraph", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_4get_currGraph(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_4contents_exhausted(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self) { - PyObject *__pyx_r = NULL; +static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_4get_currGraph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self) { + struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("contents_exhausted", 0); + __Pyx_RefNannySetupContext("get_currGraph", 0); - /* "planarity/full/g6IterationUtils.pyx":44 - * - * def contents_exhausted(self): - * return cg6IterationDefs.contentsExhausted(self._g6ReadIterator) # <<<<<<<<<<<<<< + /* "planarity/full/g6IterationUtils.pyx":40 * * def get_currGraph(self) -> graph.Graph: + * return self._currGraph.get_wrapper_for_graphP() # <<<<<<<<<<<<<< + * + * def duplicate_currGraph(self) -> graph.Graph: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(contentsExhausted(__pyx_v_self->_g6ReadIterator)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_v_self->_currGraph); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_wrapper_for_graphP, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph))))) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_r = ((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/full/g6IterationUtils.pyx":43 - * raise MemoryError("freeG6ReadIterator() failed.") + /* "planarity/full/g6IterationUtils.pyx":39 + * cg6IterationDefs.g6_FreeReader(&self._g6ReadIterator) * - * def contents_exhausted(self): # <<<<<<<<<<<<<< - * return cg6IterationDefs.contentsExhausted(self._g6ReadIterator) + * def get_currGraph(self) -> graph.Graph: # <<<<<<<<<<<<<< + * return self._currGraph.get_wrapper_for_graphP() * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.contents_exhausted", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.get_currGraph", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "planarity/full/g6IterationUtils.pyx":46 - * return cg6IterationDefs.contentsExhausted(self._g6ReadIterator) - * - * def get_currGraph(self) -> graph.Graph: # <<<<<<<<<<<<<< +/* "planarity/full/g6IterationUtils.pyx":42 * return self._currGraph.get_wrapper_for_graphP() * + * def duplicate_currGraph(self) -> graph.Graph: # <<<<<<<<<<<<<< + * return self._currGraph.gp_DupGraph() + * */ /* Python wrapper */ -static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_7get_currGraph(PyObject *__pyx_v_self, +static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_7duplicate_currGraph(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_6get_currGraph, "G6ReadIterator.get_currGraph(self) -> graph.Graph"); -static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_7get_currGraph = {"get_currGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_7get_currGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_6get_currGraph}; -static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_7get_currGraph(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_6duplicate_currGraph, "G6ReadIterator.duplicate_currGraph(self) -> graph.Graph"); +static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_7duplicate_currGraph = {"duplicate_currGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_7duplicate_currGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_6duplicate_currGraph}; +static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_7duplicate_currGraph(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -3091,7 +3011,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds CYTHON_UNUSED PyObject *const *__pyx_kwvalues; struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_currGraph (wrapper)", 0); + __Pyx_RefNannySetupContext("duplicate_currGraph (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -3100,18 +3020,18 @@ PyObject *__pyx_args, PyObject *__pyx_kwds #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_currGraph", 1, 0, 0, __pyx_nargs); return NULL; } + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("duplicate_currGraph", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; - if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_currGraph", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_6get_currGraph(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *)__pyx_v_self)); + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("duplicate_currGraph", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_6duplicate_currGraph(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_6get_currGraph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self) { +static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_6duplicate_currGraph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self) { struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3120,14 +3040,14 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_currGraph", 0); + __Pyx_RefNannySetupContext("duplicate_currGraph", 0); - /* "planarity/full/g6IterationUtils.pyx":47 - * - * def get_currGraph(self) -> graph.Graph: - * return self._currGraph.get_wrapper_for_graphP() # <<<<<<<<<<<<<< + /* "planarity/full/g6IterationUtils.pyx":43 * * def duplicate_currGraph(self) -> graph.Graph: + * return self._currGraph.gp_DupGraph() # <<<<<<<<<<<<<< + * + * def g6_EndReached(self): */ __Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_2 = ((PyObject *)__pyx_v_self->_currGraph); @@ -3135,29 +3055,29 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full __pyx_t_3 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; - __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_wrapper_for_graphP, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_DupGraph, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph))))) __PYX_ERR(0, 47, __pyx_L1_error) + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph))))) __PYX_ERR(0, 43, __pyx_L1_error) __pyx_r = ((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/full/g6IterationUtils.pyx":46 - * return cg6IterationDefs.contentsExhausted(self._g6ReadIterator) - * - * def get_currGraph(self) -> graph.Graph: # <<<<<<<<<<<<<< + /* "planarity/full/g6IterationUtils.pyx":42 * return self._currGraph.get_wrapper_for_graphP() * + * def duplicate_currGraph(self) -> graph.Graph: # <<<<<<<<<<<<<< + * return self._currGraph.gp_DupGraph() + * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.get_currGraph", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.duplicate_currGraph", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF((PyObject *)__pyx_r); @@ -3165,25 +3085,25 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full return __pyx_r; } -/* "planarity/full/g6IterationUtils.pyx":49 - * return self._currGraph.get_wrapper_for_graphP() - * - * def duplicate_currGraph(self) -> graph.Graph: # <<<<<<<<<<<<<< +/* "planarity/full/g6IterationUtils.pyx":45 * return self._currGraph.gp_DupGraph() * + * def g6_EndReached(self): # <<<<<<<<<<<<<< + * return cg6IterationDefs.g6_EndReached(self._g6ReadIterator) + * */ /* Python wrapper */ -static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_9duplicate_currGraph(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_9g6_EndReached(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_8duplicate_currGraph, "G6ReadIterator.duplicate_currGraph(self) -> graph.Graph"); -static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_9duplicate_currGraph = {"duplicate_currGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_9duplicate_currGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_8duplicate_currGraph}; -static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_9duplicate_currGraph(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_8g6_EndReached, "G6ReadIterator.g6_EndReached(self)"); +static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_9g6_EndReached = {"g6_EndReached", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_9g6_EndReached, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_8g6_EndReached}; +static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_9g6_EndReached(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -3194,9 +3114,9 @@ PyObject *__pyx_args, PyObject *__pyx_kwds CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_r = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("duplicate_currGraph (wrapper)", 0); + __Pyx_RefNannySetupContext("g6_EndReached (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -3205,90 +3125,78 @@ PyObject *__pyx_args, PyObject *__pyx_kwds #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("duplicate_currGraph", 1, 0, 0, __pyx_nargs); return NULL; } + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("g6_EndReached", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; - if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("duplicate_currGraph", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_8duplicate_currGraph(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *)__pyx_v_self)); + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("g6_EndReached", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_8g6_EndReached(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_8duplicate_currGraph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self) { - struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_r = NULL; +static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_8g6_EndReached(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - size_t __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("duplicate_currGraph", 0); + __Pyx_RefNannySetupContext("g6_EndReached", 0); - /* "planarity/full/g6IterationUtils.pyx":50 + /* "planarity/full/g6IterationUtils.pyx":46 * - * def duplicate_currGraph(self) -> graph.Graph: - * return self._currGraph.gp_DupGraph() # <<<<<<<<<<<<<< + * def g6_EndReached(self): + * return cg6IterationDefs.g6_EndReached(self._g6ReadIterator) # <<<<<<<<<<<<<< * - * def begin_iteration(self, str infile_name): + * def g6_InitReaderWithFileName(self, str infile_name): */ - __Pyx_XDECREF((PyObject *)__pyx_r); - __pyx_t_2 = ((PyObject *)__pyx_v_self->_currGraph); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = 0; - { - PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; - __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_DupGraph, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph))))) __PYX_ERR(0, 50, __pyx_L1_error) - __pyx_r = ((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_t_1); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(g6_EndReached(__pyx_v_self->_g6ReadIterator)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/full/g6IterationUtils.pyx":49 - * return self._currGraph.get_wrapper_for_graphP() - * - * def duplicate_currGraph(self) -> graph.Graph: # <<<<<<<<<<<<<< + /* "planarity/full/g6IterationUtils.pyx":45 * return self._currGraph.gp_DupGraph() * + * def g6_EndReached(self): # <<<<<<<<<<<<<< + * return cg6IterationDefs.g6_EndReached(self._g6ReadIterator) + * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.duplicate_currGraph", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.g6_EndReached", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "planarity/full/g6IterationUtils.pyx":52 - * return self._currGraph.gp_DupGraph() +/* "planarity/full/g6IterationUtils.pyx":48 + * return cg6IterationDefs.g6_EndReached(self._g6ReadIterator) * - * def begin_iteration(self, str infile_name): # <<<<<<<<<<<<<< + * def g6_InitReaderWithFileName(self, str infile_name): # <<<<<<<<<<<<<< * # Convert Python str to UTF-8 encoded bytes, and then to const char * * cdef bytes encoded = infile_name.encode('utf-8') */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_11begin_iteration(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_11g6_InitReaderWithFileName(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_10begin_iteration, "G6ReadIterator.begin_iteration(self, str infile_name)"); -static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_11begin_iteration = {"begin_iteration", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_11begin_iteration, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_10begin_iteration}; -static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_11begin_iteration(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_10g6_InitReaderWithFileName, "G6ReadIterator.g6_InitReaderWithFileName(self, str infile_name)"); +static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_11g6_InitReaderWithFileName = {"g6_InitReaderWithFileName", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_11g6_InitReaderWithFileName, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_10g6_InitReaderWithFileName}; +static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_11g6_InitReaderWithFileName(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -3306,7 +3214,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("begin_iteration (wrapper)", 0); + __Pyx_RefNannySetupContext("g6_InitReaderWithFileName (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -3318,44 +3226,44 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_infile_name,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 52, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 48, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 52, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 48, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "begin_iteration", 0) < (0)) __PYX_ERR(0, 52, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "g6_InitReaderWithFileName", 0) < (0)) __PYX_ERR(0, 48, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("begin_iteration", 1, 1, 1, i); __PYX_ERR(0, 52, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("g6_InitReaderWithFileName", 1, 1, 1, i); __PYX_ERR(0, 48, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 52, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 48, __pyx_L3_error) } __pyx_v_infile_name = ((PyObject*)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("begin_iteration", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 52, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("g6_InitReaderWithFileName", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 48, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } - __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.begin_iteration", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.g6_InitReaderWithFileName", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_infile_name), (&PyUnicode_Type), 1, "infile_name", 1))) __PYX_ERR(0, 52, __pyx_L1_error) - __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_10begin_iteration(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *)__pyx_v_self), __pyx_v_infile_name); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_infile_name), (&PyUnicode_Type), 1, "infile_name", 1))) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_10g6_InitReaderWithFileName(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *)__pyx_v_self), __pyx_v_infile_name); /* function exit code */ goto __pyx_L0; @@ -3374,7 +3282,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_10begin_iteration(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self, PyObject *__pyx_v_infile_name) { +static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_10g6_InitReaderWithFileName(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self, PyObject *__pyx_v_infile_name) { PyObject *__pyx_v_encoded = 0; char const *__pyx_v_FileName; PyObject *__pyx_r = NULL; @@ -3387,10 +3295,10 @@ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_1 int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("begin_iteration", 0); + __Pyx_RefNannySetupContext("g6_InitReaderWithFileName", 0); - /* "planarity/full/g6IterationUtils.pyx":54 - * def begin_iteration(self, str infile_name): + /* "planarity/full/g6IterationUtils.pyx":50 + * def g6_InitReaderWithFileName(self, str infile_name): * # Convert Python str to UTF-8 encoded bytes, and then to const char * * cdef bytes encoded = infile_name.encode('utf-8') # <<<<<<<<<<<<<< * cdef const char *FileName = encoded @@ -3398,66 +3306,66 @@ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_1 */ if (unlikely(__pyx_v_infile_name == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); - __PYX_ERR(0, 54, __pyx_L1_error) + __PYX_ERR(0, 50, __pyx_L1_error) } - __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_infile_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_infile_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_encoded = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "planarity/full/g6IterationUtils.pyx":55 + /* "planarity/full/g6IterationUtils.pyx":51 * # Convert Python str to UTF-8 encoded bytes, and then to const char * * cdef bytes encoded = infile_name.encode('utf-8') * cdef const char *FileName = encoded # <<<<<<<<<<<<<< * - * if cg6IterationDefs.beginG6ReadIterationFromG6FilePath(self._g6ReadIterator, FileName) != cappconst.OK: + * if cg6IterationDefs.g6_InitReaderWithFileName(self._g6ReadIterator, FileName) != cappconst.OK: */ - __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_encoded); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_encoded); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 51, __pyx_L1_error) __pyx_v_FileName = __pyx_t_2; - /* "planarity/full/g6IterationUtils.pyx":57 + /* "planarity/full/g6IterationUtils.pyx":53 * cdef const char *FileName = encoded * - * if cg6IterationDefs.beginG6ReadIterationFromG6FilePath(self._g6ReadIterator, FileName) != cappconst.OK: # <<<<<<<<<<<<<< - * raise RuntimeError(f"beginG6ReadIteration() failed.") + * if cg6IterationDefs.g6_InitReaderWithFileName(self._g6ReadIterator, FileName) != cappconst.OK: # <<<<<<<<<<<<<< + * raise RuntimeError(f"Unable to initialize reader with filename, as g6_InitReaderWithFileName() in EAPS graphLib failed.") * */ - __pyx_t_3 = (beginG6ReadIterationFromG6FilePath(__pyx_v_self->_g6ReadIterator, __pyx_v_FileName) != OK); + __pyx_t_3 = (g6_InitReaderWithFileName(__pyx_v_self->_g6ReadIterator, __pyx_v_FileName) != OK); if (unlikely(__pyx_t_3)) { - /* "planarity/full/g6IterationUtils.pyx":58 + /* "planarity/full/g6IterationUtils.pyx":54 * - * if cg6IterationDefs.beginG6ReadIterationFromG6FilePath(self._g6ReadIterator, FileName) != cappconst.OK: - * raise RuntimeError(f"beginG6ReadIteration() failed.") # <<<<<<<<<<<<<< + * if cg6IterationDefs.g6_InitReaderWithFileName(self._g6ReadIterator, FileName) != cappconst.OK: + * raise RuntimeError(f"Unable to initialize reader with filename, as g6_InitReaderWithFileName() in EAPS graphLib failed.") # <<<<<<<<<<<<<< * - * def read_graph(self): + * def g6_ReadGraph(self): */ __pyx_t_4 = NULL; __pyx_t_5 = 1; { - PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_beginG6ReadIteration_failed}; + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Unable_to_initialize_reader_with}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 58, __pyx_L1_error) + __PYX_ERR(0, 54, __pyx_L1_error) - /* "planarity/full/g6IterationUtils.pyx":57 + /* "planarity/full/g6IterationUtils.pyx":53 * cdef const char *FileName = encoded * - * if cg6IterationDefs.beginG6ReadIterationFromG6FilePath(self._g6ReadIterator, FileName) != cappconst.OK: # <<<<<<<<<<<<<< - * raise RuntimeError(f"beginG6ReadIteration() failed.") + * if cg6IterationDefs.g6_InitReaderWithFileName(self._g6ReadIterator, FileName) != cappconst.OK: # <<<<<<<<<<<<<< + * raise RuntimeError(f"Unable to initialize reader with filename, as g6_InitReaderWithFileName() in EAPS graphLib failed.") * */ } - /* "planarity/full/g6IterationUtils.pyx":52 - * return self._currGraph.gp_DupGraph() + /* "planarity/full/g6IterationUtils.pyx":48 + * return cg6IterationDefs.g6_EndReached(self._g6ReadIterator) * - * def begin_iteration(self, str infile_name): # <<<<<<<<<<<<<< + * def g6_InitReaderWithFileName(self, str infile_name): # <<<<<<<<<<<<<< * # Convert Python str to UTF-8 encoded bytes, and then to const char * * cdef bytes encoded = infile_name.encode('utf-8') */ @@ -3468,7 +3376,7 @@ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_1 __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.begin_iteration", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.g6_InitReaderWithFileName", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_encoded); @@ -3477,25 +3385,25 @@ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_1 return __pyx_r; } -/* "planarity/full/g6IterationUtils.pyx":60 - * raise RuntimeError(f"beginG6ReadIteration() failed.") +/* "planarity/full/g6IterationUtils.pyx":56 + * raise RuntimeError(f"Unable to initialize reader with filename, as g6_InitReaderWithFileName() in EAPS graphLib failed.") * - * def read_graph(self): # <<<<<<<<<<<<<< - * if cg6IterationDefs.readGraphUsingG6ReadIterator(self._g6ReadIterator) != cappconst.OK: - * raise RuntimeError(f"readGraphUsingG6ReadIterator() failed.") + * def g6_ReadGraph(self): # <<<<<<<<<<<<<< + * if cg6IterationDefs.g6_ReadGraph(self._g6ReadIterator) != cappconst.OK: + * raise RuntimeError(f"Unable to read graph, as g6_ReadGraph() in EAPS graphLib failed.") */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_13read_graph(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_13g6_ReadGraph(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_12read_graph, "G6ReadIterator.read_graph(self)"); -static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_13read_graph = {"read_graph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_13read_graph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_12read_graph}; -static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_13read_graph(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_12g6_ReadGraph, "G6ReadIterator.g6_ReadGraph(self)"); +static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_13g6_ReadGraph = {"g6_ReadGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_13g6_ReadGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_12g6_ReadGraph}; +static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_13g6_ReadGraph(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -3508,7 +3416,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_graph (wrapper)", 0); + __Pyx_RefNannySetupContext("g6_ReadGraph (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -3517,18 +3425,18 @@ PyObject *__pyx_args, PyObject *__pyx_kwds #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("read_graph", 1, 0, 0, __pyx_nargs); return NULL; } + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("g6_ReadGraph", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; - if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("read_graph", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_12read_graph(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *)__pyx_v_self)); + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("g6_ReadGraph", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_12g6_ReadGraph(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_12read_graph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self) { +static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_12g6_ReadGraph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -3538,53 +3446,53 @@ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_1 int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_graph", 0); + __Pyx_RefNannySetupContext("g6_ReadGraph", 0); - /* "planarity/full/g6IterationUtils.pyx":61 + /* "planarity/full/g6IterationUtils.pyx":57 * - * def read_graph(self): - * if cg6IterationDefs.readGraphUsingG6ReadIterator(self._g6ReadIterator) != cappconst.OK: # <<<<<<<<<<<<<< - * raise RuntimeError(f"readGraphUsingG6ReadIterator() failed.") + * def g6_ReadGraph(self): + * if cg6IterationDefs.g6_ReadGraph(self._g6ReadIterator) != cappconst.OK: # <<<<<<<<<<<<<< + * raise RuntimeError(f"Unable to read graph, as g6_ReadGraph() in EAPS graphLib failed.") * */ - __pyx_t_1 = (readGraphUsingG6ReadIterator(__pyx_v_self->_g6ReadIterator) != OK); + __pyx_t_1 = (g6_ReadGraph(__pyx_v_self->_g6ReadIterator) != OK); if (unlikely(__pyx_t_1)) { - /* "planarity/full/g6IterationUtils.pyx":62 - * def read_graph(self): - * if cg6IterationDefs.readGraphUsingG6ReadIterator(self._g6ReadIterator) != cappconst.OK: - * raise RuntimeError(f"readGraphUsingG6ReadIterator() failed.") # <<<<<<<<<<<<<< + /* "planarity/full/g6IterationUtils.pyx":58 + * def g6_ReadGraph(self): + * if cg6IterationDefs.g6_ReadGraph(self._g6ReadIterator) != cappconst.OK: + * raise RuntimeError(f"Unable to read graph, as g6_ReadGraph() in EAPS graphLib failed.") # <<<<<<<<<<<<<< * * */ __pyx_t_3 = NULL; __pyx_t_4 = 1; { - PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_readGraphUsingG6ReadIterator_fai}; + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Unable_to_read_graph_as_g6_ReadG}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 62, __pyx_L1_error) + __PYX_ERR(0, 58, __pyx_L1_error) - /* "planarity/full/g6IterationUtils.pyx":61 + /* "planarity/full/g6IterationUtils.pyx":57 * - * def read_graph(self): - * if cg6IterationDefs.readGraphUsingG6ReadIterator(self._g6ReadIterator) != cappconst.OK: # <<<<<<<<<<<<<< - * raise RuntimeError(f"readGraphUsingG6ReadIterator() failed.") + * def g6_ReadGraph(self): + * if cg6IterationDefs.g6_ReadGraph(self._g6ReadIterator) != cappconst.OK: # <<<<<<<<<<<<<< + * raise RuntimeError(f"Unable to read graph, as g6_ReadGraph() in EAPS graphLib failed.") * */ } - /* "planarity/full/g6IterationUtils.pyx":60 - * raise RuntimeError(f"beginG6ReadIteration() failed.") + /* "planarity/full/g6IterationUtils.pyx":56 + * raise RuntimeError(f"Unable to initialize reader with filename, as g6_InitReaderWithFileName() in EAPS graphLib failed.") * - * def read_graph(self): # <<<<<<<<<<<<<< - * if cg6IterationDefs.readGraphUsingG6ReadIterator(self._g6ReadIterator) != cappconst.OK: - * raise RuntimeError(f"readGraphUsingG6ReadIterator() failed.") + * def g6_ReadGraph(self): # <<<<<<<<<<<<<< + * if cg6IterationDefs.g6_ReadGraph(self._g6ReadIterator) != cappconst.OK: + * raise RuntimeError(f"Unable to read graph, as g6_ReadGraph() in EAPS graphLib failed.") */ /* function exit code */ @@ -3593,7 +3501,7 @@ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_1 __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.read_graph", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.g6_ReadGraph", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3807,7 +3715,7 @@ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_1 return __pyx_r; } -/* "planarity/full/g6IterationUtils.pyx":69 +/* "planarity/full/g6IterationUtils.pyx":65 * cdef graph.Graph _currGraph * * def __cinit__(self, graph.Graph graph_to_write): # <<<<<<<<<<<<<< @@ -3837,32 +3745,32 @@ static int __pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_1__cin { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_graph_to_write,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 69, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 65, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 69, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 65, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 69, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 65, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, i); __PYX_ERR(0, 69, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, i); __PYX_ERR(0, 65, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 69, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 65, __pyx_L3_error) } __pyx_v_graph_to_write = ((struct __pyx_obj_9planarity_4full_5graph_Graph *)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 69, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 65, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3873,7 +3781,7 @@ static int __pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_1__cin __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_graph_to_write), __pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, 1, "graph_to_write", 0))) __PYX_ERR(0, 69, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_graph_to_write), __pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, 1, "graph_to_write", 0))) __PYX_ERR(0, 65, __pyx_L1_error) __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator___cinit__(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *)__pyx_v_self), __pyx_v_graph_to_write); /* function exit code */ @@ -3906,19 +3814,19 @@ static int __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator___cini int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "planarity/full/g6IterationUtils.pyx":70 + /* "planarity/full/g6IterationUtils.pyx":66 * * def __cinit__(self, graph.Graph graph_to_write): * self._g6WriteIterator = NULL # <<<<<<<<<<<<<< * - * if graph_to_write.is_graph_NULL() or graph_to_write.gp_getN() == 0: + * if graph_to_write.is_graph_NULL() or graph_to_write.gp_GetN() == 0: */ __pyx_v_self->_g6WriteIterator = NULL; - /* "planarity/full/g6IterationUtils.pyx":72 + /* "planarity/full/g6IterationUtils.pyx":68 * self._g6WriteIterator = NULL * - * if graph_to_write.is_graph_NULL() or graph_to_write.gp_getN() == 0: # <<<<<<<<<<<<<< + * if graph_to_write.is_graph_NULL() or graph_to_write.gp_GetN() == 0: # <<<<<<<<<<<<<< * raise ValueError( * "Graph to write is invalid: either not allocated or not " */ @@ -3929,10 +3837,10 @@ static int __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator___cini PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_is_graph_NULL, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 72, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_5) { } else { @@ -3944,20 +3852,20 @@ static int __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator___cini __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; - __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_getN, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_GetN, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } - __pyx_t_5 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 72, __pyx_L1_error) + __pyx_t_5 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_5; __pyx_L4_bool_binop_done:; if (unlikely(__pyx_t_1)) { - /* "planarity/full/g6IterationUtils.pyx":73 + /* "planarity/full/g6IterationUtils.pyx":69 * - * if graph_to_write.is_graph_NULL() or graph_to_write.gp_getN() == 0: + * if graph_to_write.is_graph_NULL() or graph_to_write.gp_GetN() == 0: * raise ValueError( # <<<<<<<<<<<<<< * "Graph to write is invalid: either not allocated or not " * "initialized.") @@ -3968,28 +3876,28 @@ static int __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator___cini PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Graph_to_write_is_invalid_either}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 73, __pyx_L1_error) + __PYX_ERR(0, 69, __pyx_L1_error) - /* "planarity/full/g6IterationUtils.pyx":72 + /* "planarity/full/g6IterationUtils.pyx":68 * self._g6WriteIterator = NULL * - * if graph_to_write.is_graph_NULL() or graph_to_write.gp_getN() == 0: # <<<<<<<<<<<<<< + * if graph_to_write.is_graph_NULL() or graph_to_write.gp_GetN() == 0: # <<<<<<<<<<<<<< * raise ValueError( * "Graph to write is invalid: either not allocated or not " */ } - /* "planarity/full/g6IterationUtils.pyx":77 + /* "planarity/full/g6IterationUtils.pyx":73 * "initialized.") * * self._currGraph = graph_to_write # <<<<<<<<<<<<<< * - * if cg6IterationDefs.allocateG6WriteIterator(&self._g6WriteIterator, graph_to_write._theGraph) != cappconst.OK: + * if cg6IterationDefs.g6_NewWriter(&self._g6WriteIterator, graph_to_write._theGraph) != cappconst.OK: */ __Pyx_INCREF((PyObject *)__pyx_v_graph_to_write); __Pyx_GIVEREF((PyObject *)__pyx_v_graph_to_write); @@ -3997,46 +3905,46 @@ static int __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator___cini __Pyx_DECREF((PyObject *)__pyx_v_self->_currGraph); __pyx_v_self->_currGraph = __pyx_v_graph_to_write; - /* "planarity/full/g6IterationUtils.pyx":79 + /* "planarity/full/g6IterationUtils.pyx":75 * self._currGraph = graph_to_write * - * if cg6IterationDefs.allocateG6WriteIterator(&self._g6WriteIterator, graph_to_write._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< - * raise MemoryError("allocateG6WriteIterator() failed.") + * if cg6IterationDefs.g6_NewWriter(&self._g6WriteIterator, graph_to_write._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< + * raise MemoryError("Unable to initialize G6WriteIterator, as g6_NewWriter() in EAPS graphLib failed.") * */ - __pyx_t_1 = (allocateG6WriteIterator((&__pyx_v_self->_g6WriteIterator), __pyx_v_graph_to_write->_theGraph) != OK); + __pyx_t_1 = (g6_NewWriter((&__pyx_v_self->_g6WriteIterator), __pyx_v_graph_to_write->_theGraph) != OK); if (unlikely(__pyx_t_1)) { - /* "planarity/full/g6IterationUtils.pyx":80 + /* "planarity/full/g6IterationUtils.pyx":76 * - * if cg6IterationDefs.allocateG6WriteIterator(&self._g6WriteIterator, graph_to_write._theGraph) != cappconst.OK: - * raise MemoryError("allocateG6WriteIterator() failed.") # <<<<<<<<<<<<<< + * if cg6IterationDefs.g6_NewWriter(&self._g6WriteIterator, graph_to_write._theGraph) != cappconst.OK: + * raise MemoryError("Unable to initialize G6WriteIterator, as g6_NewWriter() in EAPS graphLib failed.") # <<<<<<<<<<<<<< * * def __dealloc__(self): */ __pyx_t_3 = NULL; __pyx_t_4 = 1; { - PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_allocateG6WriteIterator_failed}; + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Unable_to_initialize_G6WriteIter}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 80, __pyx_L1_error) + __PYX_ERR(0, 76, __pyx_L1_error) - /* "planarity/full/g6IterationUtils.pyx":79 + /* "planarity/full/g6IterationUtils.pyx":75 * self._currGraph = graph_to_write * - * if cg6IterationDefs.allocateG6WriteIterator(&self._g6WriteIterator, graph_to_write._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< - * raise MemoryError("allocateG6WriteIterator() failed.") + * if cg6IterationDefs.g6_NewWriter(&self._g6WriteIterator, graph_to_write._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< + * raise MemoryError("Unable to initialize G6WriteIterator, as g6_NewWriter() in EAPS graphLib failed.") * */ } - /* "planarity/full/g6IterationUtils.pyx":69 + /* "planarity/full/g6IterationUtils.pyx":65 * cdef graph.Graph _currGraph * * def __cinit__(self, graph.Graph graph_to_write): # <<<<<<<<<<<<<< @@ -4057,12 +3965,12 @@ static int __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator___cini return __pyx_r; } -/* "planarity/full/g6IterationUtils.pyx":82 - * raise MemoryError("allocateG6WriteIterator() failed.") +/* "planarity/full/g6IterationUtils.pyx":78 + * raise MemoryError("Unable to initialize G6WriteIterator, as g6_NewWriter() in EAPS graphLib failed.") * * def __dealloc__(self): # <<<<<<<<<<<<<< * if self._g6WriteIterator != NULL: - * if cg6IterationDefs.endG6WriteIteration(self._g6WriteIterator) != cappconst.OK: + * cg6IterationDefs.g6_FreeWriter(&self._g6WriteIterator) */ /* Python wrapper */ @@ -4079,494 +3987,79 @@ static void __pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_3__de } static void __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_2__dealloc__(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self) { - __Pyx_RefNannyDeclarations int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - size_t __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "planarity/full/g6IterationUtils.pyx":83 + /* "planarity/full/g6IterationUtils.pyx":79 * * def __dealloc__(self): * if self._g6WriteIterator != NULL: # <<<<<<<<<<<<<< - * if cg6IterationDefs.endG6WriteIteration(self._g6WriteIterator) != cappconst.OK: - * raise RuntimeError("endG6WriteIteration() failed.") + * cg6IterationDefs.g6_FreeWriter(&self._g6WriteIterator) + * */ __pyx_t_1 = (__pyx_v_self->_g6WriteIterator != NULL); if (__pyx_t_1) { - /* "planarity/full/g6IterationUtils.pyx":84 - * def __dealloc__(self): - * if self._g6WriteIterator != NULL: - * if cg6IterationDefs.endG6WriteIteration(self._g6WriteIterator) != cappconst.OK: # <<<<<<<<<<<<<< - * raise RuntimeError("endG6WriteIteration() failed.") - * -*/ - __pyx_t_1 = (endG6WriteIteration(__pyx_v_self->_g6WriteIterator) != OK); - if (unlikely(__pyx_t_1)) { - - /* "planarity/full/g6IterationUtils.pyx":85 - * if self._g6WriteIterator != NULL: - * if cg6IterationDefs.endG6WriteIteration(self._g6WriteIterator) != cappconst.OK: - * raise RuntimeError("endG6WriteIteration() failed.") # <<<<<<<<<<<<<< - * - * if cg6IterationDefs.freeG6WriteIterator(&self._g6WriteIterator) != cappconst.OK: -*/ - __pyx_t_3 = NULL; - __pyx_t_4 = 1; - { - PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_endG6WriteIteration_failed}; - __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 85, __pyx_L1_error) - - /* "planarity/full/g6IterationUtils.pyx":84 + /* "planarity/full/g6IterationUtils.pyx":80 * def __dealloc__(self): * if self._g6WriteIterator != NULL: - * if cg6IterationDefs.endG6WriteIteration(self._g6WriteIterator) != cappconst.OK: # <<<<<<<<<<<<<< - * raise RuntimeError("endG6WriteIteration() failed.") - * -*/ - } - - /* "planarity/full/g6IterationUtils.pyx":87 - * raise RuntimeError("endG6WriteIteration() failed.") - * - * if cg6IterationDefs.freeG6WriteIterator(&self._g6WriteIterator) != cappconst.OK: # <<<<<<<<<<<<<< - * raise MemoryError("freeG6WriteIterator() failed.") - * -*/ - __pyx_t_1 = (freeG6WriteIterator((&__pyx_v_self->_g6WriteIterator)) != OK); - if (unlikely(__pyx_t_1)) { - - /* "planarity/full/g6IterationUtils.pyx":88 - * - * if cg6IterationDefs.freeG6WriteIterator(&self._g6WriteIterator) != cappconst.OK: - * raise MemoryError("freeG6WriteIterator() failed.") # <<<<<<<<<<<<<< - * - * def begin_iteration(self, str outfile_name): -*/ - __pyx_t_3 = NULL; - __pyx_t_4 = 1; - { - PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_freeG6WriteIterator_failed}; - __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 88, __pyx_L1_error) - - /* "planarity/full/g6IterationUtils.pyx":87 - * raise RuntimeError("endG6WriteIteration() failed.") - * - * if cg6IterationDefs.freeG6WriteIterator(&self._g6WriteIterator) != cappconst.OK: # <<<<<<<<<<<<<< - * raise MemoryError("freeG6WriteIterator() failed.") + * cg6IterationDefs.g6_FreeWriter(&self._g6WriteIterator) # <<<<<<<<<<<<<< * + * def reinitialize_currGraph(self): */ - } + (void)(g6_FreeWriter((&__pyx_v_self->_g6WriteIterator))); - /* "planarity/full/g6IterationUtils.pyx":83 + /* "planarity/full/g6IterationUtils.pyx":79 * * def __dealloc__(self): * if self._g6WriteIterator != NULL: # <<<<<<<<<<<<<< - * if cg6IterationDefs.endG6WriteIteration(self._g6WriteIterator) != cappconst.OK: - * raise RuntimeError("endG6WriteIteration() failed.") + * cg6IterationDefs.g6_FreeWriter(&self._g6WriteIterator) + * */ } - /* "planarity/full/g6IterationUtils.pyx":82 - * raise MemoryError("allocateG6WriteIterator() failed.") + /* "planarity/full/g6IterationUtils.pyx":78 + * raise MemoryError("Unable to initialize G6WriteIterator, as g6_NewWriter() in EAPS graphLib failed.") * * def __dealloc__(self): # <<<<<<<<<<<<<< * if self._g6WriteIterator != NULL: - * if cg6IterationDefs.endG6WriteIteration(self._g6WriteIterator) != cappconst.OK: + * cg6IterationDefs.g6_FreeWriter(&self._g6WriteIterator) */ /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_WriteUnraisable("planarity.full.g6IterationUtils.G6WriteIterator.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __pyx_L0:; - __Pyx_RefNannyFinishContext(); } -/* "planarity/full/g6IterationUtils.pyx":90 - * raise MemoryError("freeG6WriteIterator() failed.") +/* "planarity/full/g6IterationUtils.pyx":82 + * cg6IterationDefs.g6_FreeWriter(&self._g6WriteIterator) + * + * def reinitialize_currGraph(self): # <<<<<<<<<<<<<< + * self._currGraph.gp_ReinitializeGraph() * - * def begin_iteration(self, str outfile_name): # <<<<<<<<<<<<<< - * # Convert Python str to UTF-8 encoded bytes, and then to const char * - * cdef bytes encoded = outfile_name.encode('utf-8') */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_5begin_iteration(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_5reinitialize_currGraph(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_4begin_iteration, "G6WriteIterator.begin_iteration(self, str outfile_name)"); -static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_5begin_iteration = {"begin_iteration", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_5begin_iteration, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_4begin_iteration}; -static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_5begin_iteration(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_4reinitialize_currGraph, "G6WriteIterator.reinitialize_currGraph(self)"); +static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_5reinitialize_currGraph = {"reinitialize_currGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_5reinitialize_currGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_4reinitialize_currGraph}; +static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_5reinitialize_currGraph(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { - PyObject *__pyx_v_outfile_name = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[1] = {0}; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("begin_iteration (wrapper)", 0); - #if !CYTHON_METH_FASTCALL - #if CYTHON_ASSUME_SAFE_SIZE - __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #else - __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; - #endif - #endif - __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - { - PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_outfile_name,0}; - const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 90, __pyx_L3_error) - if (__pyx_kwds_len > 0) { - switch (__pyx_nargs) { - case 1: - values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 90, __pyx_L3_error) - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "begin_iteration", 0) < (0)) __PYX_ERR(0, 90, __pyx_L3_error) - for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("begin_iteration", 1, 1, 1, i); __PYX_ERR(0, 90, __pyx_L3_error) } - } - } else if (unlikely(__pyx_nargs != 1)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 90, __pyx_L3_error) - } - __pyx_v_outfile_name = ((PyObject*)values[0]); - } - goto __pyx_L6_skip; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("begin_iteration", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 90, __pyx_L3_error) - __pyx_L6_skip:; - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - Py_XDECREF(values[__pyx_temp]); - } - __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6WriteIterator.begin_iteration", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_outfile_name), (&PyUnicode_Type), 1, "outfile_name", 1))) __PYX_ERR(0, 90, __pyx_L1_error) - __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_4begin_iteration(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *)__pyx_v_self), __pyx_v_outfile_name); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - Py_XDECREF(values[__pyx_temp]); - } - goto __pyx_L7_cleaned_up; - __pyx_L0:; - for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - Py_XDECREF(values[__pyx_temp]); - } - __pyx_L7_cleaned_up:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_4begin_iteration(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self, PyObject *__pyx_v_outfile_name) { - PyObject *__pyx_v_encoded = 0; - char const *__pyx_v_FileName; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - char const *__pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - size_t __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("begin_iteration", 0); - - /* "planarity/full/g6IterationUtils.pyx":92 - * def begin_iteration(self, str outfile_name): - * # Convert Python str to UTF-8 encoded bytes, and then to const char * - * cdef bytes encoded = outfile_name.encode('utf-8') # <<<<<<<<<<<<<< - * cdef const char *FileName = encoded - * -*/ - if (unlikely(__pyx_v_outfile_name == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); - __PYX_ERR(0, 92, __pyx_L1_error) - } - __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_outfile_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_encoded = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "planarity/full/g6IterationUtils.pyx":93 - * # Convert Python str to UTF-8 encoded bytes, and then to const char * - * cdef bytes encoded = outfile_name.encode('utf-8') - * cdef const char *FileName = encoded # <<<<<<<<<<<<<< - * - * if cg6IterationDefs.beginG6WriteIterationToG6FilePath(self._g6WriteIterator, FileName) != cappconst.OK: -*/ - __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_encoded); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 93, __pyx_L1_error) - __pyx_v_FileName = __pyx_t_2; - - /* "planarity/full/g6IterationUtils.pyx":95 - * cdef const char *FileName = encoded - * - * if cg6IterationDefs.beginG6WriteIterationToG6FilePath(self._g6WriteIterator, FileName) != cappconst.OK: # <<<<<<<<<<<<<< - * raise RuntimeError(f"beginG6WriteIteration() failed.") - * -*/ - __pyx_t_3 = (beginG6WriteIterationToG6FilePath(__pyx_v_self->_g6WriteIterator, __pyx_v_FileName) != OK); - if (unlikely(__pyx_t_3)) { - - /* "planarity/full/g6IterationUtils.pyx":96 - * - * if cg6IterationDefs.beginG6WriteIterationToG6FilePath(self._g6WriteIterator, FileName) != cappconst.OK: - * raise RuntimeError(f"beginG6WriteIteration() failed.") # <<<<<<<<<<<<<< - * - * def write_graph(self): -*/ - __pyx_t_4 = NULL; - __pyx_t_5 = 1; - { - PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_beginG6WriteIteration_failed}; - __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 96, __pyx_L1_error) - - /* "planarity/full/g6IterationUtils.pyx":95 - * cdef const char *FileName = encoded - * - * if cg6IterationDefs.beginG6WriteIterationToG6FilePath(self._g6WriteIterator, FileName) != cappconst.OK: # <<<<<<<<<<<<<< - * raise RuntimeError(f"beginG6WriteIteration() failed.") - * -*/ - } - - /* "planarity/full/g6IterationUtils.pyx":90 - * raise MemoryError("freeG6WriteIterator() failed.") - * - * def begin_iteration(self, str outfile_name): # <<<<<<<<<<<<<< - * # Convert Python str to UTF-8 encoded bytes, and then to const char * - * cdef bytes encoded = outfile_name.encode('utf-8') -*/ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6WriteIterator.begin_iteration", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_encoded); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "planarity/full/g6IterationUtils.pyx":98 - * raise RuntimeError(f"beginG6WriteIteration() failed.") - * - * def write_graph(self): # <<<<<<<<<<<<<< - * if cg6IterationDefs.writeGraphUsingG6WriteIterator(self._g6WriteIterator) != cappconst.OK: - * raise RuntimeError(f"writeGraphUsingG6WriteIterator() failed.") -*/ - -/* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_7write_graph(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_6write_graph, "G6WriteIterator.write_graph(self)"); -static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_7write_graph = {"write_graph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_7write_graph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_6write_graph}; -static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_7write_graph(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED Py_ssize_t __pyx_nargs; - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_graph (wrapper)", 0); - #if !CYTHON_METH_FASTCALL - #if CYTHON_ASSUME_SAFE_SIZE - __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #else - __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; - #endif - #endif - __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("write_graph", 1, 0, 0, __pyx_nargs); return NULL; } - const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len < 0)) return NULL; - if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("write_graph", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_6write_graph(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_6write_graph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - size_t __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_graph", 0); - - /* "planarity/full/g6IterationUtils.pyx":99 - * - * def write_graph(self): - * if cg6IterationDefs.writeGraphUsingG6WriteIterator(self._g6WriteIterator) != cappconst.OK: # <<<<<<<<<<<<<< - * raise RuntimeError(f"writeGraphUsingG6WriteIterator() failed.") - * -*/ - __pyx_t_1 = (writeGraphUsingG6WriteIterator(__pyx_v_self->_g6WriteIterator) != OK); - if (unlikely(__pyx_t_1)) { - - /* "planarity/full/g6IterationUtils.pyx":100 - * def write_graph(self): - * if cg6IterationDefs.writeGraphUsingG6WriteIterator(self._g6WriteIterator) != cappconst.OK: - * raise RuntimeError(f"writeGraphUsingG6WriteIterator() failed.") # <<<<<<<<<<<<<< - * - * def reinitialize_currGraph(self): -*/ - __pyx_t_3 = NULL; - __pyx_t_4 = 1; - { - PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_writeGraphUsingG6WriteIterator_f}; - __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 100, __pyx_L1_error) - - /* "planarity/full/g6IterationUtils.pyx":99 - * - * def write_graph(self): - * if cg6IterationDefs.writeGraphUsingG6WriteIterator(self._g6WriteIterator) != cappconst.OK: # <<<<<<<<<<<<<< - * raise RuntimeError(f"writeGraphUsingG6WriteIterator() failed.") - * -*/ - } - - /* "planarity/full/g6IterationUtils.pyx":98 - * raise RuntimeError(f"beginG6WriteIteration() failed.") - * - * def write_graph(self): # <<<<<<<<<<<<<< - * if cg6IterationDefs.writeGraphUsingG6WriteIterator(self._g6WriteIterator) != cappconst.OK: - * raise RuntimeError(f"writeGraphUsingG6WriteIterator() failed.") -*/ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6WriteIterator.write_graph", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "planarity/full/g6IterationUtils.pyx":102 - * raise RuntimeError(f"writeGraphUsingG6WriteIterator() failed.") - * - * def reinitialize_currGraph(self): # <<<<<<<<<<<<<< - * self._currGraph.gp_ReinitializeGraph() - * -*/ - -/* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_9reinitialize_currGraph(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_8reinitialize_currGraph, "G6WriteIterator.reinitialize_currGraph(self)"); -static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_9reinitialize_currGraph = {"reinitialize_currGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_9reinitialize_currGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_8reinitialize_currGraph}; -static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_9reinitialize_currGraph(PyObject *__pyx_v_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED Py_ssize_t __pyx_nargs; - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("reinitialize_currGraph (wrapper)", 0); + __Pyx_RefNannySetupContext("reinitialize_currGraph (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -4579,14 +4072,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("reinitialize_currGraph", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_8reinitialize_currGraph(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *)__pyx_v_self)); + __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_4reinitialize_currGraph(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_8reinitialize_currGraph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self) { +static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_4reinitialize_currGraph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4597,7 +4090,7 @@ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("reinitialize_currGraph", 0); - /* "planarity/full/g6IterationUtils.pyx":103 + /* "planarity/full/g6IterationUtils.pyx":83 * * def reinitialize_currGraph(self): * self._currGraph.gp_ReinitializeGraph() # <<<<<<<<<<<<<< @@ -4611,13 +4104,13 @@ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_ PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_ReinitializeGraph, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "planarity/full/g6IterationUtils.pyx":102 - * raise RuntimeError(f"writeGraphUsingG6WriteIterator() failed.") + /* "planarity/full/g6IterationUtils.pyx":82 + * cg6IterationDefs.g6_FreeWriter(&self._g6WriteIterator) * * def reinitialize_currGraph(self): # <<<<<<<<<<<<<< * self._currGraph.gp_ReinitializeGraph() @@ -4638,25 +4131,25 @@ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_ return __pyx_r; } -/* "planarity/full/g6IterationUtils.pyx":105 +/* "planarity/full/g6IterationUtils.pyx":85 * self._currGraph.gp_ReinitializeGraph() * * def update_graph_to_write(self, graph.Graph next_graph): # <<<<<<<<<<<<<< - * if next_graph.is_graph_NULL() or next_graph.gp_getN() == 0: + * if next_graph.is_graph_NULL() or next_graph.gp_GetN() == 0: * raise ValueError( */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_11update_graph_to_write(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_7update_graph_to_write(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_10update_graph_to_write, "G6WriteIterator.update_graph_to_write(self, Graph next_graph)"); -static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_11update_graph_to_write = {"update_graph_to_write", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_11update_graph_to_write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_10update_graph_to_write}; -static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_11update_graph_to_write(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_6update_graph_to_write, "G6WriteIterator.update_graph_to_write(self, Graph next_graph)"); +static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_7update_graph_to_write = {"update_graph_to_write", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_7update_graph_to_write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_6update_graph_to_write}; +static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_7update_graph_to_write(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -4686,32 +4179,32 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_next_graph,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 105, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 85, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 105, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 85, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "update_graph_to_write", 0) < (0)) __PYX_ERR(0, 105, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "update_graph_to_write", 0) < (0)) __PYX_ERR(0, 85, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("update_graph_to_write", 1, 1, 1, i); __PYX_ERR(0, 105, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("update_graph_to_write", 1, 1, 1, i); __PYX_ERR(0, 85, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 105, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 85, __pyx_L3_error) } __pyx_v_next_graph = ((struct __pyx_obj_9planarity_4full_5graph_Graph *)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("update_graph_to_write", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 105, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("update_graph_to_write", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 85, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4722,8 +4215,8 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_next_graph), __pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, 1, "next_graph", 0))) __PYX_ERR(0, 105, __pyx_L1_error) - __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_10update_graph_to_write(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *)__pyx_v_self), __pyx_v_next_graph); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_next_graph), __pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, 1, "next_graph", 0))) __PYX_ERR(0, 85, __pyx_L1_error) + __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_6update_graph_to_write(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *)__pyx_v_self), __pyx_v_next_graph); /* function exit code */ goto __pyx_L0; @@ -4742,7 +4235,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_10update_graph_to_write(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self, struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_next_graph) { +static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_6update_graph_to_write(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self, struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_next_graph) { PyObject *__pyx_v_copy_graph_error = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -4769,238 +4262,571 @@ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("update_graph_to_write", 0); + __Pyx_RefNannySetupContext("update_graph_to_write", 0); + + /* "planarity/full/g6IterationUtils.pyx":86 + * + * def update_graph_to_write(self, graph.Graph next_graph): + * if next_graph.is_graph_NULL() or next_graph.gp_GetN() == 0: # <<<<<<<<<<<<<< + * raise ValueError( + * "Graph to write is invalid: either not allocated or not " +*/ + __pyx_t_3 = ((PyObject *)__pyx_v_next_graph); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_is_graph_NULL, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!__pyx_t_5) { + } else { + __pyx_t_1 = __pyx_t_5; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = ((PyObject *)__pyx_v_next_graph); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_GetN, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_5 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __pyx_t_5; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { + + /* "planarity/full/g6IterationUtils.pyx":87 + * def update_graph_to_write(self, graph.Graph next_graph): + * if next_graph.is_graph_NULL() or next_graph.gp_GetN() == 0: + * raise ValueError( # <<<<<<<<<<<<<< + * "Graph to write is invalid: either not allocated or not " + * "initialized.") +*/ + __pyx_t_3 = NULL; + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Graph_to_write_is_invalid_either}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 87, __pyx_L1_error) + + /* "planarity/full/g6IterationUtils.pyx":86 + * + * def update_graph_to_write(self, graph.Graph next_graph): + * if next_graph.is_graph_NULL() or next_graph.gp_GetN() == 0: # <<<<<<<<<<<<<< + * raise ValueError( + * "Graph to write is invalid: either not allocated or not " +*/ + } + + /* "planarity/full/g6IterationUtils.pyx":91 + * "initialized.") + * + * try: # <<<<<<<<<<<<<< + * self._currGraph.gp_CopyGraph(next_graph) + * except RuntimeError as copy_graph_error: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + /*try:*/ { + + /* "planarity/full/g6IterationUtils.pyx":92 + * + * try: + * self._currGraph.gp_CopyGraph(next_graph) # <<<<<<<<<<<<<< + * except RuntimeError as copy_graph_error: + * raise RuntimeError( +*/ + __pyx_t_3 = ((PyObject *)__pyx_v_self->_currGraph); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_next_graph)}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_CopyGraph, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "planarity/full/g6IterationUtils.pyx":91 + * "initialized.") + * + * try: # <<<<<<<<<<<<<< + * self._currGraph.gp_CopyGraph(next_graph) + * except RuntimeError as copy_graph_error: +*/ + } + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L11_try_end; + __pyx_L6_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "planarity/full/g6IterationUtils.pyx":93 + * try: + * self._currGraph.gp_CopyGraph(next_graph) + * except RuntimeError as copy_graph_error: # <<<<<<<<<<<<<< + * raise RuntimeError( + * "Failed to copy next_graph into G6WriteIterator's currGraph." +*/ + __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_RuntimeError)))); + if (__pyx_t_9) { + __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6WriteIterator.update_graph_to_write", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_10) < 0) __PYX_ERR(0, 93, __pyx_L8_except_error) + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_INCREF(__pyx_t_3); + __pyx_v_copy_graph_error = __pyx_t_3; + /*try:*/ { + + /* "planarity/full/g6IterationUtils.pyx":94 + * self._currGraph.gp_CopyGraph(next_graph) + * except RuntimeError as copy_graph_error: + * raise RuntimeError( # <<<<<<<<<<<<<< + * "Failed to copy next_graph into G6WriteIterator's currGraph." + * ) from copy_graph_error +*/ + __pyx_t_12 = NULL; + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_mstate_global->__pyx_kp_u_Failed_to_copy_next_graph_into_G}; + __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 94, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_11); + } + + /* "planarity/full/g6IterationUtils.pyx":96 + * raise RuntimeError( + * "Failed to copy next_graph into G6WriteIterator's currGraph." + * ) from copy_graph_error # <<<<<<<<<<<<<< + * + * def g6_InitWriterWithFileName(self, str outfile_name): +*/ + __Pyx_Raise(__pyx_t_11, 0, 0, __pyx_v_copy_graph_error); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __PYX_ERR(0, 94, __pyx_L17_error) + } + + /* "planarity/full/g6IterationUtils.pyx":93 + * try: + * self._currGraph.gp_CopyGraph(next_graph) + * except RuntimeError as copy_graph_error: # <<<<<<<<<<<<<< + * raise RuntimeError( + * "Failed to copy next_graph into G6WriteIterator's currGraph." +*/ + /*finally:*/ { + __pyx_L17_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_ExceptionSwap(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20); + if ( unlikely(__Pyx_GetException(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17) < 0)) __Pyx_ErrFetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17); + __Pyx_XGOTREF(__pyx_t_15); + __Pyx_XGOTREF(__pyx_t_16); + __Pyx_XGOTREF(__pyx_t_17); + __Pyx_XGOTREF(__pyx_t_18); + __Pyx_XGOTREF(__pyx_t_19); + __Pyx_XGOTREF(__pyx_t_20); + __pyx_t_9 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename; + { + __Pyx_DECREF(__pyx_v_copy_graph_error); __pyx_v_copy_graph_error = 0; + } + __Pyx_XGIVEREF(__pyx_t_18); + __Pyx_XGIVEREF(__pyx_t_19); + __Pyx_XGIVEREF(__pyx_t_20); + __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_19, __pyx_t_20); + __Pyx_XGIVEREF(__pyx_t_15); + __Pyx_XGIVEREF(__pyx_t_16); + __Pyx_XGIVEREF(__pyx_t_17); + __Pyx_ErrRestore(__pyx_t_15, __pyx_t_16, __pyx_t_17); + __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; + __pyx_lineno = __pyx_t_9; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14; + goto __pyx_L8_except_error; + } + } + } + goto __pyx_L8_except_error; + + /* "planarity/full/g6IterationUtils.pyx":91 + * "initialized.") + * + * try: # <<<<<<<<<<<<<< + * self._currGraph.gp_CopyGraph(next_graph) + * except RuntimeError as copy_graph_error: +*/ + __pyx_L8_except_error:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + goto __pyx_L1_error; + __pyx_L11_try_end:; + } + + /* "planarity/full/g6IterationUtils.pyx":85 + * self._currGraph.gp_ReinitializeGraph() + * + * def update_graph_to_write(self, graph.Graph next_graph): # <<<<<<<<<<<<<< + * if next_graph.is_graph_NULL() or next_graph.gp_GetN() == 0: + * raise ValueError( +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6WriteIterator.update_graph_to_write", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_copy_graph_error); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "planarity/full/g6IterationUtils.pyx":98 + * ) from copy_graph_error + * + * def g6_InitWriterWithFileName(self, str outfile_name): # <<<<<<<<<<<<<< + * # Convert Python str to UTF-8 encoded bytes, and then to const char * + * cdef bytes encoded = outfile_name.encode('utf-8') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_9g6_InitWriterWithFileName(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_8g6_InitWriterWithFileName, "G6WriteIterator.g6_InitWriterWithFileName(self, str outfile_name)"); +static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_9g6_InitWriterWithFileName = {"g6_InitWriterWithFileName", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_9g6_InitWriterWithFileName, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_8g6_InitWriterWithFileName}; +static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_9g6_InitWriterWithFileName(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_outfile_name = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("g6_InitWriterWithFileName (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_outfile_name,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 98, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 98, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "g6_InitWriterWithFileName", 0) < (0)) __PYX_ERR(0, 98, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("g6_InitWriterWithFileName", 1, 1, 1, i); __PYX_ERR(0, 98, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 98, __pyx_L3_error) + } + __pyx_v_outfile_name = ((PyObject*)values[0]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("g6_InitWriterWithFileName", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 98, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6WriteIterator.g6_InitWriterWithFileName", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_outfile_name), (&PyUnicode_Type), 1, "outfile_name", 1))) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_8g6_InitWriterWithFileName(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *)__pyx_v_self), __pyx_v_outfile_name); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + goto __pyx_L7_cleaned_up; + __pyx_L0:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __pyx_L7_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_8g6_InitWriterWithFileName(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self, PyObject *__pyx_v_outfile_name) { + PyObject *__pyx_v_encoded = 0; + char const *__pyx_v_FileName; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + char const *__pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("g6_InitWriterWithFileName", 0); + + /* "planarity/full/g6IterationUtils.pyx":100 + * def g6_InitWriterWithFileName(self, str outfile_name): + * # Convert Python str to UTF-8 encoded bytes, and then to const char * + * cdef bytes encoded = outfile_name.encode('utf-8') # <<<<<<<<<<<<<< + * cdef const char *FileName = encoded + * +*/ + if (unlikely(__pyx_v_outfile_name == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); + __PYX_ERR(0, 100, __pyx_L1_error) + } + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_outfile_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_encoded = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "planarity/full/g6IterationUtils.pyx":101 + * # Convert Python str to UTF-8 encoded bytes, and then to const char * + * cdef bytes encoded = outfile_name.encode('utf-8') + * cdef const char *FileName = encoded # <<<<<<<<<<<<<< + * + * if cg6IterationDefs.g6_InitWriterWithFileName(self._g6WriteIterator, FileName) != cappconst.OK: +*/ + __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_encoded); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L1_error) + __pyx_v_FileName = __pyx_t_2; + + /* "planarity/full/g6IterationUtils.pyx":103 + * cdef const char *FileName = encoded + * + * if cg6IterationDefs.g6_InitWriterWithFileName(self._g6WriteIterator, FileName) != cappconst.OK: # <<<<<<<<<<<<<< + * raise RuntimeError(f"Unable to initialize writer with filename, as g6_InitWriterWithFileName() in EAPS graphLib failed.") + * +*/ + __pyx_t_3 = (g6_InitWriterWithFileName(__pyx_v_self->_g6WriteIterator, __pyx_v_FileName) != OK); + if (unlikely(__pyx_t_3)) { + + /* "planarity/full/g6IterationUtils.pyx":104 + * + * if cg6IterationDefs.g6_InitWriterWithFileName(self._g6WriteIterator, FileName) != cappconst.OK: + * raise RuntimeError(f"Unable to initialize writer with filename, as g6_InitWriterWithFileName() in EAPS graphLib failed.") # <<<<<<<<<<<<<< + * + * def g6_WriteGraph(self): +*/ + __pyx_t_4 = NULL; + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Unable_to_initialize_writer_with}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 104, __pyx_L1_error) + + /* "planarity/full/g6IterationUtils.pyx":103 + * cdef const char *FileName = encoded + * + * if cg6IterationDefs.g6_InitWriterWithFileName(self._g6WriteIterator, FileName) != cappconst.OK: # <<<<<<<<<<<<<< + * raise RuntimeError(f"Unable to initialize writer with filename, as g6_InitWriterWithFileName() in EAPS graphLib failed.") + * +*/ + } + + /* "planarity/full/g6IterationUtils.pyx":98 + * ) from copy_graph_error + * + * def g6_InitWriterWithFileName(self, str outfile_name): # <<<<<<<<<<<<<< + * # Convert Python str to UTF-8 encoded bytes, and then to const char * + * cdef bytes encoded = outfile_name.encode('utf-8') +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6WriteIterator.g6_InitWriterWithFileName", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_encoded); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "planarity/full/g6IterationUtils.pyx":106 + * raise RuntimeError(f"Unable to initialize writer with filename, as g6_InitWriterWithFileName() in EAPS graphLib failed.") + * + * def g6_WriteGraph(self): # <<<<<<<<<<<<<< + * if cg6IterationDefs.g6_WriteGraph(self._g6WriteIterator) != cappconst.OK: + * raise RuntimeError(f"Unable to write graph, as g6_WriteGraph() in EAPS graphLib failed.") +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_11g6_WriteGraph(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_10g6_WriteGraph, "G6WriteIterator.g6_WriteGraph(self)"); +static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_11g6_WriteGraph = {"g6_WriteGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_11g6_WriteGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_10g6_WriteGraph}; +static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_11g6_WriteGraph(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("g6_WriteGraph (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("g6_WriteGraph", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("g6_WriteGraph", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_10g6_WriteGraph(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_10g6_WriteGraph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("g6_WriteGraph", 0); - /* "planarity/full/g6IterationUtils.pyx":106 + /* "planarity/full/g6IterationUtils.pyx":107 * - * def update_graph_to_write(self, graph.Graph next_graph): - * if next_graph.is_graph_NULL() or next_graph.gp_getN() == 0: # <<<<<<<<<<<<<< - * raise ValueError( - * "Graph to write is invalid: either not allocated or not " + * def g6_WriteGraph(self): + * if cg6IterationDefs.g6_WriteGraph(self._g6WriteIterator) != cappconst.OK: # <<<<<<<<<<<<<< + * raise RuntimeError(f"Unable to write graph, as g6_WriteGraph() in EAPS graphLib failed.") */ - __pyx_t_3 = ((PyObject *)__pyx_v_next_graph); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = 0; - { - PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; - __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_is_graph_NULL, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!__pyx_t_5) { - } else { - __pyx_t_1 = __pyx_t_5; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_3 = ((PyObject *)__pyx_v_next_graph); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = 0; - { - PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; - __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_getN, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } - __pyx_t_5 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = __pyx_t_5; - __pyx_L4_bool_binop_done:; + __pyx_t_1 = (g6_WriteGraph(__pyx_v_self->_g6WriteIterator) != OK); if (unlikely(__pyx_t_1)) { - /* "planarity/full/g6IterationUtils.pyx":107 - * def update_graph_to_write(self, graph.Graph next_graph): - * if next_graph.is_graph_NULL() or next_graph.gp_getN() == 0: - * raise ValueError( # <<<<<<<<<<<<<< - * "Graph to write is invalid: either not allocated or not " - * "initialized.") + /* "planarity/full/g6IterationUtils.pyx":108 + * def g6_WriteGraph(self): + * if cg6IterationDefs.g6_WriteGraph(self._g6WriteIterator) != cappconst.OK: + * raise RuntimeError(f"Unable to write graph, as g6_WriteGraph() in EAPS graphLib failed.") # <<<<<<<<<<<<<< */ __pyx_t_3 = NULL; __pyx_t_4 = 1; { - PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Graph_to_write_is_invalid_either}; - __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Unable_to_write_graph_as_g6_Writ}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 107, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 107, __pyx_L1_error) - - /* "planarity/full/g6IterationUtils.pyx":106 - * - * def update_graph_to_write(self, graph.Graph next_graph): - * if next_graph.is_graph_NULL() or next_graph.gp_getN() == 0: # <<<<<<<<<<<<<< - * raise ValueError( - * "Graph to write is invalid: either not allocated or not " -*/ - } - - /* "planarity/full/g6IterationUtils.pyx":111 - * "initialized.") - * - * try: # <<<<<<<<<<<<<< - * self._currGraph.gp_CopyGraph(next_graph) - * except RuntimeError as copy_graph_error: -*/ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - /*try:*/ { - - /* "planarity/full/g6IterationUtils.pyx":112 - * - * try: - * self._currGraph.gp_CopyGraph(next_graph) # <<<<<<<<<<<<<< - * except RuntimeError as copy_graph_error: - * raise RuntimeError( -*/ - __pyx_t_3 = ((PyObject *)__pyx_v_self->_currGraph); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = 0; - { - PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_next_graph)}; - __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_CopyGraph, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "planarity/full/g6IterationUtils.pyx":111 - * "initialized.") - * - * try: # <<<<<<<<<<<<<< - * self._currGraph.gp_CopyGraph(next_graph) - * except RuntimeError as copy_graph_error: -*/ - } - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L11_try_end; - __pyx_L6_error:; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "planarity/full/g6IterationUtils.pyx":113 - * try: - * self._currGraph.gp_CopyGraph(next_graph) - * except RuntimeError as copy_graph_error: # <<<<<<<<<<<<<< - * raise RuntimeError( - * "Failed to copy next_graph into G6WriteIterator's currGraph." -*/ - __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_RuntimeError)))); - if (__pyx_t_9) { - __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6WriteIterator.update_graph_to_write", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_10) < 0) __PYX_ERR(0, 113, __pyx_L8_except_error) - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_INCREF(__pyx_t_3); - __pyx_v_copy_graph_error = __pyx_t_3; - /*try:*/ { - - /* "planarity/full/g6IterationUtils.pyx":114 - * self._currGraph.gp_CopyGraph(next_graph) - * except RuntimeError as copy_graph_error: - * raise RuntimeError( # <<<<<<<<<<<<<< - * "Failed to copy next_graph into G6WriteIterator's currGraph." - * ) from copy_graph_error -*/ - __pyx_t_12 = NULL; - __pyx_t_4 = 1; - { - PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_mstate_global->__pyx_kp_u_Failed_to_copy_next_graph_into_G}; - __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 114, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_11); - } - - /* "planarity/full/g6IterationUtils.pyx":116 - * raise RuntimeError( - * "Failed to copy next_graph into G6WriteIterator's currGraph." - * ) from copy_graph_error # <<<<<<<<<<<<<< -*/ - __Pyx_Raise(__pyx_t_11, 0, 0, __pyx_v_copy_graph_error); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __PYX_ERR(0, 114, __pyx_L17_error) - } - - /* "planarity/full/g6IterationUtils.pyx":113 - * try: - * self._currGraph.gp_CopyGraph(next_graph) - * except RuntimeError as copy_graph_error: # <<<<<<<<<<<<<< - * raise RuntimeError( - * "Failed to copy next_graph into G6WriteIterator's currGraph." -*/ - /*finally:*/ { - __pyx_L17_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_ExceptionSwap(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20); - if ( unlikely(__Pyx_GetException(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17) < 0)) __Pyx_ErrFetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17); - __Pyx_XGOTREF(__pyx_t_15); - __Pyx_XGOTREF(__pyx_t_16); - __Pyx_XGOTREF(__pyx_t_17); - __Pyx_XGOTREF(__pyx_t_18); - __Pyx_XGOTREF(__pyx_t_19); - __Pyx_XGOTREF(__pyx_t_20); - __pyx_t_9 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename; - { - __Pyx_DECREF(__pyx_v_copy_graph_error); __pyx_v_copy_graph_error = 0; - } - __Pyx_XGIVEREF(__pyx_t_18); - __Pyx_XGIVEREF(__pyx_t_19); - __Pyx_XGIVEREF(__pyx_t_20); - __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_19, __pyx_t_20); - __Pyx_XGIVEREF(__pyx_t_15); - __Pyx_XGIVEREF(__pyx_t_16); - __Pyx_XGIVEREF(__pyx_t_17); - __Pyx_ErrRestore(__pyx_t_15, __pyx_t_16, __pyx_t_17); - __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; - __pyx_lineno = __pyx_t_9; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14; - goto __pyx_L8_except_error; - } - } - } - goto __pyx_L8_except_error; + __PYX_ERR(0, 108, __pyx_L1_error) - /* "planarity/full/g6IterationUtils.pyx":111 - * "initialized.") + /* "planarity/full/g6IterationUtils.pyx":107 * - * try: # <<<<<<<<<<<<<< - * self._currGraph.gp_CopyGraph(next_graph) - * except RuntimeError as copy_graph_error: + * def g6_WriteGraph(self): + * if cg6IterationDefs.g6_WriteGraph(self._g6WriteIterator) != cappconst.OK: # <<<<<<<<<<<<<< + * raise RuntimeError(f"Unable to write graph, as g6_WriteGraph() in EAPS graphLib failed.") */ - __pyx_L8_except_error:; - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); - goto __pyx_L1_error; - __pyx_L11_try_end:; } - /* "planarity/full/g6IterationUtils.pyx":105 - * self._currGraph.gp_ReinitializeGraph() + /* "planarity/full/g6IterationUtils.pyx":106 + * raise RuntimeError(f"Unable to initialize writer with filename, as g6_InitWriterWithFileName() in EAPS graphLib failed.") * - * def update_graph_to_write(self, graph.Graph next_graph): # <<<<<<<<<<<<<< - * if next_graph.is_graph_NULL() or next_graph.gp_getN() == 0: - * raise ValueError( + * def g6_WriteGraph(self): # <<<<<<<<<<<<<< + * if cg6IterationDefs.g6_WriteGraph(self._g6WriteIterator) != cappconst.OK: + * raise RuntimeError(f"Unable to write graph, as g6_WriteGraph() in EAPS graphLib failed.") */ /* function exit code */ @@ -5009,13 +4835,9 @@ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6WriteIterator.update_graph_to_write", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6WriteIterator.g6_WriteGraph", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_copy_graph_error); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -5298,11 +5120,11 @@ static int __pyx_tp_clear_9planarity_4full_16g6IterationUtils_G6ReadIterator(PyO } static PyMethodDef __pyx_methods_9planarity_4full_16g6IterationUtils_G6ReadIterator[] = { - {"contents_exhausted", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_5contents_exhausted, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_4contents_exhausted}, - {"get_currGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_7get_currGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_6get_currGraph}, - {"duplicate_currGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_9duplicate_currGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_8duplicate_currGraph}, - {"begin_iteration", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_11begin_iteration, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_10begin_iteration}, - {"read_graph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_13read_graph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_12read_graph}, + {"get_currGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_5get_currGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_4get_currGraph}, + {"duplicate_currGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_7duplicate_currGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_6duplicate_currGraph}, + {"g6_EndReached", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_9g6_EndReached, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_8g6_EndReached}, + {"g6_InitReaderWithFileName", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_11g6_InitReaderWithFileName, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_10g6_InitReaderWithFileName}, + {"g6_ReadGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_13g6_ReadGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_12g6_ReadGraph}, {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_14__reduce_cython__}, {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_16__setstate_cython__}, {0, 0, 0, 0} @@ -5468,10 +5290,10 @@ static int __pyx_tp_clear_9planarity_4full_16g6IterationUtils_G6WriteIterator(Py } static PyMethodDef __pyx_methods_9planarity_4full_16g6IterationUtils_G6WriteIterator[] = { - {"begin_iteration", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_5begin_iteration, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_4begin_iteration}, - {"write_graph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_7write_graph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_6write_graph}, - {"reinitialize_currGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_9reinitialize_currGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_8reinitialize_currGraph}, - {"update_graph_to_write", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_11update_graph_to_write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_10update_graph_to_write}, + {"reinitialize_currGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_5reinitialize_currGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_4reinitialize_currGraph}, + {"update_graph_to_write", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_7update_graph_to_write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_6update_graph_to_write}, + {"g6_InitWriterWithFileName", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_9g6_InitWriterWithFileName, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_8g6_InitWriterWithFileName}, + {"g6_WriteGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_11g6_WriteGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_10g6_WriteGraph}, {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_13__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_12__reduce_cython__}, {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_15__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_14__setstate_cython__}, {0, 0, 0, 0} @@ -5642,15 +5464,15 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_G6ReadIterator, (PyObject *) __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator) < (0)) __PYX_ERR(0, 17, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator) < (0)) __PYX_ERR(0, 17, __pyx_L1_error) #if CYTHON_USE_TYPE_SPECS - __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9planarity_4full_16g6IterationUtils_G6WriteIterator_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator)) __PYX_ERR(0, 65, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9planarity_4full_16g6IterationUtils_G6WriteIterator_spec, __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator) < (0)) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9planarity_4full_16g6IterationUtils_G6WriteIterator_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator)) __PYX_ERR(0, 61, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9planarity_4full_16g6IterationUtils_G6WriteIterator_spec, __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator) < (0)) __PYX_ERR(0, 61, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator = &__pyx_type_9planarity_4full_16g6IterationUtils_G6WriteIterator; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator) < (0)) __PYX_ERR(0, 65, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator) < (0)) __PYX_ERR(0, 61, __pyx_L1_error) #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator); @@ -5660,8 +5482,8 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator->tp_getattro = PyObject_GenericGetAttr; } #endif - if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_G6WriteIterator, (PyObject *) __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator) < (0)) __PYX_ERR(0, 65, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator) < (0)) __PYX_ERR(0, 65, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_G6WriteIterator, (PyObject *) __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator) < (0)) __PYX_ERR(0, 61, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator) < (0)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -5983,89 +5805,89 @@ __Pyx_RefNannySetupContext("PyInit_g6IterationUtils", 0); (void)__Pyx_modinit_function_import_code(__pyx_mstate); /*--- Execution code ---*/ - /* "planarity/full/g6IterationUtils.pyx":43 - * raise MemoryError("freeG6ReadIterator() failed.") - * - * def contents_exhausted(self): # <<<<<<<<<<<<<< - * return cg6IterationDefs.contentsExhausted(self._g6ReadIterator) - * -*/ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_5contents_exhausted, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6ReadIterator_contents_exhauste, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 - PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); - #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator, __pyx_mstate_global->__pyx_n_u_contents_exhausted, __pyx_t_2) < (0)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "planarity/full/g6IterationUtils.pyx":46 - * return cg6IterationDefs.contentsExhausted(self._g6ReadIterator) + /* "planarity/full/g6IterationUtils.pyx":39 + * cg6IterationDefs.g6_FreeReader(&self._g6ReadIterator) * * def get_currGraph(self) -> graph.Graph: # <<<<<<<<<<<<<< * return self._currGraph.get_wrapper_for_graphP() * */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_graph_Graph) < (0)) __PYX_ERR(0, 46, __pyx_L1_error) - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_7get_currGraph, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6ReadIterator_get_currGraph, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_graph_Graph) < (0)) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_5get_currGraph, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6ReadIterator_get_currGraph, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator, __pyx_mstate_global->__pyx_n_u_get_currGraph, __pyx_t_3) < (0)) __PYX_ERR(0, 46, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator, __pyx_mstate_global->__pyx_n_u_get_currGraph, __pyx_t_3) < (0)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/g6IterationUtils.pyx":49 + /* "planarity/full/g6IterationUtils.pyx":42 * return self._currGraph.get_wrapper_for_graphP() * * def duplicate_currGraph(self) -> graph.Graph: # <<<<<<<<<<<<<< * return self._currGraph.gp_DupGraph() * */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_graph_Graph) < (0)) __PYX_ERR(0, 49, __pyx_L1_error) - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_9duplicate_currGraph, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6ReadIterator_duplicate_currGra, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_graph_Graph) < (0)) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_7duplicate_currGraph, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6ReadIterator_duplicate_currGra, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator, __pyx_mstate_global->__pyx_n_u_duplicate_currGraph, __pyx_t_2) < (0)) __PYX_ERR(0, 49, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator, __pyx_mstate_global->__pyx_n_u_duplicate_currGraph, __pyx_t_2) < (0)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/g6IterationUtils.pyx":52 + /* "planarity/full/g6IterationUtils.pyx":45 * return self._currGraph.gp_DupGraph() * - * def begin_iteration(self, str infile_name): # <<<<<<<<<<<<<< + * def g6_EndReached(self): # <<<<<<<<<<<<<< + * return cg6IterationDefs.g6_EndReached(self._g6ReadIterator) + * +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_9g6_EndReached, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6ReadIterator_g6_EndReached, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator, __pyx_mstate_global->__pyx_n_u_g6_EndReached, __pyx_t_2) < (0)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "planarity/full/g6IterationUtils.pyx":48 + * return cg6IterationDefs.g6_EndReached(self._g6ReadIterator) + * + * def g6_InitReaderWithFileName(self, str infile_name): # <<<<<<<<<<<<<< * # Convert Python str to UTF-8 encoded bytes, and then to const char * * cdef bytes encoded = infile_name.encode('utf-8') */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_11begin_iteration, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6ReadIterator_begin_iteration, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_11g6_InitReaderWithFileName, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6ReadIterator_g6_InitReaderWith, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator, __pyx_mstate_global->__pyx_n_u_begin_iteration, __pyx_t_2) < (0)) __PYX_ERR(0, 52, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator, __pyx_mstate_global->__pyx_n_u_g6_InitReaderWithFileName, __pyx_t_2) < (0)) __PYX_ERR(0, 48, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/g6IterationUtils.pyx":60 - * raise RuntimeError(f"beginG6ReadIteration() failed.") + /* "planarity/full/g6IterationUtils.pyx":56 + * raise RuntimeError(f"Unable to initialize reader with filename, as g6_InitReaderWithFileName() in EAPS graphLib failed.") * - * def read_graph(self): # <<<<<<<<<<<<<< - * if cg6IterationDefs.readGraphUsingG6ReadIterator(self._g6ReadIterator) != cappconst.OK: - * raise RuntimeError(f"readGraphUsingG6ReadIterator() failed.") + * def g6_ReadGraph(self): # <<<<<<<<<<<<<< + * if cg6IterationDefs.g6_ReadGraph(self._g6ReadIterator) != cappconst.OK: + * raise RuntimeError(f"Unable to read graph, as g6_ReadGraph() in EAPS graphLib failed.") */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_13read_graph, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6ReadIterator_read_graph, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_13g6_ReadGraph, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6ReadIterator_g6_ReadGraph, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator, __pyx_mstate_global->__pyx_n_u_read_graph, __pyx_t_2) < (0)) __PYX_ERR(0, 60, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator, __pyx_mstate_global->__pyx_n_u_g6_ReadGraph, __pyx_t_2) < (0)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "(tree fragment)":1 @@ -6095,64 +5917,64 @@ __Pyx_RefNannySetupContext("PyInit_g6IterationUtils", 0); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_2) < (0)) __PYX_ERR(1, 3, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/g6IterationUtils.pyx":90 - * raise MemoryError("freeG6WriteIterator() failed.") + /* "planarity/full/g6IterationUtils.pyx":82 + * cg6IterationDefs.g6_FreeWriter(&self._g6WriteIterator) + * + * def reinitialize_currGraph(self): # <<<<<<<<<<<<<< + * self._currGraph.gp_ReinitializeGraph() * - * def begin_iteration(self, str outfile_name): # <<<<<<<<<<<<<< - * # Convert Python str to UTF-8 encoded bytes, and then to const char * - * cdef bytes encoded = outfile_name.encode('utf-8') */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_5begin_iteration, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6WriteIterator_begin_iteration, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_5reinitialize_currGraph, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6WriteIterator_reinitialize_cur, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator, __pyx_mstate_global->__pyx_n_u_begin_iteration, __pyx_t_2) < (0)) __PYX_ERR(0, 90, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator, __pyx_mstate_global->__pyx_n_u_reinitialize_currGraph, __pyx_t_2) < (0)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/g6IterationUtils.pyx":98 - * raise RuntimeError(f"beginG6WriteIteration() failed.") + /* "planarity/full/g6IterationUtils.pyx":85 + * self._currGraph.gp_ReinitializeGraph() * - * def write_graph(self): # <<<<<<<<<<<<<< - * if cg6IterationDefs.writeGraphUsingG6WriteIterator(self._g6WriteIterator) != cappconst.OK: - * raise RuntimeError(f"writeGraphUsingG6WriteIterator() failed.") + * def update_graph_to_write(self, graph.Graph next_graph): # <<<<<<<<<<<<<< + * if next_graph.is_graph_NULL() or next_graph.gp_GetN() == 0: + * raise ValueError( */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_7write_graph, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6WriteIterator_write_graph, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_7update_graph_to_write, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6WriteIterator_update_graph_to, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator, __pyx_mstate_global->__pyx_n_u_write_graph, __pyx_t_2) < (0)) __PYX_ERR(0, 98, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator, __pyx_mstate_global->__pyx_n_u_update_graph_to_write, __pyx_t_2) < (0)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/g6IterationUtils.pyx":102 - * raise RuntimeError(f"writeGraphUsingG6WriteIterator() failed.") - * - * def reinitialize_currGraph(self): # <<<<<<<<<<<<<< - * self._currGraph.gp_ReinitializeGraph() + /* "planarity/full/g6IterationUtils.pyx":98 + * ) from copy_graph_error * + * def g6_InitWriterWithFileName(self, str outfile_name): # <<<<<<<<<<<<<< + * # Convert Python str to UTF-8 encoded bytes, and then to const char * + * cdef bytes encoded = outfile_name.encode('utf-8') */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_9reinitialize_currGraph, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6WriteIterator_reinitialize_cur, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 102, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_9g6_InitWriterWithFileName, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6WriteIterator_g6_InitWriterWit, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator, __pyx_mstate_global->__pyx_n_u_reinitialize_currGraph, __pyx_t_2) < (0)) __PYX_ERR(0, 102, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator, __pyx_mstate_global->__pyx_n_u_g6_InitWriterWithFileName, __pyx_t_2) < (0)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/g6IterationUtils.pyx":105 - * self._currGraph.gp_ReinitializeGraph() + /* "planarity/full/g6IterationUtils.pyx":106 + * raise RuntimeError(f"Unable to initialize writer with filename, as g6_InitWriterWithFileName() in EAPS graphLib failed.") * - * def update_graph_to_write(self, graph.Graph next_graph): # <<<<<<<<<<<<<< - * if next_graph.is_graph_NULL() or next_graph.gp_getN() == 0: - * raise ValueError( + * def g6_WriteGraph(self): # <<<<<<<<<<<<<< + * if cg6IterationDefs.g6_WriteGraph(self._g6WriteIterator) != cappconst.OK: + * raise RuntimeError(f"Unable to write graph, as g6_WriteGraph() in EAPS graphLib failed.") */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_11update_graph_to_write, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6WriteIterator_update_graph_to, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_11g6_WriteGraph, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6WriteIterator_g6_WriteGraph, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator, __pyx_mstate_global->__pyx_n_u_update_graph_to_write, __pyx_t_2) < (0)) __PYX_ERR(0, 105, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator, __pyx_mstate_global->__pyx_n_u_g6_WriteGraph, __pyx_t_2) < (0)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "(tree fragment)":1 @@ -6253,42 +6075,42 @@ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); { - const struct { const unsigned int length: 8; } index[] = {{1},{59},{67},{179},{8},{32},{33},{30},{31},{7},{6},{28},{29},{28},{29},{2},{11},{9},{50},{35},{38},{14},{40},{8},{14},{32},{34},{30},{33},{34},{28},{25},{15},{33},{35},{31},{38},{37},{27},{20},{18},{15},{18},{18},{16},{19},{7},{8},{13},{22},{12},{12},{11},{20},{7},{14},{11},{13},{13},{5},{8},{10},{8},{10},{12},{31},{3},{11},{12},{10},{10},{17},{13},{22},{6},{4},{12},{10},{12},{19},{8},{21},{6},{11},{14},{70},{30},{29},{49},{12},{49},{9},{16},{17}}; - #if (CYTHON_COMPRESS_STRINGS) == 3 && __PYX_LIMITED_VERSION_HEX >= 0x030e0000 /* compression: zstd (957 bytes) */ -const char* const cstring = "(\265/\375`-\007\235\035\0006n\2256 u\332\000\\0jE\004\033L\255D\004J\300V`\001\032\306\002m.\213\226\216Zk)E\354\223y\270\004\333{Kt\201]\2144\235C\002\247\314B\346O\331\032}\000{\000x\000^_\266\257\267\315\274\023v\356\365\257\316\2473\257\336f\037v\214!\215\253\214\037\376\350=~\237\254\360\211\224\210x\334\300\334\274z\375\343\274\217\337\213\372jR\227\325\266\376\345\362\036\266\336\242N\322\207\346\317:\355\223\3760ZJ\341{[\337\365\326O\177&rR\030\204\347\023:\311\334\233\343\303\030\327>\274\3763\376\363\346\220\310\324\371Z\034\274\254~\227\327\367\342l|\366\237t:a\314J\263\037>~\307\335\361\364\003Q1*\036o\266\370>Fa\325\211U\022\372u\275\270\023\246\363U$\254\017J\363\366\361\372ya\205\224\353\216\335\217\302\0314\357{T[\263|\335\036\263\364\333\375\236f\270\271|\266J\021\256<\302\373\355u\322\210\275\316\317\366\332\031\353\013\303\315S\357rT\177\234/\256\327M\267\375\226\\\366\373\316\212\223rYJ\177\234a\313\345\215\277\372W\033\0038\263\221\211.\240\253\220\321\330\t\354\215p\216.\002:\034\030\207\221A@\315\344\322=\r\322TL3 \331\200L\207E\326\361\320\321\030!P\237\316\247\273Vu\252\226N\322ph)G\0263\323\354A\266\023\223 P\332\321\351\210\222lR:\007\232\211V\002\024k\236\216'\325\245V:\021Z\005\315$\242\213ph\250\301X\007P\214\"\241K \250-\310L\262\224\330\001L\001\241fP\000 \260\264\240Pc\211m\300\030\020j\013H\221\026B+\231A\310\342Q\310\021\017\314\304\350\000\316,f\0133\020\212\216\202\240\306R\024\200\233\250\221\035b\010\315\210\214h\222\024\322\032 \204 \004\225\321\003\221(\345\214b\310\310H\311H\222\202\016\323\340\032\304'b%@\005\325\201{h\364\205\313\r\000@\003\003t=\230\244\364xR\027\300T""\361\253P\306\"\333PM\340\311\026HB\345\023\237\000\022\031\226\021*\005\306yz66\030\350IA\227\3153 M\316\004%\037\230\214\311\373\301A\016\302YV*~\277\257/\244\017%'/\2305\262\327i\021\316:\024\216\321m\n/\212-\346\356\352\2171\206\323Q\013I\326\250\235\215WY\007E4<\303\350\236Y\251\242h\331\342kWBz\002P\260\246\264\360\220`\0232(\332\342\r\001\017S\241P\226\010@\221\270m\257\214<[\224\370\327QJ\276\202\325\352\334!\203}o\361\376\253\3401|\220VA\023o\000\3171(\3242\372d\n\276S\027\"\332\003\233\245\256\224\202\325\220\222\326\"@\307\230C\005\367QX\232`g*\250\376\212\265\014\010\377\241w\307!t\002\372IX\336$\313E\3307\006{\376x\202\335d\247\350\340!\230U\306\215\244\377\355\377\313\216\202\023\t\247s\207b5=-l\376\n\031G\276\034\344r>\210:\234\010U\253id\037H\230$\221\250\320Rj"; - PyObject *data = __Pyx_DecompressString(cstring, 957, 3); + const struct { const unsigned int length: 8; } index[] = {{1},{59},{67},{179},{87},{80},{98},{98},{64},{66},{8},{7},{6},{2},{11},{9},{50},{35},{14},{8},{14},{32},{34},{34},{28},{40},{27},{28},{15},{33},{35},{41},{29},{38},{37},{20},{18},{18},{16},{19},{7},{8},{13},{25},{25},{12},{13},{13},{22},{12},{12},{11},{7},{20},{14},{11},{13},{13},{5},{8},{10},{8},{10},{12},{31},{3},{11},{12},{10},{17},{13},{22},{6},{4},{12},{10},{12},{19},{8},{21},{6},{27},{70},{48},{27},{12},{13},{48},{9},{16},{17}}; + #if (CYTHON_COMPRESS_STRINGS) == 3 && __PYX_LIMITED_VERSION_HEX >= 0x030e0000 /* compression: zstd (1014 bytes) */ +const char* const cstring = "(\265/\375`\t\010e\037\000f.\231:\020\225\332\000\000\002\025\n\004\324\010AB]\020P\247\220\202\025Z\202b\026Id7)\214!\255Q\212\334\337\2163\320\237\000\037\0304\t;Px\035\3748\261!\024\313]\211\006\003\177\000\202\000~\000\237%\250C\351\275\310\216\377\027v\231o\307\027lIOK\376\234S\\[ \227\274\327\347\371-m\246R\204D\304c\325\262\222y\177\257ww.C\374\255\213\337f\375\352\341\212\354\364\325\345w\255\352\354\003\335~\265\264\337i\325\030S\331u\226\373_\375\276,\261\027\323\037~e\254C\355\rV\3111\266\356t\177\177\371~\367\215\t\225\257|}t\273f\227}\226\341\247\253\324]\332\307\227\272\250\004|w~\"\013\277\216\343\333kL\256\017\214A\357#\354w\323L\3617g\305\364\376\334\335=\262\316\240\225s~\005\355\3579e\307 \365\336J\235-\277\256\352z~\355w\235\247\265T\345r\363\362>4{\362\325oLnO\266nJ\322\254N-R#c\177\354U\323\344\302\230V\311\251\354\260\364gL(\211[4\327t\3171u\371\237\333\353\357k%\206+\337\231\365\355\264\353\234)\206\354\317e\346\364\013\337\247\207\237\347\r\366\337s\312\036S\020\366\315\371\351\257\353\346c\320\3529\363\245>sr\237T\252F5\371\235sF\325\037\365\201,+\363[m\355\315\375_l\316\232AoN\373V\327\374[\357\375=\225\266\276\322\335g\276\023W\376\371vPo];}k\0169\365~\246\313^5{\275,\262p5\347\324}\332\017\354~\367\267\377\2526\267\324\213?\320v\332y\177>g\355R\276nP\007\254\333\310\304\0300V\210\270fB\3533\226\355\"`d\3218f\006\0019Rm\215-\233\021\006\227\"\335`\342\200\230Sq\263\"K\024\252Q\234\304\016\2071f\206\300\302E\024\235\272\321B,\211)\266\216\365f\304\301\311\224\214\366\306\272\215@\214\0206\213\033\351\346 \352\324$\010\214NC\r\0149X\215\"aL \310\225\016h\n\0109\203\002\000\201\243\222B\356T\333(\025U\242\020\"\222\333\203Xm!\266\035Z\311\354\000V\243\265\016\332\002B\016\004\027D\244\34216\210$\021\245\006A\220;\r\361\007y\200\255\250\221\241A\312\314\310\210\310H\222$\215\0010\204 TV\345\001\262\301HG1\304\024\201\310\320\210\004#A.)\225\346\223\000\341\332\272Y\034\352\202\2223_^O\207Sn\353<\233\023\203\250b=\205\r!P\364\240&=\350\313""\023\r\323\023\rY\212\366{\223\311\340\212\2142\034\0226k\223U\261i\312k\211\021~\360%K\231\n\200}\340K\307a\226-}\276\221t7\255\207.{\234\3325\230\315O\205'\177\r#\005\214\020\254B\023\341\231\200B/\376\266\336\t\261\333O\261\262\031\003\000:\277T\2362\000\265\275\001\3619\334\037\212\243]\277\206\033{\257!\316\201\261-\237\010_\335b'\372\"D9\326\204\333|!\021\300A\007Y\314\344'n\343w\276\224\330\224\317\313a\017V\016\337\000179[\356:a5\377\331`B\237\301\330\373\326\221M.\023\310\330\253j\017\000h\005\3768+\320\346\022F\013\203\326\343\372\033\315\345\205\306l\240I1\022\014\004\243\254\342@gqn\214\020\251\032U\033pB\232\256\316\320\273p\344\315{t7q\221\016\360Vz\376(\020\010\276TmL\036\223M9OLk\350\376\230L[(\360\3345p\020z\343\314%\246WP9\261\224\024w\230U0\311\014\242\024\300C\035\024\325\350 d3_\241\035e5B\202W=\352nQ\374\326\234\361\272\261\254_B\245!3\374\001"; + PyObject *data = __Pyx_DecompressString(cstring, 1014, 3); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif - #elif (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (1079 bytes) */ -const char* const cstring = "BZh91AY&SY\262\260\241\322\000\000\204\177\377\345\374\374\233\346\377\257_\277\255\362\215\277\377\377\364@@@@@@@@@@@@@\000@\000P\003\301\224\240\000\244\364%\021\031\004\233)\351M\345O)\355Q\350\231\244\320=@\365\031\r\000\000\032i\240fP\311\247\251\214\241\306\206\206\206\200h\014@\320\031\000\000i\240\001\240\031\000\000\000\302D\201\021\222=4S\322mC\024\304\323 \032\0004\000\000\000\320\001\246F\232\007\032\032\032\032\001\2401\003@d\000\001\246\200\006\200d\000\000\003\021P\000\003\324\320\000\000\000\000\000\000\000\000\000\014\214M\r\362\211\303\375\311\300\316NC3\232\211\230\025$\2614\334P\24225F\026\245\221r\322@$6\347\216!B1\024\261Sv\367\361\2301\342\200\303\366v\372\257V\357{\256!\026\353\245\316\340\311/\360v&\253\341\200\205\361\265\216U\215\361Y\252\256Q]X\3733! )\334\020\321\343T:\333\216\265A@\261\205\246#\022\323\030\251\241u\215z\204\020v\362\323\346\360\263c@\332\020M-\213\223T\332\215;\371`\245{s\345\354\242\271\220L\353r\361GK\344\236<\231m\341:\027\224\247!IJ\353L\265\212\332n\352\005\323\203OzT\236\212\315\277\204p\333m\266\333`\323|\357\307\267\214\337_G\315\366i\340\251v\365v\371y\350%\207\325\367\204\220\250\334\334\215\004\206\263\0233\267\254\"s\005\tl\361\266\005\022\255AY\n$6\366o\356r\323\306ztAm\033\314;4\264\307\215\363\223\033J\316G-45\\gJ\313\232\n5\300\265\227NdU\211c\245X\225|\205\314~\364\301\343\334\300\002|T\010d\341\342Ps\251\330\211\3326\020\265\204\177~`D\204\271\t3\356\224\242\212\226\310\271\004\232H\241C\255\314\035g\236\2630\335\267\274\263\327\274\230\365\\*\370\375\033Ky\006\237\357N\333O\003QI\202\354e;\332\025b\036\221(e\374D\245\303\243\234\314(\224NYi\333c~{8\247\247\243\020\317\003B\337F\340\243c\233r\206\333l5\316\206\035T&R\261\337\225/e\354\tlqP4A}\016z+*\225\3161\265N\031i\207\256g\004\343n\020\222\\W\023\302z\347\306\233ck\031\331rX\335\335\317X\214\225.\273%\371\304\342P97\223\252\034'\271\245\203U\310Ay\325\031\r\241\244\327>\003\025\335\312:\2353\244\221Ss\334I\254m3,7\032r\232\332\242\2428\344_Il\316""\344\203\263U\025\230As\300'\243\304,pP\324P\346\311\241t\025\345\013U\205F\026V\207!\305z\235CD\305\361\3229\"\320\206\333I\261\203\202w\325T\277\261kM\227mc\264\010\236\331\254\351\256\342\327\0175V\241\254\027\0176\216uB\314 L\241\233\362\235o\0228\361\231z\344z\370\360\251\263z\326\360\221\252\355\251\t\347\262\206\232^\247\312\371\341\347\262\3526$b\224Fz\2751\264\3064\230\233~\n\000\030\327\247\206\034L:\007\0219l\333\250\301w\320\230fK\034\265\020\2117Ra\216\320a]p\302)\004\027\032\342i\320\265\200\246)\322IG\252Y#\341R\027\026\341$n\351pS\202\205\006@\253\024\213\020\222`68\211\222\207\302]\327\t\014lH\3121\300#\242\223\rf\252\032\004_m\0142S\022\036\007\257W\023\t)\023\373\246\014\376IMDI\265Yx\234^\226\215\210I.P\211\020\324\242\212\010\250\\\222\316\322\247\252\212\251~\213&\026\217\222\003Zq\034\34383SB\233\332\274M\374n\355\355\037(c\346\207\3453\342?X\362\037\357v#=\273\270\364\346\371\376\370\255\316\275\223*>}\345\277\247\2617\263.\215\251\333:.\032\335\013TM\023w\344\253)>\266\253Q\306m\253\323?\024\033\020\276\240\277\361w$S\205\t\000\026\317\033\340"; + PyObject *data = __Pyx_DecompressString(cstring, 1154, 2); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif - #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (950 bytes) */ -const char* const cstring = "x\332uU;o[7\024\256\000\243u\023\003\211\333\000\001\032\244f\200\024\356#QP\3045\014\247N\340:\265\0214Pm\001F\207\004&(\362\\\2115M^\223\274\216Tt\350\350Q\243F\217\0325\336\261c\307;j\354O\350O\350\341\275z?\004\370\202\344\371\276\363\374H\277:dR\201 \336\020n\342\026\321\320\364\264nY\334 R\343\341\321\366oVzx\343\3012o\354\246#<\261\366(\000\312\37170?\004\010\221\016)WLI\261K@\372\006X\242\215'L)\303\231\307\030\2468\220Zz\211\260?@\224+\006\211\276\301<9h\371\206\321\301\211\000%k!\034\250\026q\336J\216\301\003H\223\343\237\217\237n\355l\021\246\005\261\360;p\357\210Kj\\1\347\300\021\023\221Z\"\225\227\232\370V\014\256L\336D\244e\022\254\252(1F\334$\001\223\324\304\201\017\013\262\3114\246\307\2744\232\"]\352\372&\021\322b\020y\005\201}\310\224\2032\023\202\"\016\206u\035mW\201\211a\203\276\376\206DyG\313c\373T\007\307\200\032\324\245\236dc\3409\353\004w\312,\244c5\005\240\213\257X\352'\267-\363\022YX\232\177a[\222{\235\327\307\022\220\256HCh\203\303\213X\242<\241\324\202H8PJD\222wO\033\375\024\207y\205\243G+\017*\2404VL3\014\321z\026%J=\253o\217\222<\365R\271r\334jZ\314.\017s\352p$\313\262\3751\010E\327\235I,\207\227\271 'IK\3128\304o\205]\314\364`zW\036\225\302s\211R:gG\0059\024\316RD>K*\207\245\315X\271\321\036\264w\024\232\r\2268\274)3\000\221\304J\362\334\377\360\356\315 \352\340\227\332B\377\212\033=\323\206\231\355\242:g\001\013\n\235\206\314U:m\2660\276\374\223\tO\243\222X\204\030y\316\324\033ZLs\006\224\037\0160\364\270\325\304\277\327\370R\320\n>`U\024\241ki.\r6\327\232\004\037\004p3\251q\205\207\024O\274e\034j\214\237\317\317!\274\210\203\020`\255\261\013\006\001\232\033\001\202\322(\321\234\322\251A\204\315\007\\\304`idl\341\3518\007\025]\244\365\230\036`\214\002\035\323\327I<\\V':5J\267\262W\325\254z\226\235\321\001\242s9\260\356\244\245\364^\266\367\353?\177f\357\336O\030\377]}\330y\337\275\337+\365\320\371\343\033\334#x/=IE\366\323ivJ3z\236\235\253)ok\327\277d\367\237t\367\013\362\273\356'\335\313^iL~\231\262\324g\007\213\310\245\376\312\255\353\357\332'\331\312W7'X\313\265o\277\350\250\356\243l%\324T\354\263/\177\350\235\374\017/\347.T"; - PyObject *data = __Pyx_DecompressString(cstring, 950, 1); + #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (999 bytes) */ +const char* const cstring = "x\332\225U\315o\033E\024'R\004\241\215\324\006*U\"@\247RQ\370H\266B-Q\025\240\225\325&Q XNQ\210\004\210\321x\346\331\036\330\314lff\023\033!\324c\216>\372\230\343\036}\314\261\307\034\367\350#\177\002\177\002ov\375\265\376\000b)\316\314\274\337\373\2757\357\375\336\370\331\016\223!\010\3424\341:j\021\005MG\353\206E\r\"\025\036\356n\036\031\351`\317\201aN\2335Kxl\314\256\007\004\331\267\367<\363\020\"-\272\234\262P\212-\002\3225\300\020\245\035aa\2509s\030C\347\007RI'\021\366;\210\240\254\321\3215\230#\317[\256\241\225'\021\020\312\252\017\007a\213Xg$\307\340\036\244He\273\262\361\370\311c\302\224 \006~\005\356,\261q\225\207\314Z\260D\327H5\226\241\223\212\270V\0046 {5\322\3221\336*\277b\204\270q\007LR\021\013\316/\310\032S\230\036sR+\212\356R\325\327\210\220\006\203\310S\360\336;,\264\020\034*V\r\263\375\350\"X\246\227\300\304\240J\353\204a\235\360\342\036U\337\244e8\363f0\037\177\202Nd\273T\371\236d5\336\227UR\313\0320\217\266P\375\2147\347\313\316\257\315g\262,\310\031v\207\324\020\246\3301\014H\367\020\226gy\204\346\035\264\226\321z\335\010\231\024\376%B\236\367\265#\370\304s\363\200\314\247\232\t\360\177\371\347\n-\020d\231\374\027\003\023\202\242(@H\353\251 #\254\363\372H\377\322\346\207BiTn\215\305\241#\224\032\0201\007J\211\210\263\370J\253\rT\362)V\t\255\334\027\214\322(d\212a\026\255\207\2658\014\037\3267\363>\243\376\016\235\014m\020\265\232_y\375\253\272\325\261\341\360tP\262\242\332\212\273`\030\234g\023E\351\224\035\005oQ\347s\021\"\216B\3113\300`\326'\020X\276m%\360\2107@L\333fKi\0327\354\341\244\t\334x\350\302\014Llg]w\0220\343\276E\310\\m\316\000\216d3i40\232\203\271\351\007q$|*\231\202\250\3234S&\245\225V\023\377^\340[\207\323\335\304\352\325\230m).u\300\265\3211>i`y\210\337T\342\353d\030\207*\343\277\371'\273O\005\306h3\243s\240\270\026 (\255\305\212SZ\350\334\334V\315-\310x\323\n\305(\264\314o\316p\021\201\2415m\362\014+\030|\320\010Z\217\350s\314=GG\364E\034\r\226\273\340\312\370\357\345X1sS\241`R\371\307\205\372\327\205JK\2075\302u\016,\037\356""\357#\356\330Rz\314\260d\3709\326\"F\037\374dnt\364S\207\276C\272\341P\006~(\203\311\241\214t\204\203\213\315\352_\344$faN7\032\372)I\016\017\240\351\227\263db\300\305FY\010k\231^\373)\342\252\377\246\214\251\230\316P4\245\016,\202f\252\013\177\223c\260\257J\275\245\325\316\327\311Br'\335xv\371\307\325\347\275\345w\332\353\035\3269\361\246\233\347[\355_.\036]\360\344\275\356\223\313G\227\374\365\212\267\177\332)\365n\257\374\375\346\033o\337\350-\337n\337\314\010VzK\267\322[\367:'}\006D\364\336\275\363\252\364\327\322\007\235\237\223\273\335\205.\"\036\\\340~5]\375\242{\320\025\351\326wW?\246G<\345\242\020u\265\3634YI\036\244A\351\365\373W\007\005\323\362\371\267\351\335\365\244\344\327\367:\177&\007\211\350\336\317c\374\224\274\225\234t\027\246b\354_}\223\376PM\253|D\264\320[\274q\376Y\373 ]\374\350\342\000\323>w\355/;ar?]\364\351\347\373\364C\364\377\0078\324rY"; + PyObject *data = __Pyx_DecompressString(cstring, 999, 1); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif - #else /* compression: none (2093 bytes) */ -const char* const bytes = "?Failed to copy next_graph into G6WriteIterator's currGraph.Graph to write is invalid: either not allocated or not initialized.Note that Cython is deliberately stricter than PEP-484 and rejects subclasses of builtin types. If you need to pass subclasses then set the 'annotation_typing' directive to False.add_noteallocateG6ReadIterator() failed.allocateG6WriteIterator() failed.beginG6ReadIteration() failed.beginG6WriteIteration() failed.disableenableendG6ReadIteration() failed.endG6WriteIteration() failed.freeG6ReadIterator() failed.freeG6WriteIterator() failed.gcgraph.Graphisenabledno default __reduce__ due to non-trivial __cinit__planarity/full/g6IterationUtils.pyxreadGraphUsingG6ReadIterator() failed.writeGraphUsingG6WriteIterator() failed.FileNameG6ReadIteratorG6ReadIterator.__reduce_cython__G6ReadIterator.__setstate_cython__G6ReadIterator.begin_iterationG6ReadIterator.contents_exhaustedG6ReadIterator.duplicate_currGraphG6ReadIterator.get_currGraphG6ReadIterator.read_graphG6WriteIteratorG6WriteIterator.__reduce_cython__G6WriteIterator.__setstate_cython__G6WriteIterator.begin_iterationG6WriteIterator.reinitialize_currGraphG6WriteIterator.update_graph_to_writeG6WriteIterator.write_graph__Pyx_PyDict_NextRefasyncio.coroutinesbegin_iterationcline_in_tracebackcontents_exhaustedcopy_graph_errorduplicate_currGraphencoded__func__get_currGraphget_wrapper_for_graphP__getstate__gp_CopyGraphgp_DupGraphgp_ReinitializeGraphgp_getNgraph_to_writeinfile_name_is_coroutineis_graph_NULLitems__main____module____name__next_graphoutfile_nameplanarity.full.g6IterationUtilspop__pyx_state__qualname__read_graph__reduce____reduce_cython____reduce_ex__reinitialize_currGraphreturnself__set_name__setdefault__setstate____setstate_cython____test__update_graph_to_writevalueswrite_graph\200A\330\010\037\320\0371\260\021\260$\260a\200A\330\010\013\210:\220^\2403\240c\250\032\2608\2703\270c\300\021\330\014\022\220*\230A\330\020\021\360\006\000\t\n\330\014\020\220\013\230=\250\001\250""\021\330\010\017\320\017\037\230q\330\014\022\220,\230a\330\020\021\330\023\024\200A\330\010\033\320\033:\270!\2704\320?R\320R^\320^_\330\014\022\220,\230a\230q\200A\330\010\033\320\0338\270\001\270\024\320=O\310|\320[\\\330\014\022\220,\230a\230q\200A\340\010\035\230\\\250\027\260\001\260\021\330\010$\240A\340\010\033\320\033=\270Q\270d\320BU\320U_\320_k\320kl\330\014\022\220,\230a\230q\200A\330\010\014\210K\320\027,\250A\200A\340\010\035\230[\250\007\250q\260\001\330\010$\240A\340\010\033\320\033>\270a\270t\320CU\320U_\320_k\320kl\330\014\022\220,\230a\230q\200\001\330\004\n\210+\220Q\320\004%\240Q\330\010\017\210t\220;\230l\250!\320\004\037\230q\330\010\017\210t\220;\320\0365\260Q"; + #else /* compression: none (2313 bytes) */ +const char* const bytes = "?Failed to copy next_graph into G6WriteIterator's currGraph.Graph to write is invalid: either not allocated or not initialized.Note that Cython is deliberately stricter than PEP-484 and rejects subclasses of builtin types. If you need to pass subclasses then set the 'annotation_typing' directive to False.Unable to initialize G6ReadIterator, as call to g6_NewReader() in EAPS graphLib failed.Unable to initialize G6WriteIterator, as g6_NewWriter() in EAPS graphLib failed.Unable to initialize reader with filename, as g6_InitReaderWithFileName() in EAPS graphLib failed.Unable to initialize writer with filename, as g6_InitWriterWithFileName() in EAPS graphLib failed.Unable to read graph, as g6_ReadGraph() in EAPS graphLib failed.Unable to write graph, as g6_WriteGraph() in EAPS graphLib failed.add_notedisableenablegcgraph.Graphisenabledno default __reduce__ due to non-trivial __cinit__planarity/full/g6IterationUtils.pyxFileNameG6ReadIteratorG6ReadIterator.__reduce_cython__G6ReadIterator.__setstate_cython__G6ReadIterator.duplicate_currGraphG6ReadIterator.g6_EndReachedG6ReadIterator.g6_InitReaderWithFileNameG6ReadIterator.g6_ReadGraphG6ReadIterator.get_currGraphG6WriteIteratorG6WriteIterator.__reduce_cython__G6WriteIterator.__setstate_cython__G6WriteIterator.g6_InitWriterWithFileNameG6WriteIterator.g6_WriteGraphG6WriteIterator.reinitialize_currGraphG6WriteIterator.update_graph_to_write__Pyx_PyDict_NextRefasyncio.coroutinescline_in_tracebackcopy_graph_errorduplicate_currGraphencoded__func__g6_EndReachedg6_InitReaderWithFileNameg6_InitWriterWithFileNameg6_ReadGraphg6_WriteGraphget_currGraphget_wrapper_for_graphP__getstate__gp_CopyGraphgp_DupGraphgp_GetNgp_ReinitializeGraphgraph_to_writeinfile_name_is_coroutineis_graph_NULLitems__main____module____name__next_graphoutfile_nameplanarity.full.g6IterationUtilspop__pyx_state__qualname____reduce____reduce_cython____reduce_ex__reinitialize_currGraphreturnself__set_name__setdefault__setstate____setstate_cython____test__u""pdate_graph_to_writevalues\200A\330\010\033\230=\250\001\250\024\320-?\270|\3101\330\014\022\220,\230a\230q\200A\330\010\013\210:\220^\2403\240c\250\032\2608\2703\270c\300\021\330\014\022\220*\230A\330\020\021\360\006\000\t\n\330\014\020\220\013\230=\250\001\250\021\330\010\017\320\017\037\230q\330\014\022\220,\230a\330\020\021\330\023\024\200A\340\010\035\230\\\250\027\260\001\260\021\330\010$\240A\340\010\033\320\0335\260Q\260d\320:M\310Z\320Wc\320cd\330\014\022\220,\230a\230q\200A\330\010\033\230>\250\021\250$\320.A\300\034\310Q\330\014\022\220,\230a\230q\200A\330\010\014\210K\320\027,\250A\200A\330\010\037\230~\250Q\250d\260!\200A\340\010\035\230[\250\007\250q\260\001\330\010$\240A\340\010\033\320\0335\260Q\260d\320:L\310J\320Vb\320bc\330\014\022\220,\230a\230q\200\001\330\004\n\210+\220Q\320\004%\240Q\330\010\017\210t\220;\230l\250!\320\004\037\230q\330\010\017\210t\220;\320\0365\260Q"; PyObject *data = NULL; CYTHON_UNUSED_VAR(__Pyx_DecompressString); #endif PyObject **stringtab = __pyx_mstate->__pyx_string_tab; Py_ssize_t pos = 0; - for (int i = 0; i < 84; i++) { + for (int i = 0; i < 81; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); - if (likely(string) && i >= 23) PyUnicode_InternInPlace(&string); + if (likely(string) && i >= 19) PyUnicode_InternInPlace(&string); if (unlikely(!string)) { Py_XDECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) @@ -6296,7 +6118,7 @@ const char* const bytes = "?Failed to copy next_graph into G6WriteIterator's cur stringtab[i] = string; pos += bytes_length; } - for (int i = 84; i < 94; i++) { + for (int i = 81; i < 91; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length); stringtab[i] = string; @@ -6307,14 +6129,14 @@ const char* const bytes = "?Failed to copy next_graph into G6WriteIterator's cur } } Py_XDECREF(data); - for (Py_ssize_t i = 0; i < 94; i++) { + for (Py_ssize_t i = 0; i < 91; i++) { if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { __PYX_ERR(0, 1, __pyx_L1_error) } } #if CYTHON_IMMORTAL_CONSTANTS { - PyObject **table = stringtab + 84; + PyObject **table = stringtab + 81; for (Py_ssize_t i=0; i<10; ++i) { #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #if PY_VERSION_HEX < 0x030E0000 @@ -6387,29 +6209,29 @@ static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { PyObject* tuple_dedup_map = PyDict_New(); if (unlikely(!tuple_dedup_map)) return -1; { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 43}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 39}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; - __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_contents_exhausted, __pyx_mstate->__pyx_kp_b_iso88591_A_1_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_get_currGraph, __pyx_mstate->__pyx_kp_b_iso88591_q_t_5Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 46}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 42}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; - __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_get_currGraph, __pyx_mstate->__pyx_kp_b_iso88591_q_t_5Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_duplicate_currGraph, __pyx_mstate->__pyx_kp_b_iso88591_Q_t_l, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 49}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 45}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; - __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_duplicate_currGraph, __pyx_mstate->__pyx_kp_b_iso88591_Q_t_l, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_g6_EndReached, __pyx_mstate->__pyx_kp_b_iso88591_A_Qd, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 52}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 48}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_infile_name, __pyx_mstate->__pyx_n_u_encoded, __pyx_mstate->__pyx_n_u_FileName}; - __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_begin_iteration, __pyx_mstate->__pyx_kp_b_iso88591_A_q_A_atCUU__kkl_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_g6_InitReaderWithFileName, __pyx_mstate->__pyx_kp_b_iso88591_A_q_A_5Qd_LJVbbc_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 60}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 56}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; - __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_read_graph, __pyx_mstate->__pyx_kp_b_iso88591_A_8_O_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_g6_ReadGraph, __pyx_mstate->__pyx_kp_b_iso88591_A_1_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; @@ -6422,24 +6244,24 @@ static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 90}; - PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_outfile_name, __pyx_mstate->__pyx_n_u_encoded, __pyx_mstate->__pyx_n_u_FileName}; - __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_begin_iteration, __pyx_mstate->__pyx_kp_b_iso88591_A_A_QdBUU__kkl_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 82}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; + __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_reinitialize_currGraph, __pyx_mstate->__pyx_kp_b_iso88591_A_K_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 98}; - PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; - __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_write_graph, __pyx_mstate->__pyx_kp_b_iso88591_A_4_RR___aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 85}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_next_graph, __pyx_mstate->__pyx_n_u_copy_graph_error}; + __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_update_graph_to_write, __pyx_mstate->__pyx_kp_b_iso88591_A_3c_83c_A_q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 102}; - PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; - __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_reinitialize_currGraph, __pyx_mstate->__pyx_kp_b_iso88591_A_K_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 98}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_outfile_name, __pyx_mstate->__pyx_n_u_encoded, __pyx_mstate->__pyx_n_u_FileName}; + __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_g6_InitWriterWithFileName, __pyx_mstate->__pyx_kp_b_iso88591_A_A_5Qd_MZWccd_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 105}; - PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_next_graph, __pyx_mstate->__pyx_n_u_copy_graph_error}; - __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_update_graph_to_write, __pyx_mstate->__pyx_kp_b_iso88591_A_3c_83c_A_q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 106}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; + __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_g6_WriteGraph, __pyx_mstate->__pyx_kp_b_iso88591_A_A_Q_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; @@ -7311,42 +7133,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject return; } -/* WriteUnraisableException */ -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename, - int full_traceback, int nogil) { - PyObject *old_exc, *old_val, *old_tb; - PyObject *ctx; - __Pyx_PyThreadState_declare - PyGILState_STATE state; - if (nogil) - state = PyGILState_Ensure(); - else state = (PyGILState_STATE)0; - CYTHON_UNUSED_VAR(clineno); - CYTHON_UNUSED_VAR(lineno); - CYTHON_UNUSED_VAR(filename); - CYTHON_MAYBE_UNUSED_VAR(nogil); - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); - if (full_traceback) { - Py_XINCREF(old_exc); - Py_XINCREF(old_val); - Py_XINCREF(old_tb); - __Pyx_ErrRestore(old_exc, old_val, old_tb); - PyErr_PrintEx(0); - } - ctx = PyUnicode_FromString(name); - __Pyx_ErrRestore(old_exc, old_val, old_tb); - if (!ctx) { - PyErr_WriteUnraisable(Py_None); - } else { - PyErr_WriteUnraisable(ctx); - Py_DECREF(ctx); - } - if (nogil) - PyGILState_Release(state); -} - /* PyObjectFastCallMethod */ #if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000 static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) { diff --git a/planarity/full/g6IterationUtils.pyx b/planarity/full/g6IterationUtils.pyx index 054c424..7f4e57f 100644 --- a/planarity/full/g6IterationUtils.pyx +++ b/planarity/full/g6IterationUtils.pyx @@ -23,25 +23,18 @@ cdef class G6ReadIterator: cdef graph.Graph currGraph = graph.Graph() - if cg6IterationDefs.allocateG6ReadIterator(&self._g6ReadIterator, currGraph._theGraph) != cappconst.OK: - raise MemoryError("allocateG6ReadIterator() failed.") + if cg6IterationDefs.g6_NewReader(&self._g6ReadIterator, currGraph._theGraph) != cappconst.OK: + raise MemoryError("Unable to initialize G6ReadIterator, as call to g6_NewReader() in EAPS graphLib failed.") self._currGraph = currGraph def __dealloc__(self): if self._g6ReadIterator != NULL: - if cg6IterationDefs.endG6ReadIteration(self._g6ReadIterator) != cappconst.OK: - raise RuntimeError("endG6ReadIteration() failed.") - - # NOTE: freeG6ReadIterator() NULLs out the pointer to currGraph on - # the C layer; when Python will then clean up the instance variables + # NOTE: g6_FreeReader() NULLs out the pointer to currGraph on + # the C layer; Python will then clean up the instance variables # by calling their respective __dealloc__, so at that point the # graphP will be cleaned up with gp_Free() - if cg6IterationDefs.freeG6ReadIterator(&self._g6ReadIterator) != cappconst.OK: - raise MemoryError("freeG6ReadIterator() failed.") - - def contents_exhausted(self): - return cg6IterationDefs.contentsExhausted(self._g6ReadIterator) + cg6IterationDefs.g6_FreeReader(&self._g6ReadIterator) def get_currGraph(self) -> graph.Graph: return self._currGraph.get_wrapper_for_graphP() @@ -49,17 +42,20 @@ cdef class G6ReadIterator: def duplicate_currGraph(self) -> graph.Graph: return self._currGraph.gp_DupGraph() - def begin_iteration(self, str infile_name): + def g6_EndReached(self): + return cg6IterationDefs.g6_EndReached(self._g6ReadIterator) + + def g6_InitReaderWithFileName(self, str infile_name): # Convert Python str to UTF-8 encoded bytes, and then to const char * cdef bytes encoded = infile_name.encode('utf-8') cdef const char *FileName = encoded - if cg6IterationDefs.beginG6ReadIterationFromG6FilePath(self._g6ReadIterator, FileName) != cappconst.OK: - raise RuntimeError(f"beginG6ReadIteration() failed.") + if cg6IterationDefs.g6_InitReaderWithFileName(self._g6ReadIterator, FileName) != cappconst.OK: + raise RuntimeError(f"Unable to initialize reader with filename, as g6_InitReaderWithFileName() in EAPS graphLib failed.") - def read_graph(self): - if cg6IterationDefs.readGraphUsingG6ReadIterator(self._g6ReadIterator) != cappconst.OK: - raise RuntimeError(f"readGraphUsingG6ReadIterator() failed.") + def g6_ReadGraph(self): + if cg6IterationDefs.g6_ReadGraph(self._g6ReadIterator) != cappconst.OK: + raise RuntimeError(f"Unable to read graph, as g6_ReadGraph() in EAPS graphLib failed.") cdef class G6WriteIterator: @@ -69,41 +65,25 @@ cdef class G6WriteIterator: def __cinit__(self, graph.Graph graph_to_write): self._g6WriteIterator = NULL - if graph_to_write.is_graph_NULL() or graph_to_write.gp_getN() == 0: + if graph_to_write.is_graph_NULL() or graph_to_write.gp_GetN() == 0: raise ValueError( "Graph to write is invalid: either not allocated or not " "initialized.") self._currGraph = graph_to_write - if cg6IterationDefs.allocateG6WriteIterator(&self._g6WriteIterator, graph_to_write._theGraph) != cappconst.OK: - raise MemoryError("allocateG6WriteIterator() failed.") + if cg6IterationDefs.g6_NewWriter(&self._g6WriteIterator, graph_to_write._theGraph) != cappconst.OK: + raise MemoryError("Unable to initialize G6WriteIterator, as g6_NewWriter() in EAPS graphLib failed.") def __dealloc__(self): if self._g6WriteIterator != NULL: - if cg6IterationDefs.endG6WriteIteration(self._g6WriteIterator) != cappconst.OK: - raise RuntimeError("endG6WriteIteration() failed.") - - if cg6IterationDefs.freeG6WriteIterator(&self._g6WriteIterator) != cappconst.OK: - raise MemoryError("freeG6WriteIterator() failed.") - - def begin_iteration(self, str outfile_name): - # Convert Python str to UTF-8 encoded bytes, and then to const char * - cdef bytes encoded = outfile_name.encode('utf-8') - cdef const char *FileName = encoded - - if cg6IterationDefs.beginG6WriteIterationToG6FilePath(self._g6WriteIterator, FileName) != cappconst.OK: - raise RuntimeError(f"beginG6WriteIteration() failed.") + cg6IterationDefs.g6_FreeWriter(&self._g6WriteIterator) - def write_graph(self): - if cg6IterationDefs.writeGraphUsingG6WriteIterator(self._g6WriteIterator) != cappconst.OK: - raise RuntimeError(f"writeGraphUsingG6WriteIterator() failed.") - def reinitialize_currGraph(self): self._currGraph.gp_ReinitializeGraph() def update_graph_to_write(self, graph.Graph next_graph): - if next_graph.is_graph_NULL() or next_graph.gp_getN() == 0: + if next_graph.is_graph_NULL() or next_graph.gp_GetN() == 0: raise ValueError( "Graph to write is invalid: either not allocated or not " "initialized.") @@ -114,3 +94,15 @@ cdef class G6WriteIterator: raise RuntimeError( "Failed to copy next_graph into G6WriteIterator's currGraph." ) from copy_graph_error + + def g6_InitWriterWithFileName(self, str outfile_name): + # Convert Python str to UTF-8 encoded bytes, and then to const char * + cdef bytes encoded = outfile_name.encode('utf-8') + cdef const char *FileName = encoded + + if cg6IterationDefs.g6_InitWriterWithFileName(self._g6WriteIterator, FileName) != cappconst.OK: + raise RuntimeError(f"Unable to initialize writer with filename, as g6_InitWriterWithFileName() in EAPS graphLib failed.") + + def g6_WriteGraph(self): + if cg6IterationDefs.g6_WriteGraph(self._g6WriteIterator) != cappconst.OK: + raise RuntimeError(f"Unable to write graph, as g6_WriteGraph() in EAPS graphLib failed.") diff --git a/planarity/full/graph.c b/planarity/full/graph.c index d056e81..1b4147a 100644 --- a/planarity/full/graph.c +++ b/planarity/full/graph.c @@ -2366,16 +2366,16 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_8gp_IsArc(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_10gp_GetFirstEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_12gp_EdgeInUse(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_14gp_EdgeIndexBound(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_16gp_EdgeInUseIndexBound(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_14gp_EdgeArraySize(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_16gp_EdgeInUseArraySize(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_18gp_GetFirstArc(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_20gp_GetNextArc(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_22gp_GetNeighbor(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_24gp_IsVertex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_26gp_GetFirstVertex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_28gp_GetLastVertex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_30gp_VertexInRange(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_32gp_getN(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_30gp_VertexInRangeAscending(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_32gp_GetN(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_34gp_InitGraph(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_n); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_36gp_ReinitializeGraph(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_38gp_CopyGraph(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_src_graph); /* proto */ @@ -2387,7 +2387,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_48gp_GetVertexDegree(st static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_50gp_GetArcCapacity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_52gp_EnsureArcCapacity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_new_arc_capacity); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_AddEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_u, int __pyx_v_ulink, int __pyx_v_v, int __pyx_v_vlink); /* proto */ -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_56gp_DeleteEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e, int __pyx_v_nextLink); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_56gp_DeleteEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_58gp_AttachDrawPlanar(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_60gp_AttachK23Search(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_62gp_AttachK33Search(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ @@ -2423,7 +2423,7 @@ typedef struct { __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; PyObject *__pyx_codeobj_tab[35]; - PyObject *__pyx_string_tab[205]; + PyObject *__pyx_string_tab[203]; PyObject *__pyx_number_tab[1]; /* #### Code section: module_state_contents ### */ /* CommonTypesMetaclass.module_state_decls */ @@ -2472,73 +2472,73 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati #define __pyx_kp_u_Failed_to_attach_K4Search_algori __pyx_string_tab[4] #define __pyx_kp_u_Graph_is_not_initialized __pyx_string_tab[5] #define __pyx_kp_u_Invalid_graph_format_specifier __pyx_string_tab[6] -#define __pyx_kp_u_Invalid_link_index_for_nextLink __pyx_string_tab[7] -#define __pyx_kp_u_Invalid_link_index_for_ulink __pyx_string_tab[8] -#define __pyx_kp_u_Invalid_link_index_for_vlink __pyx_string_tab[9] -#define __pyx_kp_u_None __pyx_string_tab[10] -#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[11] -#define __pyx_kp_u_Source_and_destination_graphs_mu __pyx_string_tab[12] -#define __pyx_kp_u_Source_graph_either_has_not_been __pyx_string_tab[13] -#define __pyx_kp_u_Unable_to_add_edge_u_v __pyx_string_tab[14] -#define __pyx_kp_u_Unable_to_create_new_Graph_conta __pyx_string_tab[15] -#define __pyx_kp_u__2 __pyx_string_tab[16] -#define __pyx_kp_u__3 __pyx_string_tab[17] -#define __pyx_kp_u__4 __pyx_string_tab[18] -#define __pyx_kp_u__5 __pyx_string_tab[19] -#define __pyx_kp_u_add_note __pyx_string_tab[20] -#define __pyx_kp_u_and_vlink __pyx_string_tab[21] -#define __pyx_kp_u_disable __pyx_string_tab[22] -#define __pyx_kp_u_enable __pyx_string_tab[23] -#define __pyx_kp_u_failed __pyx_string_tab[24] -#define __pyx_kp_u_gc __pyx_string_tab[25] -#define __pyx_kp_u_gp_CopyGraph_failed __pyx_string_tab[26] -#define __pyx_kp_u_gp_DeleteEdge_failed_invalid_arc __pyx_string_tab[27] -#define __pyx_kp_u_gp_DupGraph_failed __pyx_string_tab[28] -#define __pyx_kp_u_gp_EdgeInUse_failed_invalid_edge __pyx_string_tab[29] -#define __pyx_kp_u_gp_EnsureArcCapacity_failed_to_s __pyx_string_tab[30] -#define __pyx_kp_u_gp_GetFirstArc_failed_invalid_ve __pyx_string_tab[31] -#define __pyx_kp_u_gp_GetNeighbor_failed_invalid_ed __pyx_string_tab[32] -#define __pyx_kp_u_gp_GetNextArc_failed_invalid_edg __pyx_string_tab[33] -#define __pyx_kp_u_gp_InitGraph_failed __pyx_string_tab[34] -#define __pyx_kp_u_gp_New_failed __pyx_string_tab[35] -#define __pyx_kp_u_gp_Read_failed __pyx_string_tab[36] -#define __pyx_kp_u_gp_Write_of_graph_to __pyx_string_tab[37] -#define __pyx_kp_u_is_not_a_valid_vertex_label __pyx_string_tab[38] -#define __pyx_kp_u_is_not_one_of_gam __pyx_string_tab[39] -#define __pyx_kp_u_isenabled __pyx_string_tab[40] -#define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[41] -#define __pyx_kp_u_planarity_full_graph_pyx __pyx_string_tab[42] -#define __pyx_kp_u_stringsource __pyx_string_tab[43] -#define __pyx_kp_u_with_ulink __pyx_string_tab[44] -#define __pyx_n_u_EMBEDFLAGS_DRAWPLANAR __pyx_string_tab[45] -#define __pyx_n_u_EMBEDFLAGS_OUTERPLANAR __pyx_string_tab[46] -#define __pyx_n_u_EMBEDFLAGS_PLANAR __pyx_string_tab[47] -#define __pyx_n_u_EMBEDFLAGS_SEARCHFORK23 __pyx_string_tab[48] -#define __pyx_n_u_EMBEDFLAGS_SEARCHFORK33 __pyx_string_tab[49] -#define __pyx_n_u_EMBEDFLAGS_SEARCHFORK4 __pyx_string_tab[50] -#define __pyx_n_u_FileName __pyx_string_tab[51] -#define __pyx_n_u_Graph __pyx_string_tab[52] -#define __pyx_n_u_Graph___reduce_cython __pyx_string_tab[53] -#define __pyx_n_u_Graph___setstate_cython __pyx_string_tab[54] -#define __pyx_n_u_Graph_get_wrapper_for_graphP __pyx_string_tab[55] -#define __pyx_n_u_Graph_gp_AddEdge __pyx_string_tab[56] -#define __pyx_n_u_Graph_gp_AttachDrawPlanar __pyx_string_tab[57] -#define __pyx_n_u_Graph_gp_AttachK23Search __pyx_string_tab[58] -#define __pyx_n_u_Graph_gp_AttachK33Search __pyx_string_tab[59] -#define __pyx_n_u_Graph_gp_AttachK4Search __pyx_string_tab[60] -#define __pyx_n_u_Graph_gp_CopyGraph __pyx_string_tab[61] -#define __pyx_n_u_Graph_gp_DeleteEdge __pyx_string_tab[62] -#define __pyx_n_u_Graph_gp_DupGraph __pyx_string_tab[63] +#define __pyx_kp_u_Invalid_link_index_for_ulink __pyx_string_tab[7] +#define __pyx_kp_u_Invalid_link_index_for_vlink __pyx_string_tab[8] +#define __pyx_kp_u_None __pyx_string_tab[9] +#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[10] +#define __pyx_kp_u_Source_and_destination_graphs_mu __pyx_string_tab[11] +#define __pyx_kp_u_Source_graph_either_has_not_been __pyx_string_tab[12] +#define __pyx_kp_u_Unable_to_add_edge_u_v __pyx_string_tab[13] +#define __pyx_kp_u_Unable_to_create_new_Graph_conta __pyx_string_tab[14] +#define __pyx_kp_u__2 __pyx_string_tab[15] +#define __pyx_kp_u__3 __pyx_string_tab[16] +#define __pyx_kp_u__4 __pyx_string_tab[17] +#define __pyx_kp_u__5 __pyx_string_tab[18] +#define __pyx_kp_u_add_note __pyx_string_tab[19] +#define __pyx_kp_u_and_vlink __pyx_string_tab[20] +#define __pyx_kp_u_disable __pyx_string_tab[21] +#define __pyx_kp_u_enable __pyx_string_tab[22] +#define __pyx_kp_u_failed __pyx_string_tab[23] +#define __pyx_kp_u_gc __pyx_string_tab[24] +#define __pyx_kp_u_gp_CopyGraph_failed __pyx_string_tab[25] +#define __pyx_kp_u_gp_DeleteEdge_failed_invalid_arc __pyx_string_tab[26] +#define __pyx_kp_u_gp_DupGraph_failed __pyx_string_tab[27] +#define __pyx_kp_u_gp_EdgeInUse_failed_invalid_edge __pyx_string_tab[28] +#define __pyx_kp_u_gp_EnsureArcCapacity_failed_to_s __pyx_string_tab[29] +#define __pyx_kp_u_gp_GetFirstArc_failed_invalid_ve __pyx_string_tab[30] +#define __pyx_kp_u_gp_GetNeighbor_failed_invalid_ed __pyx_string_tab[31] +#define __pyx_kp_u_gp_GetNextArc_failed_invalid_edg __pyx_string_tab[32] +#define __pyx_kp_u_gp_InitGraph_failed __pyx_string_tab[33] +#define __pyx_kp_u_gp_New_failed __pyx_string_tab[34] +#define __pyx_kp_u_gp_Read_failed __pyx_string_tab[35] +#define __pyx_kp_u_gp_Write_of_graph_to __pyx_string_tab[36] +#define __pyx_kp_u_is_not_a_valid_vertex_label __pyx_string_tab[37] +#define __pyx_kp_u_is_not_one_of_gam __pyx_string_tab[38] +#define __pyx_kp_u_isenabled __pyx_string_tab[39] +#define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[40] +#define __pyx_kp_u_planarity_full_graph_pyx __pyx_string_tab[41] +#define __pyx_kp_u_stringsource __pyx_string_tab[42] +#define __pyx_kp_u_with_ulink __pyx_string_tab[43] +#define __pyx_n_u_EMBEDFLAGS_DRAWPLANAR __pyx_string_tab[44] +#define __pyx_n_u_EMBEDFLAGS_OUTERPLANAR __pyx_string_tab[45] +#define __pyx_n_u_EMBEDFLAGS_PLANAR __pyx_string_tab[46] +#define __pyx_n_u_EMBEDFLAGS_SEARCHFORK23 __pyx_string_tab[47] +#define __pyx_n_u_EMBEDFLAGS_SEARCHFORK33 __pyx_string_tab[48] +#define __pyx_n_u_EMBEDFLAGS_SEARCHFORK4 __pyx_string_tab[49] +#define __pyx_n_u_FileName __pyx_string_tab[50] +#define __pyx_n_u_Graph __pyx_string_tab[51] +#define __pyx_n_u_Graph___reduce_cython __pyx_string_tab[52] +#define __pyx_n_u_Graph___setstate_cython __pyx_string_tab[53] +#define __pyx_n_u_Graph_get_wrapper_for_graphP __pyx_string_tab[54] +#define __pyx_n_u_Graph_gp_AddEdge __pyx_string_tab[55] +#define __pyx_n_u_Graph_gp_AttachDrawPlanar __pyx_string_tab[56] +#define __pyx_n_u_Graph_gp_AttachK23Search __pyx_string_tab[57] +#define __pyx_n_u_Graph_gp_AttachK33Search __pyx_string_tab[58] +#define __pyx_n_u_Graph_gp_AttachK4Search __pyx_string_tab[59] +#define __pyx_n_u_Graph_gp_CopyGraph __pyx_string_tab[60] +#define __pyx_n_u_Graph_gp_DeleteEdge __pyx_string_tab[61] +#define __pyx_n_u_Graph_gp_DupGraph __pyx_string_tab[62] +#define __pyx_n_u_Graph_gp_EdgeArraySize __pyx_string_tab[63] #define __pyx_n_u_Graph_gp_EdgeInUse __pyx_string_tab[64] -#define __pyx_n_u_Graph_gp_EdgeInUseIndexBound __pyx_string_tab[65] -#define __pyx_n_u_Graph_gp_EdgeIndexBound __pyx_string_tab[66] -#define __pyx_n_u_Graph_gp_Embed __pyx_string_tab[67] -#define __pyx_n_u_Graph_gp_EnsureArcCapacity __pyx_string_tab[68] -#define __pyx_n_u_Graph_gp_GetArcCapacity __pyx_string_tab[69] -#define __pyx_n_u_Graph_gp_GetFirstArc __pyx_string_tab[70] -#define __pyx_n_u_Graph_gp_GetFirstEdge __pyx_string_tab[71] -#define __pyx_n_u_Graph_gp_GetFirstVertex __pyx_string_tab[72] -#define __pyx_n_u_Graph_gp_GetLastVertex __pyx_string_tab[73] +#define __pyx_n_u_Graph_gp_EdgeInUseArraySize __pyx_string_tab[65] +#define __pyx_n_u_Graph_gp_Embed __pyx_string_tab[66] +#define __pyx_n_u_Graph_gp_EnsureArcCapacity __pyx_string_tab[67] +#define __pyx_n_u_Graph_gp_GetArcCapacity __pyx_string_tab[68] +#define __pyx_n_u_Graph_gp_GetFirstArc __pyx_string_tab[69] +#define __pyx_n_u_Graph_gp_GetFirstEdge __pyx_string_tab[70] +#define __pyx_n_u_Graph_gp_GetFirstVertex __pyx_string_tab[71] +#define __pyx_n_u_Graph_gp_GetLastVertex __pyx_string_tab[72] +#define __pyx_n_u_Graph_gp_GetN __pyx_string_tab[73] #define __pyx_n_u_Graph_gp_GetNeighbor __pyx_string_tab[74] #define __pyx_n_u_Graph_gp_GetNeighborEdgeRecord __pyx_string_tab[75] #define __pyx_n_u_Graph_gp_GetNextArc __pyx_string_tab[76] @@ -2549,45 +2549,45 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati #define __pyx_n_u_Graph_gp_Read __pyx_string_tab[81] #define __pyx_n_u_Graph_gp_ReinitializeGraph __pyx_string_tab[82] #define __pyx_n_u_Graph_gp_TestEmbedResultIntegrit __pyx_string_tab[83] -#define __pyx_n_u_Graph_gp_VertexInRange __pyx_string_tab[84] +#define __pyx_n_u_Graph_gp_VertexInRangeAscending __pyx_string_tab[84] #define __pyx_n_u_Graph_gp_Write __pyx_string_tab[85] -#define __pyx_n_u_Graph_gp_getN __pyx_string_tab[86] -#define __pyx_n_u_Graph_is_graph_NULL __pyx_string_tab[87] -#define __pyx_n_u_NIL __pyx_string_tab[88] -#define __pyx_n_u_NONEMBEDDABLE __pyx_string_tab[89] -#define __pyx_n_u_NOTOK __pyx_string_tab[90] -#define __pyx_n_u_OK __pyx_string_tab[91] -#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[92] -#define __pyx_n_u_a __pyx_string_tab[93] -#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[94] -#define __pyx_n_u_cline_in_traceback __pyx_string_tab[95] -#define __pyx_n_u_copy_of_orig_graph __pyx_string_tab[96] -#define __pyx_n_u_e __pyx_string_tab[97] -#define __pyx_n_u_embedFlags __pyx_string_tab[98] -#define __pyx_n_u_embed_result __pyx_string_tab[99] -#define __pyx_n_u_encoded __pyx_string_tab[100] -#define __pyx_n_u_func __pyx_string_tab[101] -#define __pyx_n_u_g __pyx_string_tab[102] -#define __pyx_n_u_get_wrapper_for_graphP __pyx_string_tab[103] -#define __pyx_n_u_getstate __pyx_string_tab[104] -#define __pyx_n_u_gp_AddEdge __pyx_string_tab[105] -#define __pyx_n_u_gp_AttachDrawPlanar __pyx_string_tab[106] -#define __pyx_n_u_gp_AttachK23Search __pyx_string_tab[107] -#define __pyx_n_u_gp_AttachK33Search __pyx_string_tab[108] -#define __pyx_n_u_gp_AttachK4Search __pyx_string_tab[109] -#define __pyx_n_u_gp_CopyGraph __pyx_string_tab[110] -#define __pyx_n_u_gp_DeleteEdge __pyx_string_tab[111] -#define __pyx_n_u_gp_DupGraph __pyx_string_tab[112] +#define __pyx_n_u_Graph_is_graph_NULL __pyx_string_tab[86] +#define __pyx_n_u_NIL __pyx_string_tab[87] +#define __pyx_n_u_NONEMBEDDABLE __pyx_string_tab[88] +#define __pyx_n_u_NOTOK __pyx_string_tab[89] +#define __pyx_n_u_OK __pyx_string_tab[90] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[91] +#define __pyx_n_u_a __pyx_string_tab[92] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[93] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[94] +#define __pyx_n_u_copy_of_orig_graph __pyx_string_tab[95] +#define __pyx_n_u_e __pyx_string_tab[96] +#define __pyx_n_u_embedFlags __pyx_string_tab[97] +#define __pyx_n_u_embed_result __pyx_string_tab[98] +#define __pyx_n_u_encoded __pyx_string_tab[99] +#define __pyx_n_u_func __pyx_string_tab[100] +#define __pyx_n_u_g __pyx_string_tab[101] +#define __pyx_n_u_get_wrapper_for_graphP __pyx_string_tab[102] +#define __pyx_n_u_getstate __pyx_string_tab[103] +#define __pyx_n_u_gp_AddEdge __pyx_string_tab[104] +#define __pyx_n_u_gp_AttachDrawPlanar __pyx_string_tab[105] +#define __pyx_n_u_gp_AttachK23Search __pyx_string_tab[106] +#define __pyx_n_u_gp_AttachK33Search __pyx_string_tab[107] +#define __pyx_n_u_gp_AttachK4Search __pyx_string_tab[108] +#define __pyx_n_u_gp_CopyGraph __pyx_string_tab[109] +#define __pyx_n_u_gp_DeleteEdge __pyx_string_tab[110] +#define __pyx_n_u_gp_DupGraph __pyx_string_tab[111] +#define __pyx_n_u_gp_EdgeArraySize __pyx_string_tab[112] #define __pyx_n_u_gp_EdgeInUse __pyx_string_tab[113] -#define __pyx_n_u_gp_EdgeInUseIndexBound __pyx_string_tab[114] -#define __pyx_n_u_gp_EdgeIndexBound __pyx_string_tab[115] -#define __pyx_n_u_gp_Embed __pyx_string_tab[116] -#define __pyx_n_u_gp_EnsureArcCapacity __pyx_string_tab[117] -#define __pyx_n_u_gp_GetArcCapacity __pyx_string_tab[118] -#define __pyx_n_u_gp_GetFirstArc __pyx_string_tab[119] -#define __pyx_n_u_gp_GetFirstEdge __pyx_string_tab[120] -#define __pyx_n_u_gp_GetFirstVertex __pyx_string_tab[121] -#define __pyx_n_u_gp_GetLastVertex __pyx_string_tab[122] +#define __pyx_n_u_gp_EdgeInUseArraySize __pyx_string_tab[114] +#define __pyx_n_u_gp_Embed __pyx_string_tab[115] +#define __pyx_n_u_gp_EnsureArcCapacity __pyx_string_tab[116] +#define __pyx_n_u_gp_GetArcCapacity __pyx_string_tab[117] +#define __pyx_n_u_gp_GetFirstArc __pyx_string_tab[118] +#define __pyx_n_u_gp_GetFirstEdge __pyx_string_tab[119] +#define __pyx_n_u_gp_GetFirstVertex __pyx_string_tab[120] +#define __pyx_n_u_gp_GetLastVertex __pyx_string_tab[121] +#define __pyx_n_u_gp_GetN __pyx_string_tab[122] #define __pyx_n_u_gp_GetNeighbor __pyx_string_tab[123] #define __pyx_n_u_gp_GetNeighborEdgeRecord __pyx_string_tab[124] #define __pyx_n_u_gp_GetNextArc __pyx_string_tab[125] @@ -2598,78 +2598,76 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati #define __pyx_n_u_gp_Read __pyx_string_tab[130] #define __pyx_n_u_gp_ReinitializeGraph __pyx_string_tab[131] #define __pyx_n_u_gp_TestEmbedResultIntegrity __pyx_string_tab[132] -#define __pyx_n_u_gp_VertexInRange __pyx_string_tab[133] +#define __pyx_n_u_gp_VertexInRangeAscending __pyx_string_tab[133] #define __pyx_n_u_gp_Write __pyx_string_tab[134] -#define __pyx_n_u_gp_getN __pyx_string_tab[135] -#define __pyx_n_u_infile_name __pyx_string_tab[136] -#define __pyx_n_u_int __pyx_string_tab[137] -#define __pyx_n_u_is_coroutine __pyx_string_tab[138] -#define __pyx_n_u_is_graph_NULL __pyx_string_tab[139] -#define __pyx_n_u_items __pyx_string_tab[140] -#define __pyx_n_u_m __pyx_string_tab[141] -#define __pyx_n_u_main __pyx_string_tab[142] -#define __pyx_n_u_mode __pyx_string_tab[143] -#define __pyx_n_u_mode_code __pyx_string_tab[144] -#define __pyx_n_u_module __pyx_string_tab[145] -#define __pyx_n_u_n __pyx_string_tab[146] -#define __pyx_n_u_name __pyx_string_tab[147] -#define __pyx_n_u_new_arc_capacity __pyx_string_tab[148] -#define __pyx_n_u_new_graph __pyx_string_tab[149] -#define __pyx_n_u_new_wrapper __pyx_string_tab[150] -#define __pyx_n_u_nextLink __pyx_string_tab[151] -#define __pyx_n_u_outfile_name __pyx_string_tab[152] -#define __pyx_n_u_planarity_full_graph __pyx_string_tab[153] -#define __pyx_n_u_pop __pyx_string_tab[154] -#define __pyx_n_u_pyx_state __pyx_string_tab[155] -#define __pyx_n_u_qualname __pyx_string_tab[156] -#define __pyx_n_u_reduce __pyx_string_tab[157] -#define __pyx_n_u_reduce_cython __pyx_string_tab[158] -#define __pyx_n_u_reduce_ex __pyx_string_tab[159] -#define __pyx_n_u_return __pyx_string_tab[160] -#define __pyx_n_u_self __pyx_string_tab[161] -#define __pyx_n_u_set_name __pyx_string_tab[162] -#define __pyx_n_u_setdefault __pyx_string_tab[163] -#define __pyx_n_u_setstate __pyx_string_tab[164] -#define __pyx_n_u_setstate_cython __pyx_string_tab[165] -#define __pyx_n_u_src_graph __pyx_string_tab[166] -#define __pyx_n_u_test __pyx_string_tab[167] -#define __pyx_n_u_theGraph_dup __pyx_string_tab[168] -#define __pyx_n_u_u __pyx_string_tab[169] -#define __pyx_n_u_ulink __pyx_string_tab[170] -#define __pyx_n_u_v __pyx_string_tab[171] -#define __pyx_n_u_values __pyx_string_tab[172] -#define __pyx_n_u_vlink __pyx_string_tab[173] -#define __pyx_kp_b_iso88591_4_Q_aq_Q __pyx_string_tab[174] -#define __pyx_kp_b_iso88591_A_4q __pyx_string_tab[175] -#define __pyx_kp_b_iso88591_A_4t9AQ_a_7q_9Cr_Yc_a_4AQ_at_s __pyx_string_tab[176] -#define __pyx_kp_b_iso88591_A_4t9AQ_a_Qa_Qd_a __pyx_string_tab[177] -#define __pyx_kp_b_iso88591_A_4t9AQ_a_aq_at_q __pyx_string_tab[178] -#define __pyx_kp_b_iso88591_A_4t9AQ_a_q_q_L __pyx_string_tab[179] -#define __pyx_kp_b_iso88591_A_4t_q_a_A_q_L __pyx_string_tab[180] -#define __pyx_kp_b_iso88591_A_4t_q_as_1_1D_A __pyx_string_tab[181] -#define __pyx_kp_b_iso88591_A_4t_q_as_1_4t_q_as_1_1_l_Q __pyx_string_tab[182] -#define __pyx_kp_b_iso88591_A_6_Bd_1_a_1_6_Bd_1_a_1_Kq_L_7_W __pyx_string_tab[183] -#define __pyx_kp_b_iso88591_A_9N_S_Cq_A_4xs_Yha_A_M_l_ST_aq __pyx_string_tab[184] -#define __pyx_kp_b_iso88591_A_M_l_aq __pyx_string_tab[185] -#define __pyx_kp_b_iso88591_A_Q __pyx_string_tab[186] -#define __pyx_kp_b_iso88591_A_Q_aq __pyx_string_tab[187] -#define __pyx_kp_b_iso88591_A_Y_0_S_E_A_m5_1_4q_A_31A_A_IQd __pyx_string_tab[188] -#define __pyx_kp_b_iso88591_A_a __pyx_string_tab[189] -#define __pyx_kp_b_iso88591_A_at1 __pyx_string_tab[190] -#define __pyx_kp_b_iso88591_A_at_1_aq __pyx_string_tab[191] -#define __pyx_kp_b_iso88591_A_c_s_at_q __pyx_string_tab[192] -#define __pyx_kp_b_iso88591_A_l_LLXY_a_1 __pyx_string_tab[193] -#define __pyx_kp_b_iso88591_A_q_A __pyx_string_tab[194] -#define __pyx_kp_b_iso88591_A_q_A_HAT_Z_1_aq __pyx_string_tab[195] -#define __pyx_kp_b_iso88591_A_q_L_A_aq __pyx_string_tab[196] -#define __pyx_kp_b_iso88591_A_s_A_s_t1 __pyx_string_tab[197] -#define __pyx_kp_b_iso88591_A_s_d_r_t1_aq __pyx_string_tab[198] -#define __pyx_kp_b_iso88591_A_t_c __pyx_string_tab[199] -#define __pyx_kp_b_iso88591_Q __pyx_string_tab[200] -#define __pyx_kp_b_iso88591_Q_6l_4q_1_Qa_uA_S_Qa_9Ks_Qay_a __pyx_string_tab[201] -#define __pyx_kp_b_iso88591_YYZ_4AT_EWWccd __pyx_string_tab[202] -#define __pyx_kp_b_iso88591_a_k_A_Qa_A_q __pyx_string_tab[203] -#define __pyx_kp_b_iso88591_l __pyx_string_tab[204] +#define __pyx_n_u_infile_name __pyx_string_tab[135] +#define __pyx_n_u_int __pyx_string_tab[136] +#define __pyx_n_u_is_coroutine __pyx_string_tab[137] +#define __pyx_n_u_is_graph_NULL __pyx_string_tab[138] +#define __pyx_n_u_items __pyx_string_tab[139] +#define __pyx_n_u_m __pyx_string_tab[140] +#define __pyx_n_u_main __pyx_string_tab[141] +#define __pyx_n_u_mode __pyx_string_tab[142] +#define __pyx_n_u_mode_code __pyx_string_tab[143] +#define __pyx_n_u_module __pyx_string_tab[144] +#define __pyx_n_u_n __pyx_string_tab[145] +#define __pyx_n_u_name __pyx_string_tab[146] +#define __pyx_n_u_new_arc_capacity __pyx_string_tab[147] +#define __pyx_n_u_new_graph __pyx_string_tab[148] +#define __pyx_n_u_new_wrapper __pyx_string_tab[149] +#define __pyx_n_u_outfile_name __pyx_string_tab[150] +#define __pyx_n_u_planarity_full_graph __pyx_string_tab[151] +#define __pyx_n_u_pop __pyx_string_tab[152] +#define __pyx_n_u_pyx_state __pyx_string_tab[153] +#define __pyx_n_u_qualname __pyx_string_tab[154] +#define __pyx_n_u_reduce __pyx_string_tab[155] +#define __pyx_n_u_reduce_cython __pyx_string_tab[156] +#define __pyx_n_u_reduce_ex __pyx_string_tab[157] +#define __pyx_n_u_return __pyx_string_tab[158] +#define __pyx_n_u_self __pyx_string_tab[159] +#define __pyx_n_u_set_name __pyx_string_tab[160] +#define __pyx_n_u_setdefault __pyx_string_tab[161] +#define __pyx_n_u_setstate __pyx_string_tab[162] +#define __pyx_n_u_setstate_cython __pyx_string_tab[163] +#define __pyx_n_u_src_graph __pyx_string_tab[164] +#define __pyx_n_u_test __pyx_string_tab[165] +#define __pyx_n_u_theGraph_dup __pyx_string_tab[166] +#define __pyx_n_u_u __pyx_string_tab[167] +#define __pyx_n_u_ulink __pyx_string_tab[168] +#define __pyx_n_u_v __pyx_string_tab[169] +#define __pyx_n_u_values __pyx_string_tab[170] +#define __pyx_n_u_vlink __pyx_string_tab[171] +#define __pyx_kp_b_iso88591_4_Q_aq_Q __pyx_string_tab[172] +#define __pyx_kp_b_iso88591_A_4q __pyx_string_tab[173] +#define __pyx_kp_b_iso88591_A_4t9AQ_a_7q_at_q __pyx_string_tab[174] +#define __pyx_kp_b_iso88591_A_4t9AQ_a_Qa_Qd_a __pyx_string_tab[175] +#define __pyx_kp_b_iso88591_A_4t9AQ_a_aq_at_q __pyx_string_tab[176] +#define __pyx_kp_b_iso88591_A_4t9AQ_a_q_q_L __pyx_string_tab[177] +#define __pyx_kp_b_iso88591_A_4t_q_a_A_q_L __pyx_string_tab[178] +#define __pyx_kp_b_iso88591_A_4t_q_as_1_1D_A __pyx_string_tab[179] +#define __pyx_kp_b_iso88591_A_4t_q_as_1_4t_q_as_1_1_l_Q __pyx_string_tab[180] +#define __pyx_kp_b_iso88591_A_6_Bd_1_a_1_6_Bd_1_a_1_Kq_L_7_W __pyx_string_tab[181] +#define __pyx_kp_b_iso88591_A_9N_S_Cq_A_4xs_Yha_A_M_l_ST_aq __pyx_string_tab[182] +#define __pyx_kp_b_iso88591_A_M_l_aq __pyx_string_tab[183] +#define __pyx_kp_b_iso88591_A_Q __pyx_string_tab[184] +#define __pyx_kp_b_iso88591_A_Q_aq __pyx_string_tab[185] +#define __pyx_kp_b_iso88591_A_Y_0_S_E_A_m5_1_4q_A_31A_A_IQd __pyx_string_tab[186] +#define __pyx_kp_b_iso88591_A_a __pyx_string_tab[187] +#define __pyx_kp_b_iso88591_A_at1 __pyx_string_tab[188] +#define __pyx_kp_b_iso88591_A_at1_2 __pyx_string_tab[189] +#define __pyx_kp_b_iso88591_A_at_1_aq __pyx_string_tab[190] +#define __pyx_kp_b_iso88591_A_c_s_q_L __pyx_string_tab[191] +#define __pyx_kp_b_iso88591_A_l_LLXY_a_1 __pyx_string_tab[192] +#define __pyx_kp_b_iso88591_A_q_A_HAT_Z_1_aq __pyx_string_tab[193] +#define __pyx_kp_b_iso88591_A_q_L_A_aq __pyx_string_tab[194] +#define __pyx_kp_b_iso88591_A_s_A_s_t1_l __pyx_string_tab[195] +#define __pyx_kp_b_iso88591_A_s_d_r_d_at_q __pyx_string_tab[196] +#define __pyx_kp_b_iso88591_A_t_c __pyx_string_tab[197] +#define __pyx_kp_b_iso88591_Q __pyx_string_tab[198] +#define __pyx_kp_b_iso88591_Q_6l_4q_1_Qa_uA_S_Qa_9Ks_Qay_a __pyx_string_tab[199] +#define __pyx_kp_b_iso88591_YYZ_4AT_EWWccd __pyx_string_tab[200] +#define __pyx_kp_b_iso88591_a_k_A_Qa_A_q __pyx_string_tab[201] +#define __pyx_kp_b_iso88591_l __pyx_string_tab[202] #define __pyx_int_0 __pyx_number_tab[0] /* #### Code section: module_state_clear ### */ #if CYTHON_USE_MODULE_STATE @@ -2688,7 +2686,7 @@ static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_ptype_9planarity_4full_5graph_Graph); Py_CLEAR(clear_module_state->__pyx_type_9planarity_4full_5graph_Graph); for (int i=0; i<35; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } - for (int i=0; i<205; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } + for (int i=0; i<203; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); } /* #### Code section: module_state_clear_contents ### */ /* CommonTypesMetaclass.module_state_clear */ @@ -2715,7 +2713,7 @@ static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void Py_VISIT(traverse_module_state->__pyx_ptype_9planarity_4full_5graph_Graph); Py_VISIT(traverse_module_state->__pyx_type_9planarity_4full_5graph_Graph); for (int i=0; i<35; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } - for (int i=0; i<205; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } + for (int i=0; i<203; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); } /* #### Code section: module_state_traverse_contents ### */ /* CommonTypesMetaclass.module_state_traverse */ @@ -3295,7 +3293,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_8gp_IsArc(struct __pyx_ * def gp_IsArc(self, int e): * return ( # <<<<<<<<<<<<<< * (e >= self.gp_GetFirstEdge()) and - * (e < self.gp_EdgeIndexBound()) and + * (e < self.gp_EdgeArraySize()) and */ __Pyx_XDECREF(__pyx_r); @@ -3303,8 +3301,8 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_8gp_IsArc(struct __pyx_ * def gp_IsArc(self, int e): * return ( * (e >= self.gp_GetFirstEdge()) and # <<<<<<<<<<<<<< - * (e < self.gp_EdgeIndexBound()) and - * cgraphLib.gp_IsArc(e) + * (e < self.gp_EdgeArraySize()) and + * cgraphLib.gp_IsArc(self._theGraph, e) */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); @@ -3334,8 +3332,8 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_8gp_IsArc(struct __pyx_ /* "planarity/full/graph.pyx":54 * return ( * (e >= self.gp_GetFirstEdge()) and - * (e < self.gp_EdgeIndexBound()) and # <<<<<<<<<<<<<< - * cgraphLib.gp_IsArc(e) + * (e < self.gp_EdgeArraySize()) and # <<<<<<<<<<<<<< + * cgraphLib.gp_IsArc(self._theGraph, e) * ) */ __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error) @@ -3345,7 +3343,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_8gp_IsArc(struct __pyx_ __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; - __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeIndexBound, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeArraySize, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); @@ -3365,12 +3363,12 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_8gp_IsArc(struct __pyx_ /* "planarity/full/graph.pyx":55 * (e >= self.gp_GetFirstEdge()) and - * (e < self.gp_EdgeIndexBound()) and - * cgraphLib.gp_IsArc(e) # <<<<<<<<<<<<<< + * (e < self.gp_EdgeArraySize()) and + * cgraphLib.gp_IsArc(self._theGraph, e) # <<<<<<<<<<<<<< * ) * */ - __pyx_t_7 = gp_IsArc(__pyx_v_e); + __pyx_t_7 = gp_IsArc(__pyx_v_self->_theGraph, __pyx_v_e); __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __pyx_t_2; @@ -3682,7 +3680,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_12gp_EdgeInUse(struct _ * * return cgraphLib.gp_EdgeInUse(self._theGraph, e) # <<<<<<<<<<<<<< * - * def gp_EdgeIndexBound(self): + * def gp_EdgeArraySize(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyLong_From_int(gp_EdgeInUse(__pyx_v_self->_theGraph, __pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) @@ -3716,22 +3714,22 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_12gp_EdgeInUse(struct _ /* "planarity/full/graph.pyx":69 * return cgraphLib.gp_EdgeInUse(self._theGraph, e) * - * def gp_EdgeIndexBound(self): # <<<<<<<<<<<<<< - * return cgraphLib.gp_EdgeIndexBound(self._theGraph) + * def gp_EdgeArraySize(self): # <<<<<<<<<<<<<< + * return cgraphLib.gp_EdgeArraySize(self._theGraph) * */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_15gp_EdgeIndexBound(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_15gp_EdgeArraySize(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_14gp_EdgeIndexBound, "Graph.gp_EdgeIndexBound(self)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_15gp_EdgeIndexBound = {"gp_EdgeIndexBound", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_15gp_EdgeIndexBound, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_14gp_EdgeIndexBound}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_15gp_EdgeIndexBound(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_14gp_EdgeArraySize, "Graph.gp_EdgeArraySize(self)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_15gp_EdgeArraySize = {"gp_EdgeArraySize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_15gp_EdgeArraySize, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_14gp_EdgeArraySize}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_15gp_EdgeArraySize(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -3744,7 +3742,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("gp_EdgeIndexBound (wrapper)", 0); + __Pyx_RefNannySetupContext("gp_EdgeArraySize (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -3753,35 +3751,35 @@ PyObject *__pyx_args, PyObject *__pyx_kwds #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_EdgeIndexBound", 1, 0, 0, __pyx_nargs); return NULL; } + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_EdgeArraySize", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; - if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_EdgeIndexBound", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_14gp_EdgeIndexBound(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_EdgeArraySize", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_14gp_EdgeArraySize(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_14gp_EdgeIndexBound(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_14gp_EdgeArraySize(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("gp_EdgeIndexBound", 0); + __Pyx_RefNannySetupContext("gp_EdgeArraySize", 0); /* "planarity/full/graph.pyx":70 * - * def gp_EdgeIndexBound(self): - * return cgraphLib.gp_EdgeIndexBound(self._theGraph) # <<<<<<<<<<<<<< + * def gp_EdgeArraySize(self): + * return cgraphLib.gp_EdgeArraySize(self._theGraph) # <<<<<<<<<<<<<< * - * def gp_EdgeInUseIndexBound(self): + * def gp_EdgeInUseArraySize(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyLong_From_int(gp_EdgeIndexBound(__pyx_v_self->_theGraph)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_int(gp_EdgeArraySize(__pyx_v_self->_theGraph)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3790,15 +3788,15 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_14gp_EdgeIndexBound(str /* "planarity/full/graph.pyx":69 * return cgraphLib.gp_EdgeInUse(self._theGraph, e) * - * def gp_EdgeIndexBound(self): # <<<<<<<<<<<<<< - * return cgraphLib.gp_EdgeIndexBound(self._theGraph) + * def gp_EdgeArraySize(self): # <<<<<<<<<<<<<< + * return cgraphLib.gp_EdgeArraySize(self._theGraph) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("planarity.full.graph.Graph.gp_EdgeIndexBound", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_EdgeArraySize", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3807,24 +3805,24 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_14gp_EdgeIndexBound(str } /* "planarity/full/graph.pyx":72 - * return cgraphLib.gp_EdgeIndexBound(self._theGraph) + * return cgraphLib.gp_EdgeArraySize(self._theGraph) * - * def gp_EdgeInUseIndexBound(self): # <<<<<<<<<<<<<< - * return cgraphLib.gp_EdgeInUseIndexBound(self._theGraph) + * def gp_EdgeInUseArraySize(self): # <<<<<<<<<<<<<< + * return cgraphLib.gp_EdgeInUseArraySize(self._theGraph) * */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_17gp_EdgeInUseIndexBound(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_17gp_EdgeInUseArraySize(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_16gp_EdgeInUseIndexBound, "Graph.gp_EdgeInUseIndexBound(self)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_17gp_EdgeInUseIndexBound = {"gp_EdgeInUseIndexBound", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_17gp_EdgeInUseIndexBound, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_16gp_EdgeInUseIndexBound}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_17gp_EdgeInUseIndexBound(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_16gp_EdgeInUseArraySize, "Graph.gp_EdgeInUseArraySize(self)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_17gp_EdgeInUseArraySize = {"gp_EdgeInUseArraySize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_17gp_EdgeInUseArraySize, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_16gp_EdgeInUseArraySize}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_17gp_EdgeInUseArraySize(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -3837,7 +3835,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("gp_EdgeInUseIndexBound (wrapper)", 0); + __Pyx_RefNannySetupContext("gp_EdgeInUseArraySize (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -3846,52 +3844,52 @@ PyObject *__pyx_args, PyObject *__pyx_kwds #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_EdgeInUseIndexBound", 1, 0, 0, __pyx_nargs); return NULL; } + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_EdgeInUseArraySize", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; - if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_EdgeInUseIndexBound", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_16gp_EdgeInUseIndexBound(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_EdgeInUseArraySize", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_16gp_EdgeInUseArraySize(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_16gp_EdgeInUseIndexBound(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_16gp_EdgeInUseArraySize(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("gp_EdgeInUseIndexBound", 0); + __Pyx_RefNannySetupContext("gp_EdgeInUseArraySize", 0); /* "planarity/full/graph.pyx":73 * - * def gp_EdgeInUseIndexBound(self): - * return cgraphLib.gp_EdgeInUseIndexBound(self._theGraph) # <<<<<<<<<<<<<< + * def gp_EdgeInUseArraySize(self): + * return cgraphLib.gp_EdgeInUseArraySize(self._theGraph) # <<<<<<<<<<<<<< * * def gp_GetFirstArc(self, int v): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyLong_From_int(gp_EdgeInUseIndexBound(__pyx_v_self->_theGraph)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_int(gp_EdgeInUseArraySize(__pyx_v_self->_theGraph)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":72 - * return cgraphLib.gp_EdgeIndexBound(self._theGraph) + * return cgraphLib.gp_EdgeArraySize(self._theGraph) * - * def gp_EdgeInUseIndexBound(self): # <<<<<<<<<<<<<< - * return cgraphLib.gp_EdgeInUseIndexBound(self._theGraph) + * def gp_EdgeInUseArraySize(self): # <<<<<<<<<<<<<< + * return cgraphLib.gp_EdgeInUseArraySize(self._theGraph) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("planarity.full.graph.Graph.gp_EdgeInUseIndexBound", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_EdgeInUseArraySize", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3900,7 +3898,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_16gp_EdgeInUseIndexBoun } /* "planarity/full/graph.pyx":75 - * return cgraphLib.gp_EdgeInUseIndexBound(self._theGraph) + * return cgraphLib.gp_EdgeInUseArraySize(self._theGraph) * * def gp_GetFirstArc(self, int v): # <<<<<<<<<<<<<< * if not self.gp_IsVertex(v): @@ -4096,7 +4094,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_18gp_GetFirstArc(struct goto __pyx_L0; /* "planarity/full/graph.pyx":75 - * return cgraphLib.gp_EdgeInUseIndexBound(self._theGraph) + * return cgraphLib.gp_EdgeInUseArraySize(self._theGraph) * * def gp_GetFirstArc(self, int v): # <<<<<<<<<<<<<< * if not self.gp_IsVertex(v): @@ -4676,7 +4674,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_24gp_IsVertex(struct __ * return ( * (v >= self.gp_GetFirstVertex()) and # <<<<<<<<<<<<<< * (v <= self.gp_GetLastVertex()) and - * cgraphLib.gp_IsVertex(v) + * cgraphLib.gp_IsVertex(self._theGraph, v) */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); @@ -4707,7 +4705,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_24gp_IsVertex(struct __ * return ( * (v >= self.gp_GetFirstVertex()) and * (v <= self.gp_GetLastVertex()) and # <<<<<<<<<<<<<< - * cgraphLib.gp_IsVertex(v) + * cgraphLib.gp_IsVertex(self._theGraph, v) * ) */ __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 102, __pyx_L1_error) @@ -4738,11 +4736,11 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_24gp_IsVertex(struct __ /* "planarity/full/graph.pyx":103 * (v >= self.gp_GetFirstVertex()) and * (v <= self.gp_GetLastVertex()) and - * cgraphLib.gp_IsVertex(v) # <<<<<<<<<<<<<< + * cgraphLib.gp_IsVertex(self._theGraph, v) # <<<<<<<<<<<<<< * ) * */ - __pyx_t_7 = gp_IsVertex(__pyx_v_v); + __pyx_t_7 = gp_IsVertex(__pyx_v_self->_theGraph, __pyx_v_v); __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __pyx_t_2; @@ -4932,7 +4930,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_28gp_GetLastVertex(stru * def gp_GetLastVertex(self): * return cgraphLib.gp_GetLastVertex(self._theGraph) # <<<<<<<<<<<<<< * - * def gp_VertexInRange(self, int v): + * def gp_VertexInRangeAscending(self, int v): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyLong_From_int(gp_GetLastVertex(__pyx_v_self->_theGraph)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) @@ -4963,22 +4961,22 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_28gp_GetLastVertex(stru /* "planarity/full/graph.pyx":112 * return cgraphLib.gp_GetLastVertex(self._theGraph) * - * def gp_VertexInRange(self, int v): # <<<<<<<<<<<<<< + * def gp_VertexInRangeAscending(self, int v): # <<<<<<<<<<<<<< * return ( * v >= self.gp_GetFirstVertex() and */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_31gp_VertexInRange(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_31gp_VertexInRangeAscending(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_30gp_VertexInRange, "Graph.gp_VertexInRange(self, int v)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_31gp_VertexInRange = {"gp_VertexInRange", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_31gp_VertexInRange, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_30gp_VertexInRange}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_31gp_VertexInRange(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_30gp_VertexInRangeAscending, "Graph.gp_VertexInRangeAscending(self, int v)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_31gp_VertexInRangeAscending = {"gp_VertexInRangeAscending", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_31gp_VertexInRangeAscending, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_30gp_VertexInRangeAscending}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_31gp_VertexInRangeAscending(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -4996,7 +4994,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("gp_VertexInRange (wrapper)", 0); + __Pyx_RefNannySetupContext("gp_VertexInRangeAscending (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -5019,9 +5017,9 @@ PyObject *__pyx_args, PyObject *__pyx_kwds default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_VertexInRange", 0) < (0)) __PYX_ERR(0, 112, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_VertexInRangeAscending", 0) < (0)) __PYX_ERR(0, 112, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_VertexInRange", 1, 1, 1, i); __PYX_ERR(0, 112, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_VertexInRangeAscending", 1, 1, 1, i); __PYX_ERR(0, 112, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; @@ -5033,18 +5031,18 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("gp_VertexInRange", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 112, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("gp_VertexInRangeAscending", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 112, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } - __Pyx_AddTraceback("planarity.full.graph.Graph.gp_VertexInRange", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_VertexInRangeAscending", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_30gp_VertexInRange(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_30gp_VertexInRangeAscending(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { @@ -5054,7 +5052,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_30gp_VertexInRange(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_30gp_VertexInRangeAscending(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -5067,22 +5065,22 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_30gp_VertexInRange(stru int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("gp_VertexInRange", 0); + __Pyx_RefNannySetupContext("gp_VertexInRangeAscending", 0); /* "planarity/full/graph.pyx":113 * - * def gp_VertexInRange(self, int v): + * def gp_VertexInRangeAscending(self, int v): * return ( # <<<<<<<<<<<<<< * v >= self.gp_GetFirstVertex() and - * cgraphLib.gp_VertexInRange(self._theGraph, v) + * cgraphLib.gp_VertexInRangeAscending(self._theGraph, v) */ __Pyx_XDECREF(__pyx_r); /* "planarity/full/graph.pyx":114 - * def gp_VertexInRange(self, int v): + * def gp_VertexInRangeAscending(self, int v): * return ( * v >= self.gp_GetFirstVertex() and # <<<<<<<<<<<<<< - * cgraphLib.gp_VertexInRange(self._theGraph, v) + * cgraphLib.gp_VertexInRangeAscending(self._theGraph, v) * ) */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error) @@ -5113,11 +5111,11 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_30gp_VertexInRange(stru /* "planarity/full/graph.pyx":115 * return ( * v >= self.gp_GetFirstVertex() and - * cgraphLib.gp_VertexInRange(self._theGraph, v) # <<<<<<<<<<<<<< + * cgraphLib.gp_VertexInRangeAscending(self._theGraph, v) # <<<<<<<<<<<<<< * ) * */ - __pyx_t_7 = gp_VertexInRange(__pyx_v_self->_theGraph, __pyx_v_v); + __pyx_t_7 = gp_VertexInRangeAscending(__pyx_v_self->_theGraph, __pyx_v_v); __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = __pyx_t_4; @@ -5130,7 +5128,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_30gp_VertexInRange(stru /* "planarity/full/graph.pyx":112 * return cgraphLib.gp_GetLastVertex(self._theGraph) * - * def gp_VertexInRange(self, int v): # <<<<<<<<<<<<<< + * def gp_VertexInRangeAscending(self, int v): # <<<<<<<<<<<<<< * return ( * v >= self.gp_GetFirstVertex() and */ @@ -5141,7 +5139,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_30gp_VertexInRange(stru __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("planarity.full.graph.Graph.gp_VertexInRange", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_VertexInRangeAscending", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5152,22 +5150,22 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_30gp_VertexInRange(stru /* "planarity/full/graph.pyx":118 * ) * - * def gp_getN(self)-> int: # <<<<<<<<<<<<<< + * def gp_GetN(self)-> int: # <<<<<<<<<<<<<< * """ * Returns the number of vertices in the graph. */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_33gp_getN(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_33gp_GetN(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_32gp_getN, "Graph.gp_getN(self) -> int\n\nReturns the number of vertices in the graph."); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_33gp_getN = {"gp_getN", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_33gp_getN, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_32gp_getN}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_33gp_getN(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_32gp_GetN, "Graph.gp_GetN(self) -> int\n\nReturns the number of vertices in the graph."); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_33gp_GetN = {"gp_GetN", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_33gp_GetN, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_32gp_GetN}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_33gp_GetN(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -5180,7 +5178,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("gp_getN (wrapper)", 0); + __Pyx_RefNannySetupContext("gp_GetN (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -5189,18 +5187,18 @@ PyObject *__pyx_args, PyObject *__pyx_kwds #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_getN", 1, 0, 0, __pyx_nargs); return NULL; } + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_GetN", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; - if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_getN", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_32gp_getN(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_GetN", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_32gp_GetN(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_32gp_getN(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_32gp_GetN(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -5210,14 +5208,14 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_32gp_getN(struct __pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("gp_getN", 0); + __Pyx_RefNannySetupContext("gp_GetN", 0); /* "planarity/full/graph.pyx":122 * Returns the number of vertices in the graph. * """ * if self._theGraph == NULL: # <<<<<<<<<<<<<< * raise RuntimeError("Graph is not initialized.") - * return cgraphLib.gp_getN(self._theGraph) + * */ __pyx_t_1 = (__pyx_v_self->_theGraph == NULL); if (unlikely(__pyx_t_1)) { @@ -5226,8 +5224,8 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_32gp_getN(struct __pyx_ * """ * if self._theGraph == NULL: * raise RuntimeError("Graph is not initialized.") # <<<<<<<<<<<<<< - * return cgraphLib.gp_getN(self._theGraph) * + * return cgraphLib.gp_GetN(self._theGraph) */ __pyx_t_3 = NULL; __pyx_t_4 = 1; @@ -5247,21 +5245,21 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_32gp_getN(struct __pyx_ * """ * if self._theGraph == NULL: # <<<<<<<<<<<<<< * raise RuntimeError("Graph is not initialized.") - * return cgraphLib.gp_getN(self._theGraph) + * */ } - /* "planarity/full/graph.pyx":124 - * if self._theGraph == NULL: + /* "planarity/full/graph.pyx":125 * raise RuntimeError("Graph is not initialized.") - * return cgraphLib.gp_getN(self._theGraph) # <<<<<<<<<<<<<< + * + * return cgraphLib.gp_GetN(self._theGraph) # <<<<<<<<<<<<<< * * def gp_InitGraph(self, int n): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyLong_From_int(gp_getN(__pyx_v_self->_theGraph)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyLong_From_int(gp_GetN(__pyx_v_self->_theGraph)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 124, __pyx_L1_error) + if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 125, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; @@ -5269,7 +5267,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_32gp_getN(struct __pyx_ /* "planarity/full/graph.pyx":118 * ) * - * def gp_getN(self)-> int: # <<<<<<<<<<<<<< + * def gp_GetN(self)-> int: # <<<<<<<<<<<<<< * """ * Returns the number of vertices in the graph. */ @@ -5278,7 +5276,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_32gp_getN(struct __pyx_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("planarity.full.graph.Graph.gp_getN", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetN", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5286,8 +5284,8 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_32gp_getN(struct __pyx_ return __pyx_r; } -/* "planarity/full/graph.pyx":126 - * return cgraphLib.gp_getN(self._theGraph) +/* "planarity/full/graph.pyx":127 + * return cgraphLib.gp_GetN(self._theGraph) * * def gp_InitGraph(self, int n): # <<<<<<<<<<<<<< * if cgraphLib.gp_InitGraph(self._theGraph, n) != cappconst.OK: @@ -5334,32 +5332,32 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_n,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 126, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 127, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 126, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 127, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_InitGraph", 0) < (0)) __PYX_ERR(0, 126, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_InitGraph", 0) < (0)) __PYX_ERR(0, 127, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_InitGraph", 1, 1, 1, i); __PYX_ERR(0, 126, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_InitGraph", 1, 1, 1, i); __PYX_ERR(0, 127, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 126, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 127, __pyx_L3_error) } - __pyx_v_n = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L3_error) + __pyx_v_n = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 127, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("gp_InitGraph", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 126, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("gp_InitGraph", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 127, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -5392,7 +5390,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_34gp_InitGraph(struct _ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_InitGraph", 0); - /* "planarity/full/graph.pyx":127 + /* "planarity/full/graph.pyx":128 * * def gp_InitGraph(self, int n): * if cgraphLib.gp_InitGraph(self._theGraph, n) != cappconst.OK: # <<<<<<<<<<<<<< @@ -5402,7 +5400,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_34gp_InitGraph(struct _ __pyx_t_1 = (gp_InitGraph(__pyx_v_self->_theGraph, __pyx_v_n) != OK); if (unlikely(__pyx_t_1)) { - /* "planarity/full/graph.pyx":128 + /* "planarity/full/graph.pyx":129 * def gp_InitGraph(self, int n): * if cgraphLib.gp_InitGraph(self._theGraph, n) != cappconst.OK: * raise RuntimeError(f"gp_InitGraph() failed.") # <<<<<<<<<<<<<< @@ -5415,14 +5413,14 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_34gp_InitGraph(struct _ PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_gp_InitGraph_failed}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 129, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 128, __pyx_L1_error) + __PYX_ERR(0, 129, __pyx_L1_error) - /* "planarity/full/graph.pyx":127 + /* "planarity/full/graph.pyx":128 * * def gp_InitGraph(self, int n): * if cgraphLib.gp_InitGraph(self._theGraph, n) != cappconst.OK: # <<<<<<<<<<<<<< @@ -5431,8 +5429,8 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_34gp_InitGraph(struct _ */ } - /* "planarity/full/graph.pyx":126 - * return cgraphLib.gp_getN(self._theGraph) + /* "planarity/full/graph.pyx":127 + * return cgraphLib.gp_GetN(self._theGraph) * * def gp_InitGraph(self, int n): # <<<<<<<<<<<<<< * if cgraphLib.gp_InitGraph(self._theGraph, n) != cappconst.OK: @@ -5453,7 +5451,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_34gp_InitGraph(struct _ return __pyx_r; } -/* "planarity/full/graph.pyx":130 +/* "planarity/full/graph.pyx":131 * raise RuntimeError(f"gp_InitGraph() failed.") * * def gp_ReinitializeGraph(self): # <<<<<<<<<<<<<< @@ -5509,7 +5507,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_36gp_ReinitializeGraph( __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_ReinitializeGraph", 0); - /* "planarity/full/graph.pyx":131 + /* "planarity/full/graph.pyx":132 * * def gp_ReinitializeGraph(self): * cgraphLib.gp_ReinitializeGraph(self._theGraph) # <<<<<<<<<<<<<< @@ -5518,7 +5516,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_36gp_ReinitializeGraph( */ gp_ReinitializeGraph(__pyx_v_self->_theGraph); - /* "planarity/full/graph.pyx":130 + /* "planarity/full/graph.pyx":131 * raise RuntimeError(f"gp_InitGraph() failed.") * * def gp_ReinitializeGraph(self): # <<<<<<<<<<<<<< @@ -5533,7 +5531,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_36gp_ReinitializeGraph( return __pyx_r; } -/* "planarity/full/graph.pyx":133 +/* "planarity/full/graph.pyx":134 * cgraphLib.gp_ReinitializeGraph(self._theGraph) * * def gp_CopyGraph(self, Graph src_graph): # <<<<<<<<<<<<<< @@ -5581,32 +5579,32 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_src_graph,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 133, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 134, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 133, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 134, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_CopyGraph", 0) < (0)) __PYX_ERR(0, 133, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_CopyGraph", 0) < (0)) __PYX_ERR(0, 134, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_CopyGraph", 1, 1, 1, i); __PYX_ERR(0, 133, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_CopyGraph", 1, 1, 1, i); __PYX_ERR(0, 134, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 133, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 134, __pyx_L3_error) } __pyx_v_src_graph = ((struct __pyx_obj_9planarity_4full_5graph_Graph *)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("gp_CopyGraph", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 133, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("gp_CopyGraph", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 134, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -5617,7 +5615,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src_graph), __pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, 1, "src_graph", 0))) __PYX_ERR(0, 133, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src_graph), __pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, 1, "src_graph", 0))) __PYX_ERR(0, 134, __pyx_L1_error) __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_38gp_CopyGraph(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_src_graph); /* function exit code */ @@ -5651,10 +5649,10 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_38gp_CopyGraph(struct _ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_CopyGraph", 0); - /* "planarity/full/graph.pyx":136 + /* "planarity/full/graph.pyx":137 * # NOTE: this is interpreting the self as the dstGraph, i.e. copying * # the Graph wrapper that is passed in as the srcGraph - * if src_graph.is_graph_NULL() or src_graph.gp_getN() == 0: # <<<<<<<<<<<<<< + * if src_graph.is_graph_NULL() or src_graph.gp_GetN() == 0: # <<<<<<<<<<<<<< * raise ValueError( * "Source graph either has not been allocated or not been " */ @@ -5665,10 +5663,10 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_38gp_CopyGraph(struct _ PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_is_graph_NULL, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 136, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 136, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_5) { } else { @@ -5680,20 +5678,20 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_38gp_CopyGraph(struct _ __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; - __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_getN, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_GetN, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 136, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } - __pyx_t_5 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 136, __pyx_L1_error) + __pyx_t_5 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_5; __pyx_L4_bool_binop_done:; if (unlikely(__pyx_t_1)) { - /* "planarity/full/graph.pyx":137 + /* "planarity/full/graph.pyx":138 * # the Graph wrapper that is passed in as the srcGraph - * if src_graph.is_graph_NULL() or src_graph.gp_getN() == 0: + * if src_graph.is_graph_NULL() or src_graph.gp_GetN() == 0: * raise ValueError( # <<<<<<<<<<<<<< * "Source graph either has not been allocated or not been " * "initialized.") @@ -5704,26 +5702,26 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_38gp_CopyGraph(struct _ PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Source_graph_either_has_not_been}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 137, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 137, __pyx_L1_error) + __PYX_ERR(0, 138, __pyx_L1_error) - /* "planarity/full/graph.pyx":136 + /* "planarity/full/graph.pyx":137 * # NOTE: this is interpreting the self as the dstGraph, i.e. copying * # the Graph wrapper that is passed in as the srcGraph - * if src_graph.is_graph_NULL() or src_graph.gp_getN() == 0: # <<<<<<<<<<<<<< + * if src_graph.is_graph_NULL() or src_graph.gp_GetN() == 0: # <<<<<<<<<<<<<< * raise ValueError( * "Source graph either has not been allocated or not been " */ } - /* "planarity/full/graph.pyx":140 + /* "planarity/full/graph.pyx":141 * "Source graph either has not been allocated or not been " * "initialized.") - * if self.gp_getN() != src_graph.gp_getN(): # <<<<<<<<<<<<<< + * if self.gp_GetN() != src_graph.gp_GetN(): # <<<<<<<<<<<<<< * raise ValueError( * "Source and destination graphs must have the same order " */ @@ -5732,9 +5730,9 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_38gp_CopyGraph(struct _ __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; - __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_getN, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_GetN, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 141, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = ((PyObject *)__pyx_v_src_graph); @@ -5742,21 +5740,21 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_38gp_CopyGraph(struct _ __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL}; - __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_getN, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_GetN, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 140, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 141, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } - __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 140, __pyx_L1_error) + __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 141, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 140, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 141, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(__pyx_t_1)) { - /* "planarity/full/graph.pyx":141 + /* "planarity/full/graph.pyx":142 * "initialized.") - * if self.gp_getN() != src_graph.gp_getN(): + * if self.gp_GetN() != src_graph.gp_GetN(): * raise ValueError( # <<<<<<<<<<<<<< * "Source and destination graphs must have the same order " * "to copy graphP struct.") @@ -5767,23 +5765,23 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_38gp_CopyGraph(struct _ PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Source_and_destination_graphs_mu}; __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 141, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 142, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); } __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(0, 141, __pyx_L1_error) + __PYX_ERR(0, 142, __pyx_L1_error) - /* "planarity/full/graph.pyx":140 + /* "planarity/full/graph.pyx":141 * "Source graph either has not been allocated or not been " * "initialized.") - * if self.gp_getN() != src_graph.gp_getN(): # <<<<<<<<<<<<<< + * if self.gp_GetN() != src_graph.gp_GetN(): # <<<<<<<<<<<<<< * raise ValueError( * "Source and destination graphs must have the same order " */ } - /* "planarity/full/graph.pyx":144 + /* "planarity/full/graph.pyx":145 * "Source and destination graphs must have the same order " * "to copy graphP struct.") * if cgraphLib.gp_CopyGraph(self._theGraph, src_graph._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< @@ -5793,7 +5791,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_38gp_CopyGraph(struct _ __pyx_t_1 = (gp_CopyGraph(__pyx_v_self->_theGraph, __pyx_v_src_graph->_theGraph) != OK); if (unlikely(__pyx_t_1)) { - /* "planarity/full/graph.pyx":145 + /* "planarity/full/graph.pyx":146 * "to copy graphP struct.") * if cgraphLib.gp_CopyGraph(self._theGraph, src_graph._theGraph) != cappconst.OK: * raise RuntimeError(f"gp_CopyGraph() failed.") # <<<<<<<<<<<<<< @@ -5806,14 +5804,14 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_38gp_CopyGraph(struct _ PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_gp_CopyGraph_failed}; __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 145, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); } __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(0, 145, __pyx_L1_error) + __PYX_ERR(0, 146, __pyx_L1_error) - /* "planarity/full/graph.pyx":144 + /* "planarity/full/graph.pyx":145 * "Source and destination graphs must have the same order " * "to copy graphP struct.") * if cgraphLib.gp_CopyGraph(self._theGraph, src_graph._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< @@ -5822,7 +5820,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_38gp_CopyGraph(struct _ */ } - /* "planarity/full/graph.pyx":133 + /* "planarity/full/graph.pyx":134 * cgraphLib.gp_ReinitializeGraph(self._theGraph) * * def gp_CopyGraph(self, Graph src_graph): # <<<<<<<<<<<<<< @@ -5845,7 +5843,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_38gp_CopyGraph(struct _ return __pyx_r; } -/* "planarity/full/graph.pyx":147 +/* "planarity/full/graph.pyx":148 * raise RuntimeError(f"gp_CopyGraph() failed.") * * def gp_DupGraph(self) -> Graph: # <<<<<<<<<<<<<< @@ -5910,7 +5908,7 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_DupGraph", 0); - /* "planarity/full/graph.pyx":148 + /* "planarity/full/graph.pyx":149 * * def gp_DupGraph(self) -> Graph: * cdef cgraphLib.graphP theGraph_dup = cgraphLib.gp_DupGraph(self._theGraph) # <<<<<<<<<<<<<< @@ -5919,7 +5917,7 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full */ __pyx_v_theGraph_dup = gp_DupGraph(__pyx_v_self->_theGraph); - /* "planarity/full/graph.pyx":149 + /* "planarity/full/graph.pyx":150 * def gp_DupGraph(self) -> Graph: * cdef cgraphLib.graphP theGraph_dup = cgraphLib.gp_DupGraph(self._theGraph) * if theGraph_dup == NULL: # <<<<<<<<<<<<<< @@ -5929,7 +5927,7 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full __pyx_t_1 = (__pyx_v_theGraph_dup == NULL); if (unlikely(__pyx_t_1)) { - /* "planarity/full/graph.pyx":150 + /* "planarity/full/graph.pyx":151 * cdef cgraphLib.graphP theGraph_dup = cgraphLib.gp_DupGraph(self._theGraph) * if theGraph_dup == NULL: * raise MemoryError("gp_DupGraph() failed.") # <<<<<<<<<<<<<< @@ -5942,14 +5940,14 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_gp_DupGraph_failed}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 150, __pyx_L1_error) + __PYX_ERR(0, 151, __pyx_L1_error) - /* "planarity/full/graph.pyx":149 + /* "planarity/full/graph.pyx":150 * def gp_DupGraph(self) -> Graph: * cdef cgraphLib.graphP theGraph_dup = cgraphLib.gp_DupGraph(self._theGraph) * if theGraph_dup == NULL: # <<<<<<<<<<<<<< @@ -5958,7 +5956,7 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full */ } - /* "planarity/full/graph.pyx":152 + /* "planarity/full/graph.pyx":153 * raise MemoryError("gp_DupGraph() failed.") * * cdef Graph new_graph = Graph() # <<<<<<<<<<<<<< @@ -5971,13 +5969,13 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 152, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF((PyObject *)__pyx_t_2); } __pyx_v_new_graph = ((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/graph.pyx":153 + /* "planarity/full/graph.pyx":154 * * cdef Graph new_graph = Graph() * if new_graph is None: # <<<<<<<<<<<<<< @@ -5987,7 +5985,7 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full __pyx_t_1 = (((PyObject *)__pyx_v_new_graph) == Py_None); if (unlikely(__pyx_t_1)) { - /* "planarity/full/graph.pyx":154 + /* "planarity/full/graph.pyx":155 * cdef Graph new_graph = Graph() * if new_graph is None: * raise MemoryError("Unable to create new Graph container for duplicate.") # <<<<<<<<<<<<<< @@ -6000,14 +5998,14 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Unable_to_create_new_Graph_conta}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 154, __pyx_L1_error) + __PYX_ERR(0, 155, __pyx_L1_error) - /* "planarity/full/graph.pyx":153 + /* "planarity/full/graph.pyx":154 * * cdef Graph new_graph = Graph() * if new_graph is None: # <<<<<<<<<<<<<< @@ -6016,7 +6014,7 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full */ } - /* "planarity/full/graph.pyx":156 + /* "planarity/full/graph.pyx":157 * raise MemoryError("Unable to create new Graph container for duplicate.") * * if new_graph._theGraph != NULL: # <<<<<<<<<<<<<< @@ -6026,7 +6024,7 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full __pyx_t_1 = (__pyx_v_new_graph->_theGraph != NULL); if (__pyx_t_1) { - /* "planarity/full/graph.pyx":157 + /* "planarity/full/graph.pyx":158 * * if new_graph._theGraph != NULL: * cgraphLib.gp_Free(&new_graph._theGraph) # <<<<<<<<<<<<<< @@ -6035,7 +6033,7 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full */ gp_Free((&__pyx_v_new_graph->_theGraph)); - /* "planarity/full/graph.pyx":156 + /* "planarity/full/graph.pyx":157 * raise MemoryError("Unable to create new Graph container for duplicate.") * * if new_graph._theGraph != NULL: # <<<<<<<<<<<<<< @@ -6044,7 +6042,7 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full */ } - /* "planarity/full/graph.pyx":159 + /* "planarity/full/graph.pyx":160 * cgraphLib.gp_Free(&new_graph._theGraph) * * new_graph._theGraph = theGraph_dup # <<<<<<<<<<<<<< @@ -6053,7 +6051,7 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full */ __pyx_v_new_graph->_theGraph = __pyx_v_theGraph_dup; - /* "planarity/full/graph.pyx":160 + /* "planarity/full/graph.pyx":161 * * new_graph._theGraph = theGraph_dup * new_graph.owns_graphP = True # <<<<<<<<<<<<<< @@ -6062,7 +6060,7 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full */ __pyx_v_new_graph->owns_graphP = 1; - /* "planarity/full/graph.pyx":162 + /* "planarity/full/graph.pyx":163 * new_graph.owns_graphP = True * * return new_graph # <<<<<<<<<<<<<< @@ -6074,7 +6072,7 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full __pyx_r = __pyx_v_new_graph; goto __pyx_L0; - /* "planarity/full/graph.pyx":147 + /* "planarity/full/graph.pyx":148 * raise RuntimeError(f"gp_CopyGraph() failed.") * * def gp_DupGraph(self) -> Graph: # <<<<<<<<<<<<<< @@ -6095,7 +6093,7 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full return __pyx_r; } -/* "planarity/full/graph.pyx":164 +/* "planarity/full/graph.pyx":165 * return new_graph * * def gp_Read(self, str infile_name): # <<<<<<<<<<<<<< @@ -6143,32 +6141,32 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_infile_name,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 164, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 165, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 164, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 165, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_Read", 0) < (0)) __PYX_ERR(0, 164, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_Read", 0) < (0)) __PYX_ERR(0, 165, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_Read", 1, 1, 1, i); __PYX_ERR(0, 164, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_Read", 1, 1, 1, i); __PYX_ERR(0, 165, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 164, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 165, __pyx_L3_error) } __pyx_v_infile_name = ((PyObject*)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("gp_Read", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 164, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("gp_Read", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 165, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -6179,7 +6177,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_infile_name), (&PyUnicode_Type), 1, "infile_name", 1))) __PYX_ERR(0, 164, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_infile_name), (&PyUnicode_Type), 1, "infile_name", 1))) __PYX_ERR(0, 165, __pyx_L1_error) __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_42gp_Read(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_infile_name); /* function exit code */ @@ -6214,7 +6212,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_42gp_Read(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_Read", 0); - /* "planarity/full/graph.pyx":166 + /* "planarity/full/graph.pyx":167 * def gp_Read(self, str infile_name): * # Convert Python str to UTF-8 encoded bytes, and then to const char * * cdef bytes encoded = infile_name.encode('utf-8') # <<<<<<<<<<<<<< @@ -6223,24 +6221,24 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_42gp_Read(struct __pyx_ */ if (unlikely(__pyx_v_infile_name == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); - __PYX_ERR(0, 166, __pyx_L1_error) + __PYX_ERR(0, 167, __pyx_L1_error) } - __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_infile_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_infile_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_encoded = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "planarity/full/graph.pyx":167 + /* "planarity/full/graph.pyx":168 * # Convert Python str to UTF-8 encoded bytes, and then to const char * * cdef bytes encoded = infile_name.encode('utf-8') * cdef const char *FileName = encoded # <<<<<<<<<<<<<< * * if cgraphLib.gp_Read(self._theGraph, FileName) != cappconst.OK: */ - __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_encoded); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_encoded); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L1_error) __pyx_v_FileName = __pyx_t_2; - /* "planarity/full/graph.pyx":169 + /* "planarity/full/graph.pyx":170 * cdef const char *FileName = encoded * * if cgraphLib.gp_Read(self._theGraph, FileName) != cappconst.OK: # <<<<<<<<<<<<<< @@ -6250,7 +6248,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_42gp_Read(struct __pyx_ __pyx_t_3 = (gp_Read(__pyx_v_self->_theGraph, __pyx_v_FileName) != OK); if (unlikely(__pyx_t_3)) { - /* "planarity/full/graph.pyx":170 + /* "planarity/full/graph.pyx":171 * * if cgraphLib.gp_Read(self._theGraph, FileName) != cappconst.OK: * raise RuntimeError(f"gp_Read() failed.") # <<<<<<<<<<<<<< @@ -6263,14 +6261,14 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_42gp_Read(struct __pyx_ PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_gp_Read_failed}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 170, __pyx_L1_error) + __PYX_ERR(0, 171, __pyx_L1_error) - /* "planarity/full/graph.pyx":169 + /* "planarity/full/graph.pyx":170 * cdef const char *FileName = encoded * * if cgraphLib.gp_Read(self._theGraph, FileName) != cappconst.OK: # <<<<<<<<<<<<<< @@ -6279,7 +6277,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_42gp_Read(struct __pyx_ */ } - /* "planarity/full/graph.pyx":164 + /* "planarity/full/graph.pyx":165 * return new_graph * * def gp_Read(self, str infile_name): # <<<<<<<<<<<<<< @@ -6302,7 +6300,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_42gp_Read(struct __pyx_ return __pyx_r; } -/* "planarity/full/graph.pyx":172 +/* "planarity/full/graph.pyx":173 * raise RuntimeError(f"gp_Read() failed.") * * def gp_Write(self, str outfile_name, str mode): # <<<<<<<<<<<<<< @@ -6351,39 +6349,39 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_outfile_name,&__pyx_mstate_global->__pyx_n_u_mode,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 172, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 173, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 172, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 173, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 172, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 173, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_Write", 0) < (0)) __PYX_ERR(0, 172, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_Write", 0) < (0)) __PYX_ERR(0, 173, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_Write", 1, 2, 2, i); __PYX_ERR(0, 172, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_Write", 1, 2, 2, i); __PYX_ERR(0, 173, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 172, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 173, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 172, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 173, __pyx_L3_error) } __pyx_v_outfile_name = ((PyObject*)values[0]); __pyx_v_mode = ((PyObject*)values[1]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("gp_Write", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 172, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("gp_Write", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 173, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -6394,8 +6392,8 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_outfile_name), (&PyUnicode_Type), 1, "outfile_name", 1))) __PYX_ERR(0, 172, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mode), (&PyUnicode_Type), 1, "mode", 1))) __PYX_ERR(0, 172, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_outfile_name), (&PyUnicode_Type), 1, "outfile_name", 1))) __PYX_ERR(0, 173, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mode), (&PyUnicode_Type), 1, "mode", 1))) __PYX_ERR(0, 173, __pyx_L1_error) __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_44gp_Write(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_outfile_name, __pyx_v_mode); /* function exit code */ @@ -6437,52 +6435,52 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_44gp_Write(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_Write", 0); - /* "planarity/full/graph.pyx":173 + /* "planarity/full/graph.pyx":174 * * def gp_Write(self, str outfile_name, str mode): * mode_code = (cgraphLib.WRITE_ADJLIST if mode == "a" # <<<<<<<<<<<<<< * else (cgraphLib.WRITE_ADJMATRIX if mode == "m" * else (cgraphLib.WRITE_G6 if mode == "g" */ - __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_a, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_a, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 174, __pyx_L1_error) if (__pyx_t_2) { - __pyx_t_3 = __Pyx_PyLong_From_int(WRITE_ADJLIST); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyLong_From_int(WRITE_ADJLIST); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; } else { - /* "planarity/full/graph.pyx":174 + /* "planarity/full/graph.pyx":175 * def gp_Write(self, str outfile_name, str mode): * mode_code = (cgraphLib.WRITE_ADJLIST if mode == "a" * else (cgraphLib.WRITE_ADJMATRIX if mode == "m" # <<<<<<<<<<<<<< * else (cgraphLib.WRITE_G6 if mode == "g" * else None))) */ - __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_m, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_m, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 175, __pyx_L1_error) if (__pyx_t_4) { - __pyx_t_5 = __Pyx_PyLong_From_int(WRITE_ADJMATRIX); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyLong_From_int(WRITE_ADJMATRIX); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = __pyx_t_5; __pyx_t_5 = 0; } else { - /* "planarity/full/graph.pyx":175 + /* "planarity/full/graph.pyx":176 * mode_code = (cgraphLib.WRITE_ADJLIST if mode == "a" * else (cgraphLib.WRITE_ADJMATRIX if mode == "m" * else (cgraphLib.WRITE_G6 if mode == "g" # <<<<<<<<<<<<<< * else None))) * if not mode_code: */ - __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_g, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_g, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 176, __pyx_L1_error) if (__pyx_t_6) { - __pyx_t_7 = __Pyx_PyLong_From_int(WRITE_G6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyLong_From_int(WRITE_G6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 176, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_5 = __pyx_t_7; __pyx_t_7 = 0; } else { - /* "planarity/full/graph.pyx":176 + /* "planarity/full/graph.pyx":177 * else (cgraphLib.WRITE_ADJMATRIX if mode == "m" * else (cgraphLib.WRITE_G6 if mode == "g" * else None))) # <<<<<<<<<<<<<< @@ -6501,18 +6499,18 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_44gp_Write(struct __pyx __pyx_v_mode_code = __pyx_t_1; __pyx_t_1 = 0; - /* "planarity/full/graph.pyx":177 + /* "planarity/full/graph.pyx":178 * else (cgraphLib.WRITE_G6 if mode == "g" * else None))) * if not mode_code: # <<<<<<<<<<<<<< * raise ValueError( * f"Invalid graph format specifier \"{mode}\" is not one of " */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_mode_code); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_mode_code); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 178, __pyx_L1_error) __pyx_t_4 = (!__pyx_t_2); if (unlikely(__pyx_t_4)) { - /* "planarity/full/graph.pyx":178 + /* "planarity/full/graph.pyx":179 * else None))) * if not mode_code: * raise ValueError( # <<<<<<<<<<<<<< @@ -6521,20 +6519,20 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_44gp_Write(struct __pyx */ __pyx_t_3 = NULL; - /* "planarity/full/graph.pyx":179 + /* "planarity/full/graph.pyx":180 * if not mode_code: * raise ValueError( * f"Invalid graph format specifier \"{mode}\" is not one of " # <<<<<<<<<<<<<< * "'gam'." * ) */ - __pyx_t_5 = __Pyx_PyUnicode_Unicode(__pyx_v_mode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyUnicode_Unicode(__pyx_v_mode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_graph_format_specifier; __pyx_t_8[1] = __pyx_t_5; __pyx_t_8[2] = __pyx_mstate_global->__pyx_kp_u_is_not_one_of_gam; __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_8, 3, 32 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 22, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5)); - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 179, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_9 = 1; @@ -6543,14 +6541,14 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_44gp_Write(struct __pyx __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 178, __pyx_L1_error) + __PYX_ERR(0, 179, __pyx_L1_error) - /* "planarity/full/graph.pyx":177 + /* "planarity/full/graph.pyx":178 * else (cgraphLib.WRITE_G6 if mode == "g" * else None))) * if not mode_code: # <<<<<<<<<<<<<< @@ -6559,7 +6557,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_44gp_Write(struct __pyx */ } - /* "planarity/full/graph.pyx":184 + /* "planarity/full/graph.pyx":185 * * # Convert Python str to UTF-8 encoded bytes, and then to const char * * cdef bytes encoded = outfile_name.encode('utf-8') # <<<<<<<<<<<<<< @@ -6568,35 +6566,35 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_44gp_Write(struct __pyx */ if (unlikely(__pyx_v_outfile_name == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); - __PYX_ERR(0, 184, __pyx_L1_error) + __PYX_ERR(0, 185, __pyx_L1_error) } - __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_outfile_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error) + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_outfile_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 185, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_encoded = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "planarity/full/graph.pyx":185 + /* "planarity/full/graph.pyx":186 * # Convert Python str to UTF-8 encoded bytes, and then to const char * * cdef bytes encoded = outfile_name.encode('utf-8') * cdef const char *FileName = encoded # <<<<<<<<<<<<<< * * if cgraphLib.gp_Write(self._theGraph, FileName, mode_code) != cappconst.OK: */ - __pyx_t_10 = __Pyx_PyBytes_AsString(__pyx_v_encoded); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyBytes_AsString(__pyx_v_encoded); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L1_error) __pyx_v_FileName = __pyx_t_10; - /* "planarity/full/graph.pyx":187 + /* "planarity/full/graph.pyx":188 * cdef const char *FileName = encoded * * if cgraphLib.gp_Write(self._theGraph, FileName, mode_code) != cappconst.OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_Write() of graph to '{outfile_name}' failed." */ - __pyx_t_11 = __Pyx_PyLong_As_int(__pyx_v_mode_code); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 187, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyLong_As_int(__pyx_v_mode_code); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 188, __pyx_L1_error) __pyx_t_4 = (gp_Write(__pyx_v_self->_theGraph, __pyx_v_FileName, __pyx_t_11) != OK); if (unlikely(__pyx_t_4)) { - /* "planarity/full/graph.pyx":188 + /* "planarity/full/graph.pyx":189 * * if cgraphLib.gp_Write(self._theGraph, FileName, mode_code) != cappconst.OK: * raise RuntimeError( # <<<<<<<<<<<<<< @@ -6605,20 +6603,20 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_44gp_Write(struct __pyx */ __pyx_t_7 = NULL; - /* "planarity/full/graph.pyx":189 + /* "planarity/full/graph.pyx":190 * if cgraphLib.gp_Write(self._theGraph, FileName, mode_code) != cappconst.OK: * raise RuntimeError( * f"gp_Write() of graph to '{outfile_name}' failed." # <<<<<<<<<<<<<< * ) * */ - __pyx_t_3 = __Pyx_PyUnicode_Unicode(__pyx_v_outfile_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyUnicode_Unicode(__pyx_v_outfile_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u_gp_Write_of_graph_to; __pyx_t_8[1] = __pyx_t_3; __pyx_t_8[2] = __pyx_mstate_global->__pyx_kp_u_failed; __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_8, 3, 24 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 9, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3)); - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 189, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_9 = 1; @@ -6627,14 +6625,14 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_44gp_Write(struct __pyx __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 188, __pyx_L1_error) + __PYX_ERR(0, 189, __pyx_L1_error) - /* "planarity/full/graph.pyx":187 + /* "planarity/full/graph.pyx":188 * cdef const char *FileName = encoded * * if cgraphLib.gp_Write(self._theGraph, FileName, mode_code) != cappconst.OK: # <<<<<<<<<<<<<< @@ -6643,7 +6641,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_44gp_Write(struct __pyx */ } - /* "planarity/full/graph.pyx":172 + /* "planarity/full/graph.pyx":173 * raise RuntimeError(f"gp_Read() failed.") * * def gp_Write(self, str outfile_name, str mode): # <<<<<<<<<<<<<< @@ -6669,7 +6667,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_44gp_Write(struct __pyx return __pyx_r; } -/* "planarity/full/graph.pyx":192 +/* "planarity/full/graph.pyx":193 * ) * * def gp_GetNeighborEdgeRecord(self, int u, int v): # <<<<<<<<<<<<<< @@ -6718,39 +6716,39 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_u,&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 192, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 193, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 192, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 193, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 192, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 193, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetNeighborEdgeRecord", 0) < (0)) __PYX_ERR(0, 192, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetNeighborEdgeRecord", 0) < (0)) __PYX_ERR(0, 193, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetNeighborEdgeRecord", 1, 2, 2, i); __PYX_ERR(0, 192, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetNeighborEdgeRecord", 1, 2, 2, i); __PYX_ERR(0, 193, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 192, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 193, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 192, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 193, __pyx_L3_error) } - __pyx_v_u = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_u == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 192, __pyx_L3_error) - __pyx_v_v = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 192, __pyx_L3_error) + __pyx_v_u = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_u == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 193, __pyx_L3_error) + __pyx_v_v = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 193, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("gp_GetNeighborEdgeRecord", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 192, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("gp_GetNeighborEdgeRecord", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 193, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -6787,7 +6785,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetNeighborEdgeRec int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetNeighborEdgeRecord", 0); - /* "planarity/full/graph.pyx":193 + /* "planarity/full/graph.pyx":194 * * def gp_GetNeighborEdgeRecord(self, int u, int v): * if not self.gp_IsVertex(u): # <<<<<<<<<<<<<< @@ -6796,7 +6794,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetNeighborEdgeRec */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_u); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 193, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_u); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { @@ -6804,15 +6802,15 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetNeighborEdgeRec __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 193, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { - /* "planarity/full/graph.pyx":194 + /* "planarity/full/graph.pyx":195 * def gp_GetNeighborEdgeRecord(self, int u, int v): * if not self.gp_IsVertex(u): * raise RuntimeError(f"'{u}' is not a valid vertex label.") # <<<<<<<<<<<<<< @@ -6820,13 +6818,13 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetNeighborEdgeRec * raise RuntimeError(f"'{v}' is not a valid vertex label.") */ __pyx_t_3 = NULL; - __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_u, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_u, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u__2; __pyx_t_7[1] = __pyx_t_2; __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u_is_not_a_valid_vertex_label; __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 30, 127); - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 194, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 195, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; @@ -6835,14 +6833,14 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetNeighborEdgeRec __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 194, __pyx_L1_error) + __PYX_ERR(0, 195, __pyx_L1_error) - /* "planarity/full/graph.pyx":193 + /* "planarity/full/graph.pyx":194 * * def gp_GetNeighborEdgeRecord(self, int u, int v): * if not self.gp_IsVertex(u): # <<<<<<<<<<<<<< @@ -6851,7 +6849,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetNeighborEdgeRec */ } - /* "planarity/full/graph.pyx":195 + /* "planarity/full/graph.pyx":196 * if not self.gp_IsVertex(u): * raise RuntimeError(f"'{u}' is not a valid vertex label.") * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< @@ -6860,7 +6858,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetNeighborEdgeRec */ __pyx_t_8 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_8); - __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 195, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { @@ -6868,15 +6866,15 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetNeighborEdgeRec __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 195, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = (!__pyx_t_6); if (unlikely(__pyx_t_5)) { - /* "planarity/full/graph.pyx":196 + /* "planarity/full/graph.pyx":197 * raise RuntimeError(f"'{u}' is not a valid vertex label.") * if not self.gp_IsVertex(v): * raise RuntimeError(f"'{v}' is not a valid vertex label.") # <<<<<<<<<<<<<< @@ -6884,13 +6882,13 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetNeighborEdgeRec * return cgraphLib.gp_GetNeighborEdgeRecord(self._theGraph, u, v) */ __pyx_t_3 = NULL; - __pyx_t_8 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u__2; __pyx_t_7[1] = __pyx_t_8; __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u_is_not_a_valid_vertex_label; __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8) + 30, 127); - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_4 = 1; @@ -6899,14 +6897,14 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetNeighborEdgeRec __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 196, __pyx_L1_error) + __PYX_ERR(0, 197, __pyx_L1_error) - /* "planarity/full/graph.pyx":195 + /* "planarity/full/graph.pyx":196 * if not self.gp_IsVertex(u): * raise RuntimeError(f"'{u}' is not a valid vertex label.") * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< @@ -6915,7 +6913,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetNeighborEdgeRec */ } - /* "planarity/full/graph.pyx":198 + /* "planarity/full/graph.pyx":199 * raise RuntimeError(f"'{v}' is not a valid vertex label.") * * return cgraphLib.gp_GetNeighborEdgeRecord(self._theGraph, u, v) # <<<<<<<<<<<<<< @@ -6923,13 +6921,13 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetNeighborEdgeRec * def gp_GetVertexDegree(self, int v): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyLong_From_int(gp_GetNeighborEdgeRecord(__pyx_v_self->_theGraph, __pyx_v_u, __pyx_v_v)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_int(gp_GetNeighborEdgeRecord(__pyx_v_self->_theGraph, __pyx_v_u, __pyx_v_v)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/full/graph.pyx":192 + /* "planarity/full/graph.pyx":193 * ) * * def gp_GetNeighborEdgeRecord(self, int u, int v): # <<<<<<<<<<<<<< @@ -6951,7 +6949,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetNeighborEdgeRec return __pyx_r; } -/* "planarity/full/graph.pyx":200 +/* "planarity/full/graph.pyx":201 * return cgraphLib.gp_GetNeighborEdgeRecord(self._theGraph, u, v) * * def gp_GetVertexDegree(self, int v): # <<<<<<<<<<<<<< @@ -6999,32 +6997,32 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 200, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 201, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 200, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 201, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetVertexDegree", 0) < (0)) __PYX_ERR(0, 200, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetVertexDegree", 0) < (0)) __PYX_ERR(0, 201, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetVertexDegree", 1, 1, 1, i); __PYX_ERR(0, 200, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetVertexDegree", 1, 1, 1, i); __PYX_ERR(0, 201, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 200, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 201, __pyx_L3_error) } - __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 200, __pyx_L3_error) + __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 201, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("gp_GetVertexDegree", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 200, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("gp_GetVertexDegree", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 201, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -7061,7 +7059,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_48gp_GetVertexDegree(st int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetVertexDegree", 0); - /* "planarity/full/graph.pyx":201 + /* "planarity/full/graph.pyx":202 * * def gp_GetVertexDegree(self, int v): * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< @@ -7070,7 +7068,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_48gp_GetVertexDegree(st */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { @@ -7078,15 +7076,15 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_48gp_GetVertexDegree(st __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 201, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { - /* "planarity/full/graph.pyx":202 + /* "planarity/full/graph.pyx":203 * def gp_GetVertexDegree(self, int v): * if not self.gp_IsVertex(v): * raise RuntimeError(f"'{v}' is not a valid vertex label.") # <<<<<<<<<<<<<< @@ -7094,13 +7092,13 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_48gp_GetVertexDegree(st * return cgraphLib.gp_GetVertexDegree(self._theGraph, v) */ __pyx_t_3 = NULL; - __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u__2; __pyx_t_7[1] = __pyx_t_2; __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u_is_not_a_valid_vertex_label; __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 30, 127); - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 202, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; @@ -7109,14 +7107,14 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_48gp_GetVertexDegree(st __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 202, __pyx_L1_error) + __PYX_ERR(0, 203, __pyx_L1_error) - /* "planarity/full/graph.pyx":201 + /* "planarity/full/graph.pyx":202 * * def gp_GetVertexDegree(self, int v): * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< @@ -7125,7 +7123,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_48gp_GetVertexDegree(st */ } - /* "planarity/full/graph.pyx":204 + /* "planarity/full/graph.pyx":205 * raise RuntimeError(f"'{v}' is not a valid vertex label.") * * return cgraphLib.gp_GetVertexDegree(self._theGraph, v) # <<<<<<<<<<<<<< @@ -7133,13 +7131,13 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_48gp_GetVertexDegree(st * def gp_GetArcCapacity(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyLong_From_int(gp_GetVertexDegree(__pyx_v_self->_theGraph, __pyx_v_v)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_int(gp_GetVertexDegree(__pyx_v_self->_theGraph, __pyx_v_v)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/full/graph.pyx":200 + /* "planarity/full/graph.pyx":201 * return cgraphLib.gp_GetNeighborEdgeRecord(self._theGraph, u, v) * * def gp_GetVertexDegree(self, int v): # <<<<<<<<<<<<<< @@ -7161,7 +7159,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_48gp_GetVertexDegree(st return __pyx_r; } -/* "planarity/full/graph.pyx":206 +/* "planarity/full/graph.pyx":207 * return cgraphLib.gp_GetVertexDegree(self._theGraph, v) * * def gp_GetArcCapacity(self): # <<<<<<<<<<<<<< @@ -7221,7 +7219,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_50gp_GetArcCapacity(str int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetArcCapacity", 0); - /* "planarity/full/graph.pyx":207 + /* "planarity/full/graph.pyx":208 * * def gp_GetArcCapacity(self): * return cgraphLib.gp_GetArcCapacity(self._theGraph) # <<<<<<<<<<<<<< @@ -7229,13 +7227,13 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_50gp_GetArcCapacity(str * def gp_EnsureArcCapacity(self, int new_arc_capacity): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyLong_From_int(gp_GetArcCapacity(__pyx_v_self->_theGraph)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_int(gp_GetArcCapacity(__pyx_v_self->_theGraph)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/full/graph.pyx":206 + /* "planarity/full/graph.pyx":207 * return cgraphLib.gp_GetVertexDegree(self._theGraph, v) * * def gp_GetArcCapacity(self): # <<<<<<<<<<<<<< @@ -7254,7 +7252,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_50gp_GetArcCapacity(str return __pyx_r; } -/* "planarity/full/graph.pyx":209 +/* "planarity/full/graph.pyx":210 * return cgraphLib.gp_GetArcCapacity(self._theGraph) * * def gp_EnsureArcCapacity(self, int new_arc_capacity): # <<<<<<<<<<<<<< @@ -7302,32 +7300,32 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_new_arc_capacity,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 209, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 210, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 209, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 210, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_EnsureArcCapacity", 0) < (0)) __PYX_ERR(0, 209, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_EnsureArcCapacity", 0) < (0)) __PYX_ERR(0, 210, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_EnsureArcCapacity", 1, 1, 1, i); __PYX_ERR(0, 209, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_EnsureArcCapacity", 1, 1, 1, i); __PYX_ERR(0, 210, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 209, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 210, __pyx_L3_error) } - __pyx_v_new_arc_capacity = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_new_arc_capacity == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L3_error) + __pyx_v_new_arc_capacity = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_new_arc_capacity == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 210, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("gp_EnsureArcCapacity", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 209, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("gp_EnsureArcCapacity", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 210, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -7363,7 +7361,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_52gp_EnsureArcCapacity( int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_EnsureArcCapacity", 0); - /* "planarity/full/graph.pyx":210 + /* "planarity/full/graph.pyx":211 * * def gp_EnsureArcCapacity(self, int new_arc_capacity): * if cgraphLib.gp_EnsureArcCapacity(self._theGraph, new_arc_capacity) != cappconst.OK: # <<<<<<<<<<<<<< @@ -7373,7 +7371,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_52gp_EnsureArcCapacity( __pyx_t_1 = (gp_EnsureArcCapacity(__pyx_v_self->_theGraph, __pyx_v_new_arc_capacity) != OK); if (unlikely(__pyx_t_1)) { - /* "planarity/full/graph.pyx":211 + /* "planarity/full/graph.pyx":212 * def gp_EnsureArcCapacity(self, int new_arc_capacity): * if cgraphLib.gp_EnsureArcCapacity(self._theGraph, new_arc_capacity) != cappconst.OK: * raise RuntimeError( # <<<<<<<<<<<<<< @@ -7382,20 +7380,20 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_52gp_EnsureArcCapacity( */ __pyx_t_3 = NULL; - /* "planarity/full/graph.pyx":213 + /* "planarity/full/graph.pyx":214 * raise RuntimeError( * "gp_EnsureArcCapacity() failed to set capacity to " * f"{new_arc_capacity}.") # <<<<<<<<<<<<<< * * def gp_AddEdge(self, int u, int ulink, int v, int vlink): */ - __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_new_arc_capacity, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 213, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_new_arc_capacity, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5[0] = __pyx_mstate_global->__pyx_kp_u_gp_EnsureArcCapacity_failed_to_s; __pyx_t_5[1] = __pyx_t_4; __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u__3; - /* "planarity/full/graph.pyx":212 + /* "planarity/full/graph.pyx":213 * if cgraphLib.gp_EnsureArcCapacity(self._theGraph, new_arc_capacity) != cappconst.OK: * raise RuntimeError( * "gp_EnsureArcCapacity() failed to set capacity to " # <<<<<<<<<<<<<< @@ -7403,7 +7401,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_52gp_EnsureArcCapacity( * */ __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, 49 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 1, 127); - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 212, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_7 = 1; @@ -7412,14 +7410,14 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_52gp_EnsureArcCapacity( __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 211, __pyx_L1_error) + __PYX_ERR(0, 212, __pyx_L1_error) - /* "planarity/full/graph.pyx":210 + /* "planarity/full/graph.pyx":211 * * def gp_EnsureArcCapacity(self, int new_arc_capacity): * if cgraphLib.gp_EnsureArcCapacity(self._theGraph, new_arc_capacity) != cappconst.OK: # <<<<<<<<<<<<<< @@ -7428,7 +7426,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_52gp_EnsureArcCapacity( */ } - /* "planarity/full/graph.pyx":209 + /* "planarity/full/graph.pyx":210 * return cgraphLib.gp_GetArcCapacity(self._theGraph) * * def gp_EnsureArcCapacity(self, int new_arc_capacity): # <<<<<<<<<<<<<< @@ -7452,7 +7450,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_52gp_EnsureArcCapacity( return __pyx_r; } -/* "planarity/full/graph.pyx":215 +/* "planarity/full/graph.pyx":216 * f"{new_arc_capacity}.") * * def gp_AddEdge(self, int u, int ulink, int v, int vlink): # <<<<<<<<<<<<<< @@ -7503,53 +7501,53 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_u,&__pyx_mstate_global->__pyx_n_u_ulink,&__pyx_mstate_global->__pyx_n_u_v,&__pyx_mstate_global->__pyx_n_u_vlink,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 215, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 216, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 4: values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 215, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 216, __pyx_L3_error) CYTHON_FALLTHROUGH; case 3: values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 215, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 216, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 215, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 216, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 215, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 216, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_AddEdge", 0) < (0)) __PYX_ERR(0, 215, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_AddEdge", 0) < (0)) __PYX_ERR(0, 216, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 4; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_AddEdge", 1, 4, 4, i); __PYX_ERR(0, 215, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_AddEdge", 1, 4, 4, i); __PYX_ERR(0, 216, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 4)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 215, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 216, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 215, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 216, __pyx_L3_error) values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 215, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 216, __pyx_L3_error) values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 215, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 216, __pyx_L3_error) } - __pyx_v_u = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_u == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error) - __pyx_v_ulink = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_ulink == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error) - __pyx_v_v = __Pyx_PyLong_As_int(values[2]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error) - __pyx_v_vlink = __Pyx_PyLong_As_int(values[3]); if (unlikely((__pyx_v_vlink == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error) + __pyx_v_u = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_u == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error) + __pyx_v_ulink = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_ulink == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error) + __pyx_v_v = __Pyx_PyLong_As_int(values[2]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error) + __pyx_v_vlink = __Pyx_PyLong_As_int(values[3]); if (unlikely((__pyx_v_vlink == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("gp_AddEdge", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 215, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("gp_AddEdge", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 216, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -7589,7 +7587,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_AddEdge(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_AddEdge", 0); - /* "planarity/full/graph.pyx":216 + /* "planarity/full/graph.pyx":217 * * def gp_AddEdge(self, int u, int ulink, int v, int vlink): * if ulink != 0 and ulink != 1: # <<<<<<<<<<<<<< @@ -7607,7 +7605,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_AddEdge(struct __p } if (unlikely(__pyx_t_1)) { - /* "planarity/full/graph.pyx":217 + /* "planarity/full/graph.pyx":218 * def gp_AddEdge(self, int u, int ulink, int v, int vlink): * if ulink != 0 and ulink != 1: * raise RuntimeError( # <<<<<<<<<<<<<< @@ -7616,20 +7614,20 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_AddEdge(struct __p */ __pyx_t_3 = NULL; - /* "planarity/full/graph.pyx":218 + /* "planarity/full/graph.pyx":219 * if ulink != 0 and ulink != 1: * raise RuntimeError( * f"Invalid link index for ulink: '{ulink}'." # <<<<<<<<<<<<<< * ) * if vlink != 0 and vlink != 1: */ - __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_ulink, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 218, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_ulink, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_link_index_for_ulink; __pyx_t_5[1] = __pyx_t_4; __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u_; __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, 31 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 2, 127); - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 218, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_7 = 1; @@ -7638,14 +7636,14 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_AddEdge(struct __p __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 217, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 217, __pyx_L1_error) + __PYX_ERR(0, 218, __pyx_L1_error) - /* "planarity/full/graph.pyx":216 + /* "planarity/full/graph.pyx":217 * * def gp_AddEdge(self, int u, int ulink, int v, int vlink): * if ulink != 0 and ulink != 1: # <<<<<<<<<<<<<< @@ -7654,7 +7652,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_AddEdge(struct __p */ } - /* "planarity/full/graph.pyx":220 + /* "planarity/full/graph.pyx":221 * f"Invalid link index for ulink: '{ulink}'." * ) * if vlink != 0 and vlink != 1: # <<<<<<<<<<<<<< @@ -7672,7 +7670,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_AddEdge(struct __p } if (unlikely(__pyx_t_1)) { - /* "planarity/full/graph.pyx":221 + /* "planarity/full/graph.pyx":222 * ) * if vlink != 0 and vlink != 1: * raise RuntimeError( # <<<<<<<<<<<<<< @@ -7681,20 +7679,20 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_AddEdge(struct __p */ __pyx_t_6 = NULL; - /* "planarity/full/graph.pyx":222 + /* "planarity/full/graph.pyx":223 * if vlink != 0 and vlink != 1: * raise RuntimeError( * f"Invalid link index for vlink: '{vlink}'." # <<<<<<<<<<<<<< * ) * if cgraphLib.gp_AddEdge(self._theGraph, u, ulink, v, vlink) != cappconst.OK: */ - __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_vlink, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_vlink, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_link_index_for_vlink; __pyx_t_5[1] = __pyx_t_3; __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u_; __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, 31 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 2, 127); - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 222, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = 1; @@ -7703,14 +7701,14 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_AddEdge(struct __p __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 221, __pyx_L1_error) + __PYX_ERR(0, 222, __pyx_L1_error) - /* "planarity/full/graph.pyx":220 + /* "planarity/full/graph.pyx":221 * f"Invalid link index for ulink: '{ulink}'." * ) * if vlink != 0 and vlink != 1: # <<<<<<<<<<<<<< @@ -7719,7 +7717,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_AddEdge(struct __p */ } - /* "planarity/full/graph.pyx":224 + /* "planarity/full/graph.pyx":225 * f"Invalid link index for vlink: '{vlink}'." * ) * if cgraphLib.gp_AddEdge(self._theGraph, u, ulink, v, vlink) != cappconst.OK: # <<<<<<<<<<<<<< @@ -7729,7 +7727,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_AddEdge(struct __p __pyx_t_1 = (gp_AddEdge(__pyx_v_self->_theGraph, __pyx_v_u, __pyx_v_ulink, __pyx_v_v, __pyx_v_vlink) != OK); if (unlikely(__pyx_t_1)) { - /* "planarity/full/graph.pyx":225 + /* "planarity/full/graph.pyx":226 * ) * if cgraphLib.gp_AddEdge(self._theGraph, u, ulink, v, vlink) != cappconst.OK: * raise RuntimeError( # <<<<<<<<<<<<<< @@ -7738,28 +7736,28 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_AddEdge(struct __p */ __pyx_t_4 = NULL; - /* "planarity/full/graph.pyx":226 + /* "planarity/full/graph.pyx":227 * if cgraphLib.gp_AddEdge(self._theGraph, u, ulink, v, vlink) != cappconst.OK: * raise RuntimeError( * f"Unable to add edge (u, v) = ({u}, {v}) with ulink = {ulink} " # <<<<<<<<<<<<<< * f"and vlink = {vlink}." * ) */ - __pyx_t_6 = __Pyx_PyUnicode_From_int(__pyx_v_u, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 226, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyUnicode_From_int(__pyx_v_u, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 226, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = __Pyx_PyUnicode_From_int(__pyx_v_ulink, 0, ' ', 'd'); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 226, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyUnicode_From_int(__pyx_v_ulink, 0, ' ', 'd'); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - /* "planarity/full/graph.pyx":227 + /* "planarity/full/graph.pyx":228 * raise RuntimeError( * f"Unable to add edge (u, v) = ({u}, {v}) with ulink = {ulink} " * f"and vlink = {vlink}." # <<<<<<<<<<<<<< * ) * */ - __pyx_t_9 = __Pyx_PyUnicode_From_int(__pyx_v_vlink, 0, ' ', 'd'); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyUnicode_From_int(__pyx_v_vlink, 0, ' ', 'd'); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_10[0] = __pyx_mstate_global->__pyx_kp_u_Unable_to_add_edge_u_v; __pyx_t_10[1] = __pyx_t_6; @@ -7771,7 +7769,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_AddEdge(struct __p __pyx_t_10[7] = __pyx_t_9; __pyx_t_10[8] = __pyx_mstate_global->__pyx_kp_u__3; - /* "planarity/full/graph.pyx":226 + /* "planarity/full/graph.pyx":227 * if cgraphLib.gp_AddEdge(self._theGraph, u, ulink, v, vlink) != cappconst.OK: * raise RuntimeError( * f"Unable to add edge (u, v) = ({u}, {v}) with ulink = {ulink} " # <<<<<<<<<<<<<< @@ -7779,7 +7777,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_AddEdge(struct __p * ) */ __pyx_t_11 = __Pyx_PyUnicode_Join(__pyx_t_10, 9, 29 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8) + 13 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9) + 1, 127); - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 226, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -7791,14 +7789,14 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_AddEdge(struct __p __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 225, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 225, __pyx_L1_error) + __PYX_ERR(0, 226, __pyx_L1_error) - /* "planarity/full/graph.pyx":224 + /* "planarity/full/graph.pyx":225 * f"Invalid link index for vlink: '{vlink}'." * ) * if cgraphLib.gp_AddEdge(self._theGraph, u, ulink, v, vlink) != cappconst.OK: # <<<<<<<<<<<<<< @@ -7807,7 +7805,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_AddEdge(struct __p */ } - /* "planarity/full/graph.pyx":215 + /* "planarity/full/graph.pyx":216 * f"{new_arc_capacity}.") * * def gp_AddEdge(self, int u, int ulink, int v, int vlink): # <<<<<<<<<<<<<< @@ -7834,10 +7832,10 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_AddEdge(struct __p return __pyx_r; } -/* "planarity/full/graph.pyx":230 +/* "planarity/full/graph.pyx":231 * ) * - * def gp_DeleteEdge(self, int e, int nextLink): # <<<<<<<<<<<<<< + * def gp_DeleteEdge(self, int e): # <<<<<<<<<<<<<< * if not self.gp_IsArc(e): * raise RuntimeError( */ @@ -7850,7 +7848,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_56gp_DeleteEdge, "Graph.gp_DeleteEdge(self, int e, int nextLink)"); +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_56gp_DeleteEdge, "Graph.gp_DeleteEdge(self, int e)"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_57gp_DeleteEdge = {"gp_DeleteEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_57gp_DeleteEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_56gp_DeleteEdge}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_57gp_DeleteEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL @@ -7860,12 +7858,11 @@ PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; - int __pyx_v_nextLink; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[2] = {0,0}; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -7881,41 +7878,34 @@ PyObject *__pyx_args, PyObject *__pyx_kwds #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,&__pyx_mstate_global->__pyx_n_u_nextLink,0}; + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 230, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 231, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { - case 2: - values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 230, __pyx_L3_error) - CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 230, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 231, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_DeleteEdge", 0) < (0)) __PYX_ERR(0, 230, __pyx_L3_error) - for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_DeleteEdge", 1, 2, 2, i); __PYX_ERR(0, 230, __pyx_L3_error) } + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_DeleteEdge", 0) < (0)) __PYX_ERR(0, 231, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_DeleteEdge", 1, 1, 1, i); __PYX_ERR(0, 231, __pyx_L3_error) } } - } else if (unlikely(__pyx_nargs != 2)) { + } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 230, __pyx_L3_error) - values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 230, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 231, __pyx_L3_error) } - __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 230, __pyx_L3_error) - __pyx_v_nextLink = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_nextLink == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 230, __pyx_L3_error) + __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 231, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("gp_DeleteEdge", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 230, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("gp_DeleteEdge", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 231, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -7926,7 +7916,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_56gp_DeleteEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e, __pyx_v_nextLink); + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_56gp_DeleteEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { @@ -7936,7 +7926,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_56gp_DeleteEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e, int __pyx_v_nextLink) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_56gp_DeleteEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -7952,16 +7942,16 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_56gp_DeleteEdge(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_DeleteEdge", 0); - /* "planarity/full/graph.pyx":231 + /* "planarity/full/graph.pyx":232 * - * def gp_DeleteEdge(self, int e, int nextLink): + * def gp_DeleteEdge(self, int e): * if not self.gp_IsArc(e): # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_DeleteEdge() failed: invalid arc '{e}'." */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 231, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { @@ -7969,16 +7959,16 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_56gp_DeleteEdge(struct __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsArc, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 231, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { - /* "planarity/full/graph.pyx":232 - * def gp_DeleteEdge(self, int e, int nextLink): + /* "planarity/full/graph.pyx":233 + * def gp_DeleteEdge(self, int e): * if not self.gp_IsArc(e): * raise RuntimeError( # <<<<<<<<<<<<<< * f"gp_DeleteEdge() failed: invalid arc '{e}'." @@ -7986,20 +7976,20 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_56gp_DeleteEdge(struct */ __pyx_t_3 = NULL; - /* "planarity/full/graph.pyx":233 + /* "planarity/full/graph.pyx":234 * if not self.gp_IsArc(e): * raise RuntimeError( * f"gp_DeleteEdge() failed: invalid arc '{e}'." # <<<<<<<<<<<<<< * ) - * if nextLink != 0 and nextLink != 1: + * */ - __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_gp_DeleteEdge_failed_invalid_arc; __pyx_t_7[1] = __pyx_t_2; __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u_; __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 2, 127); - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 233, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; @@ -8008,105 +7998,40 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_56gp_DeleteEdge(struct __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 232, __pyx_L1_error) + __PYX_ERR(0, 233, __pyx_L1_error) - /* "planarity/full/graph.pyx":231 + /* "planarity/full/graph.pyx":232 * - * def gp_DeleteEdge(self, int e, int nextLink): + * def gp_DeleteEdge(self, int e): * if not self.gp_IsArc(e): # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_DeleteEdge() failed: invalid arc '{e}'." */ } - /* "planarity/full/graph.pyx":235 - * f"gp_DeleteEdge() failed: invalid arc '{e}'." - * ) - * if nextLink != 0 and nextLink != 1: # <<<<<<<<<<<<<< - * raise RuntimeError( - * f"Invalid link index for nextLink: '{nextLink}'." -*/ - switch (__pyx_v_nextLink) { - case 0: - case 1: - __pyx_t_6 = 0; - break; - default: - __pyx_t_6 = 1; - break; - } - if (unlikely(__pyx_t_6)) { - - /* "planarity/full/graph.pyx":236 - * ) - * if nextLink != 0 and nextLink != 1: - * raise RuntimeError( # <<<<<<<<<<<<<< - * f"Invalid link index for nextLink: '{nextLink}'." - * ) -*/ - __pyx_t_8 = NULL; - - /* "planarity/full/graph.pyx":237 - * if nextLink != 0 and nextLink != 1: - * raise RuntimeError( - * f"Invalid link index for nextLink: '{nextLink}'." # <<<<<<<<<<<<<< - * ) - * -*/ - __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_nextLink, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_link_index_for_nextLink; - __pyx_t_7[1] = __pyx_t_3; - __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u_; - __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 34 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 2, 127); - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = 1; - { - PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_2}; - __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 236, __pyx_L1_error) - - /* "planarity/full/graph.pyx":235 - * f"gp_DeleteEdge() failed: invalid arc '{e}'." - * ) - * if nextLink != 0 and nextLink != 1: # <<<<<<<<<<<<<< - * raise RuntimeError( - * f"Invalid link index for nextLink: '{nextLink}'." -*/ - } - - /* "planarity/full/graph.pyx":240 + /* "planarity/full/graph.pyx":237 * ) * - * return cgraphLib.gp_DeleteEdge(self._theGraph, e, nextLink) # <<<<<<<<<<<<<< + * return cgraphLib.gp_DeleteEdge(self._theGraph, e) # <<<<<<<<<<<<<< * * def gp_AttachDrawPlanar(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyLong_From_int(gp_DeleteEdge(__pyx_v_self->_theGraph, __pyx_v_e, __pyx_v_nextLink)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_int(gp_DeleteEdge(__pyx_v_self->_theGraph, __pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/full/graph.pyx":230 + /* "planarity/full/graph.pyx":231 * ) * - * def gp_DeleteEdge(self, int e, int nextLink): # <<<<<<<<<<<<<< + * def gp_DeleteEdge(self, int e): # <<<<<<<<<<<<<< * if not self.gp_IsArc(e): * raise RuntimeError( */ @@ -8125,8 +8050,8 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_56gp_DeleteEdge(struct return __pyx_r; } -/* "planarity/full/graph.pyx":242 - * return cgraphLib.gp_DeleteEdge(self._theGraph, e, nextLink) +/* "planarity/full/graph.pyx":239 + * return cgraphLib.gp_DeleteEdge(self._theGraph, e) * * def gp_AttachDrawPlanar(self): # <<<<<<<<<<<<<< * if cgraphLib.gp_AttachDrawPlanar(self._theGraph) != cappconst.OK: @@ -8188,7 +8113,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_58gp_AttachDrawPlanar(s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_AttachDrawPlanar", 0); - /* "planarity/full/graph.pyx":243 + /* "planarity/full/graph.pyx":240 * * def gp_AttachDrawPlanar(self): * if cgraphLib.gp_AttachDrawPlanar(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< @@ -8198,7 +8123,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_58gp_AttachDrawPlanar(s __pyx_t_1 = (gp_AttachDrawPlanar(__pyx_v_self->_theGraph) != OK); if (unlikely(__pyx_t_1)) { - /* "planarity/full/graph.pyx":244 + /* "planarity/full/graph.pyx":241 * def gp_AttachDrawPlanar(self): * if cgraphLib.gp_AttachDrawPlanar(self._theGraph) != cappconst.OK: * raise RuntimeError("Failed to attach DrawPlanar algorithm.") # <<<<<<<<<<<<<< @@ -8211,14 +8136,14 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_58gp_AttachDrawPlanar(s PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Failed_to_attach_DrawPlanar_algo}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 244, __pyx_L1_error) + __PYX_ERR(0, 241, __pyx_L1_error) - /* "planarity/full/graph.pyx":243 + /* "planarity/full/graph.pyx":240 * * def gp_AttachDrawPlanar(self): * if cgraphLib.gp_AttachDrawPlanar(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< @@ -8227,8 +8152,8 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_58gp_AttachDrawPlanar(s */ } - /* "planarity/full/graph.pyx":242 - * return cgraphLib.gp_DeleteEdge(self._theGraph, e, nextLink) + /* "planarity/full/graph.pyx":239 + * return cgraphLib.gp_DeleteEdge(self._theGraph, e) * * def gp_AttachDrawPlanar(self): # <<<<<<<<<<<<<< * if cgraphLib.gp_AttachDrawPlanar(self._theGraph) != cappconst.OK: @@ -8249,7 +8174,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_58gp_AttachDrawPlanar(s return __pyx_r; } -/* "planarity/full/graph.pyx":246 +/* "planarity/full/graph.pyx":243 * raise RuntimeError("Failed to attach DrawPlanar algorithm.") * * def gp_AttachK23Search(self): # <<<<<<<<<<<<<< @@ -8312,7 +8237,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_60gp_AttachK23Search(st int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_AttachK23Search", 0); - /* "planarity/full/graph.pyx":247 + /* "planarity/full/graph.pyx":244 * * def gp_AttachK23Search(self): * if cgraphLib.gp_AttachK23Search(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< @@ -8322,7 +8247,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_60gp_AttachK23Search(st __pyx_t_1 = (gp_AttachK23Search(__pyx_v_self->_theGraph) != OK); if (unlikely(__pyx_t_1)) { - /* "planarity/full/graph.pyx":248 + /* "planarity/full/graph.pyx":245 * def gp_AttachK23Search(self): * if cgraphLib.gp_AttachK23Search(self._theGraph) != cappconst.OK: * raise RuntimeError("Failed to attach K23Search algorithm.") # <<<<<<<<<<<<<< @@ -8335,14 +8260,14 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_60gp_AttachK23Search(st PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Failed_to_attach_K23Search_algor}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 248, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 248, __pyx_L1_error) + __PYX_ERR(0, 245, __pyx_L1_error) - /* "planarity/full/graph.pyx":247 + /* "planarity/full/graph.pyx":244 * * def gp_AttachK23Search(self): * if cgraphLib.gp_AttachK23Search(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< @@ -8351,7 +8276,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_60gp_AttachK23Search(st */ } - /* "planarity/full/graph.pyx":246 + /* "planarity/full/graph.pyx":243 * raise RuntimeError("Failed to attach DrawPlanar algorithm.") * * def gp_AttachK23Search(self): # <<<<<<<<<<<<<< @@ -8373,7 +8298,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_60gp_AttachK23Search(st return __pyx_r; } -/* "planarity/full/graph.pyx":250 +/* "planarity/full/graph.pyx":247 * raise RuntimeError("Failed to attach K23Search algorithm.") * * def gp_AttachK33Search(self): # <<<<<<<<<<<<<< @@ -8436,7 +8361,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_62gp_AttachK33Search(st int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_AttachK33Search", 0); - /* "planarity/full/graph.pyx":251 + /* "planarity/full/graph.pyx":248 * * def gp_AttachK33Search(self): * if cgraphLib.gp_AttachK33Search(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< @@ -8446,7 +8371,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_62gp_AttachK33Search(st __pyx_t_1 = (gp_AttachK33Search(__pyx_v_self->_theGraph) != OK); if (unlikely(__pyx_t_1)) { - /* "planarity/full/graph.pyx":252 + /* "planarity/full/graph.pyx":249 * def gp_AttachK33Search(self): * if cgraphLib.gp_AttachK33Search(self._theGraph) != cappconst.OK: * raise RuntimeError("Failed to attach K33Search algorithm.") # <<<<<<<<<<<<<< @@ -8459,14 +8384,14 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_62gp_AttachK33Search(st PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Failed_to_attach_K33Search_algor}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 252, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 252, __pyx_L1_error) + __PYX_ERR(0, 249, __pyx_L1_error) - /* "planarity/full/graph.pyx":251 + /* "planarity/full/graph.pyx":248 * * def gp_AttachK33Search(self): * if cgraphLib.gp_AttachK33Search(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< @@ -8475,7 +8400,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_62gp_AttachK33Search(st */ } - /* "planarity/full/graph.pyx":250 + /* "planarity/full/graph.pyx":247 * raise RuntimeError("Failed to attach K23Search algorithm.") * * def gp_AttachK33Search(self): # <<<<<<<<<<<<<< @@ -8497,7 +8422,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_62gp_AttachK33Search(st return __pyx_r; } -/* "planarity/full/graph.pyx":254 +/* "planarity/full/graph.pyx":251 * raise RuntimeError("Failed to attach K33Search algorithm.") * * def gp_AttachK4Search(self): # <<<<<<<<<<<<<< @@ -8560,7 +8485,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_64gp_AttachK4Search(str int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_AttachK4Search", 0); - /* "planarity/full/graph.pyx":255 + /* "planarity/full/graph.pyx":252 * * def gp_AttachK4Search(self): * if cgraphLib.gp_AttachK4Search(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< @@ -8570,7 +8495,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_64gp_AttachK4Search(str __pyx_t_1 = (gp_AttachK4Search(__pyx_v_self->_theGraph) != OK); if (unlikely(__pyx_t_1)) { - /* "planarity/full/graph.pyx":256 + /* "planarity/full/graph.pyx":253 * def gp_AttachK4Search(self): * if cgraphLib.gp_AttachK4Search(self._theGraph) != cappconst.OK: * raise RuntimeError("Failed to attach K4Search algorithm.") # <<<<<<<<<<<<<< @@ -8583,14 +8508,14 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_64gp_AttachK4Search(str PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Failed_to_attach_K4Search_algori}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 256, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 253, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 256, __pyx_L1_error) + __PYX_ERR(0, 253, __pyx_L1_error) - /* "planarity/full/graph.pyx":255 + /* "planarity/full/graph.pyx":252 * * def gp_AttachK4Search(self): * if cgraphLib.gp_AttachK4Search(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< @@ -8599,7 +8524,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_64gp_AttachK4Search(str */ } - /* "planarity/full/graph.pyx":254 + /* "planarity/full/graph.pyx":251 * raise RuntimeError("Failed to attach K33Search algorithm.") * * def gp_AttachK4Search(self): # <<<<<<<<<<<<<< @@ -8621,7 +8546,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_64gp_AttachK4Search(str return __pyx_r; } -/* "planarity/full/graph.pyx":258 +/* "planarity/full/graph.pyx":255 * raise RuntimeError("Failed to attach K4Search algorithm.") * * def gp_Embed(self, int embedFlags) -> int: # <<<<<<<<<<<<<< @@ -8669,32 +8594,32 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_embedFlags,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 258, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 255, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 258, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 255, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_Embed", 0) < (0)) __PYX_ERR(0, 258, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_Embed", 0) < (0)) __PYX_ERR(0, 255, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_Embed", 1, 1, 1, i); __PYX_ERR(0, 258, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_Embed", 1, 1, 1, i); __PYX_ERR(0, 255, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 258, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 255, __pyx_L3_error) } - __pyx_v_embedFlags = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_embedFlags == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 258, __pyx_L3_error) + __pyx_v_embedFlags = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_embedFlags == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 255, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("gp_Embed", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 258, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("gp_Embed", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 255, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -8724,7 +8649,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_66gp_Embed(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_Embed", 0); - /* "planarity/full/graph.pyx":259 + /* "planarity/full/graph.pyx":256 * * def gp_Embed(self, int embedFlags) -> int: * return cgraphLib.gp_Embed(self._theGraph, embedFlags) # <<<<<<<<<<<<<< @@ -8732,14 +8657,14 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_66gp_Embed(struct __pyx * def gp_TestEmbedResultIntegrity(self, Graph copy_of_orig_graph, int embed_result) -> int: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyLong_From_int(gp_Embed(__pyx_v_self->_theGraph, __pyx_v_embedFlags)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_int(gp_Embed(__pyx_v_self->_theGraph, __pyx_v_embedFlags)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 259, __pyx_L1_error) + if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 256, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/full/graph.pyx":258 + /* "planarity/full/graph.pyx":255 * raise RuntimeError("Failed to attach K4Search algorithm.") * * def gp_Embed(self, int embedFlags) -> int: # <<<<<<<<<<<<<< @@ -8758,7 +8683,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_66gp_Embed(struct __pyx return __pyx_r; } -/* "planarity/full/graph.pyx":261 +/* "planarity/full/graph.pyx":258 * return cgraphLib.gp_Embed(self._theGraph, embedFlags) * * def gp_TestEmbedResultIntegrity(self, Graph copy_of_orig_graph, int embed_result) -> int: # <<<<<<<<<<<<<< @@ -8806,39 +8731,39 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_copy_of_orig_graph,&__pyx_mstate_global->__pyx_n_u_embed_result,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 261, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 258, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 261, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 258, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 261, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 258, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_TestEmbedResultIntegrity", 0) < (0)) __PYX_ERR(0, 261, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_TestEmbedResultIntegrity", 0) < (0)) __PYX_ERR(0, 258, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_TestEmbedResultIntegrity", 1, 2, 2, i); __PYX_ERR(0, 261, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_TestEmbedResultIntegrity", 1, 2, 2, i); __PYX_ERR(0, 258, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 261, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 258, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 261, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 258, __pyx_L3_error) } __pyx_v_copy_of_orig_graph = ((struct __pyx_obj_9planarity_4full_5graph_Graph *)values[0]); - __pyx_v_embed_result = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_embed_result == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 261, __pyx_L3_error) + __pyx_v_embed_result = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_embed_result == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 258, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("gp_TestEmbedResultIntegrity", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 261, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("gp_TestEmbedResultIntegrity", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 258, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -8849,7 +8774,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_copy_of_orig_graph), __pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, 1, "copy_of_orig_graph", 0))) __PYX_ERR(0, 261, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_copy_of_orig_graph), __pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, 1, "copy_of_orig_graph", 0))) __PYX_ERR(0, 258, __pyx_L1_error) __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_68gp_TestEmbedResultIntegrity(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_copy_of_orig_graph, __pyx_v_embed_result); /* function exit code */ @@ -8878,20 +8803,20 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_68gp_TestEmbedResultInt int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_TestEmbedResultIntegrity", 0); - /* "planarity/full/graph.pyx":262 + /* "planarity/full/graph.pyx":259 * * def gp_TestEmbedResultIntegrity(self, Graph copy_of_orig_graph, int embed_result) -> int: * return cgraphLib.gp_TestEmbedResultIntegrity(self._theGraph, copy_of_orig_graph._theGraph, embed_result) # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyLong_From_int(gp_TestEmbedResultIntegrity(__pyx_v_self->_theGraph, __pyx_v_copy_of_orig_graph->_theGraph, __pyx_v_embed_result)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_int(gp_TestEmbedResultIntegrity(__pyx_v_self->_theGraph, __pyx_v_copy_of_orig_graph->_theGraph, __pyx_v_embed_result)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 262, __pyx_L1_error) + if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 259, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/full/graph.pyx":261 + /* "planarity/full/graph.pyx":258 * return cgraphLib.gp_Embed(self._theGraph, embedFlags) * * def gp_TestEmbedResultIntegrity(self, Graph copy_of_orig_graph, int embed_result) -> int: # <<<<<<<<<<<<<< @@ -9163,16 +9088,16 @@ static PyMethodDef __pyx_methods_9planarity_4full_5graph_Graph[] = { {"gp_IsArc", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_9gp_IsArc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_8gp_IsArc}, {"gp_GetFirstEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_11gp_GetFirstEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_10gp_GetFirstEdge}, {"gp_EdgeInUse", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_13gp_EdgeInUse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_12gp_EdgeInUse}, - {"gp_EdgeIndexBound", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_15gp_EdgeIndexBound, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_14gp_EdgeIndexBound}, - {"gp_EdgeInUseIndexBound", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_17gp_EdgeInUseIndexBound, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_16gp_EdgeInUseIndexBound}, + {"gp_EdgeArraySize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_15gp_EdgeArraySize, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_14gp_EdgeArraySize}, + {"gp_EdgeInUseArraySize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_17gp_EdgeInUseArraySize, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_16gp_EdgeInUseArraySize}, {"gp_GetFirstArc", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_19gp_GetFirstArc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_18gp_GetFirstArc}, {"gp_GetNextArc", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_21gp_GetNextArc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_20gp_GetNextArc}, {"gp_GetNeighbor", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_23gp_GetNeighbor, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_22gp_GetNeighbor}, {"gp_IsVertex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_25gp_IsVertex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_24gp_IsVertex}, {"gp_GetFirstVertex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_27gp_GetFirstVertex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_26gp_GetFirstVertex}, {"gp_GetLastVertex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_29gp_GetLastVertex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_28gp_GetLastVertex}, - {"gp_VertexInRange", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_31gp_VertexInRange, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_30gp_VertexInRange}, - {"gp_getN", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_33gp_getN, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_32gp_getN}, + {"gp_VertexInRangeAscending", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_31gp_VertexInRangeAscending, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_30gp_VertexInRangeAscending}, + {"gp_GetN", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_33gp_GetN, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_32gp_GetN}, {"gp_InitGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_35gp_InitGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_34gp_InitGraph}, {"gp_ReinitializeGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_37gp_ReinitializeGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_36gp_ReinitializeGraph}, {"gp_CopyGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_39gp_CopyGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_38gp_CopyGraph}, @@ -9862,35 +9787,35 @@ __Pyx_RefNannySetupContext("PyInit_graph", 0); /* "planarity/full/graph.pyx":69 * return cgraphLib.gp_EdgeInUse(self._theGraph, e) * - * def gp_EdgeIndexBound(self): # <<<<<<<<<<<<<< - * return cgraphLib.gp_EdgeIndexBound(self._theGraph) + * def gp_EdgeArraySize(self): # <<<<<<<<<<<<<< + * return cgraphLib.gp_EdgeArraySize(self._theGraph) * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_15gp_EdgeIndexBound, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_EdgeIndexBound, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_15gp_EdgeArraySize, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_EdgeArraySize, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_EdgeIndexBound, __pyx_t_3) < (0)) __PYX_ERR(0, 69, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_EdgeArraySize, __pyx_t_3) < (0)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "planarity/full/graph.pyx":72 - * return cgraphLib.gp_EdgeIndexBound(self._theGraph) + * return cgraphLib.gp_EdgeArraySize(self._theGraph) * - * def gp_EdgeInUseIndexBound(self): # <<<<<<<<<<<<<< - * return cgraphLib.gp_EdgeInUseIndexBound(self._theGraph) + * def gp_EdgeInUseArraySize(self): # <<<<<<<<<<<<<< + * return cgraphLib.gp_EdgeInUseArraySize(self._theGraph) * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_17gp_EdgeInUseIndexBound, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_EdgeInUseIndexBound, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_17gp_EdgeInUseArraySize, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_EdgeInUseArraySize, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_EdgeInUseIndexBound, __pyx_t_3) < (0)) __PYX_ERR(0, 72, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_EdgeInUseArraySize, __pyx_t_3) < (0)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "planarity/full/graph.pyx":75 - * return cgraphLib.gp_EdgeInUseIndexBound(self._theGraph) + * return cgraphLib.gp_EdgeInUseArraySize(self._theGraph) * * def gp_GetFirstArc(self, int v): # <<<<<<<<<<<<<< * if not self.gp_IsVertex(v): @@ -9982,320 +9907,320 @@ __Pyx_RefNannySetupContext("PyInit_graph", 0); /* "planarity/full/graph.pyx":112 * return cgraphLib.gp_GetLastVertex(self._theGraph) * - * def gp_VertexInRange(self, int v): # <<<<<<<<<<<<<< + * def gp_VertexInRangeAscending(self, int v): # <<<<<<<<<<<<<< * return ( * v >= self.gp_GetFirstVertex() and */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_31gp_VertexInRange, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_VertexInRange, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_31gp_VertexInRangeAscending, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_VertexInRangeAscending, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_VertexInRange, __pyx_t_3) < (0)) __PYX_ERR(0, 112, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_VertexInRangeAscending, __pyx_t_3) < (0)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "planarity/full/graph.pyx":118 * ) * - * def gp_getN(self)-> int: # <<<<<<<<<<<<<< + * def gp_GetN(self)-> int: # <<<<<<<<<<<<<< * """ * Returns the number of vertices in the graph. */ __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 118, __pyx_L1_error) - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_33gp_getN, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_getN, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_33gp_GetN, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetN, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_getN, __pyx_t_2) < (0)) __PYX_ERR(0, 118, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetN, __pyx_t_2) < (0)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/graph.pyx":126 - * return cgraphLib.gp_getN(self._theGraph) + /* "planarity/full/graph.pyx":127 + * return cgraphLib.gp_GetN(self._theGraph) * * def gp_InitGraph(self, int n): # <<<<<<<<<<<<<< * if cgraphLib.gp_InitGraph(self._theGraph, n) != cappconst.OK: * raise RuntimeError(f"gp_InitGraph() failed.") */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_35gp_InitGraph, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_InitGraph, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[15])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_35gp_InitGraph, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_InitGraph, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[15])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_InitGraph, __pyx_t_2) < (0)) __PYX_ERR(0, 126, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_InitGraph, __pyx_t_2) < (0)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/graph.pyx":130 + /* "planarity/full/graph.pyx":131 * raise RuntimeError(f"gp_InitGraph() failed.") * * def gp_ReinitializeGraph(self): # <<<<<<<<<<<<<< * cgraphLib.gp_ReinitializeGraph(self._theGraph) * */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_37gp_ReinitializeGraph, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ReinitializeGraph, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[16])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 130, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_37gp_ReinitializeGraph, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ReinitializeGraph, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[16])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_ReinitializeGraph, __pyx_t_2) < (0)) __PYX_ERR(0, 130, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_ReinitializeGraph, __pyx_t_2) < (0)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/graph.pyx":133 + /* "planarity/full/graph.pyx":134 * cgraphLib.gp_ReinitializeGraph(self._theGraph) * * def gp_CopyGraph(self, Graph src_graph): # <<<<<<<<<<<<<< * # NOTE: this is interpreting the self as the dstGraph, i.e. copying * # the Graph wrapper that is passed in as the srcGraph */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_39gp_CopyGraph, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_CopyGraph, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[17])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_39gp_CopyGraph, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_CopyGraph, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[17])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_CopyGraph, __pyx_t_2) < (0)) __PYX_ERR(0, 133, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_CopyGraph, __pyx_t_2) < (0)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/graph.pyx":147 + /* "planarity/full/graph.pyx":148 * raise RuntimeError(f"gp_CopyGraph() failed.") * * def gp_DupGraph(self) -> Graph: # <<<<<<<<<<<<<< * cdef cgraphLib.graphP theGraph_dup = cgraphLib.gp_DupGraph(self._theGraph) * if theGraph_dup == NULL: */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 147, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_Graph) < (0)) __PYX_ERR(0, 147, __pyx_L1_error) - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_41gp_DupGraph, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_DupGraph, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[18])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 147, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_Graph) < (0)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_41gp_DupGraph, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_DupGraph, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[18])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_DupGraph, __pyx_t_3) < (0)) __PYX_ERR(0, 147, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_DupGraph, __pyx_t_3) < (0)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":164 + /* "planarity/full/graph.pyx":165 * return new_graph * * def gp_Read(self, str infile_name): # <<<<<<<<<<<<<< * # Convert Python str to UTF-8 encoded bytes, and then to const char * * cdef bytes encoded = infile_name.encode('utf-8') */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_43gp_Read, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_Read, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[19])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_43gp_Read, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_Read, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[19])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_Read, __pyx_t_3) < (0)) __PYX_ERR(0, 164, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_Read, __pyx_t_3) < (0)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":172 + /* "planarity/full/graph.pyx":173 * raise RuntimeError(f"gp_Read() failed.") * * def gp_Write(self, str outfile_name, str mode): # <<<<<<<<<<<<<< * mode_code = (cgraphLib.WRITE_ADJLIST if mode == "a" * else (cgraphLib.WRITE_ADJMATRIX if mode == "m" */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_45gp_Write, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_Write, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[20])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 172, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_45gp_Write, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_Write, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[20])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_Write, __pyx_t_3) < (0)) __PYX_ERR(0, 172, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_Write, __pyx_t_3) < (0)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":192 + /* "planarity/full/graph.pyx":193 * ) * * def gp_GetNeighborEdgeRecord(self, int u, int v): # <<<<<<<<<<<<<< * if not self.gp_IsVertex(u): * raise RuntimeError(f"'{u}' is not a valid vertex label.") */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_47gp_GetNeighborEdgeRecord, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetNeighborEdgeRecord, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[21])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_47gp_GetNeighborEdgeRecord, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetNeighborEdgeRecord, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[21])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetNeighborEdgeRecord, __pyx_t_3) < (0)) __PYX_ERR(0, 192, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetNeighborEdgeRecord, __pyx_t_3) < (0)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":200 + /* "planarity/full/graph.pyx":201 * return cgraphLib.gp_GetNeighborEdgeRecord(self._theGraph, u, v) * * def gp_GetVertexDegree(self, int v): # <<<<<<<<<<<<<< * if not self.gp_IsVertex(v): * raise RuntimeError(f"'{v}' is not a valid vertex label.") */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_49gp_GetVertexDegree, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetVertexDegree, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[22])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_49gp_GetVertexDegree, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetVertexDegree, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[22])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetVertexDegree, __pyx_t_3) < (0)) __PYX_ERR(0, 200, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetVertexDegree, __pyx_t_3) < (0)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":206 + /* "planarity/full/graph.pyx":207 * return cgraphLib.gp_GetVertexDegree(self._theGraph, v) * * def gp_GetArcCapacity(self): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetArcCapacity(self._theGraph) * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_51gp_GetArcCapacity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetArcCapacity, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[23])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 206, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_51gp_GetArcCapacity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetArcCapacity, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[23])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetArcCapacity, __pyx_t_3) < (0)) __PYX_ERR(0, 206, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetArcCapacity, __pyx_t_3) < (0)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":209 + /* "planarity/full/graph.pyx":210 * return cgraphLib.gp_GetArcCapacity(self._theGraph) * * def gp_EnsureArcCapacity(self, int new_arc_capacity): # <<<<<<<<<<<<<< * if cgraphLib.gp_EnsureArcCapacity(self._theGraph, new_arc_capacity) != cappconst.OK: * raise RuntimeError( */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_53gp_EnsureArcCapacity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_EnsureArcCapacity, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[24])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 209, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_53gp_EnsureArcCapacity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_EnsureArcCapacity, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[24])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_EnsureArcCapacity, __pyx_t_3) < (0)) __PYX_ERR(0, 209, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_EnsureArcCapacity, __pyx_t_3) < (0)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":215 + /* "planarity/full/graph.pyx":216 * f"{new_arc_capacity}.") * * def gp_AddEdge(self, int u, int ulink, int v, int vlink): # <<<<<<<<<<<<<< * if ulink != 0 and ulink != 1: * raise RuntimeError( */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_55gp_AddEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_AddEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[25])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 215, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_55gp_AddEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_AddEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[25])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_AddEdge, __pyx_t_3) < (0)) __PYX_ERR(0, 215, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_AddEdge, __pyx_t_3) < (0)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":230 + /* "planarity/full/graph.pyx":231 * ) * - * def gp_DeleteEdge(self, int e, int nextLink): # <<<<<<<<<<<<<< + * def gp_DeleteEdge(self, int e): # <<<<<<<<<<<<<< * if not self.gp_IsArc(e): * raise RuntimeError( */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_57gp_DeleteEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_DeleteEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[26])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 230, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_57gp_DeleteEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_DeleteEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[26])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 231, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_DeleteEdge, __pyx_t_3) < (0)) __PYX_ERR(0, 230, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_DeleteEdge, __pyx_t_3) < (0)) __PYX_ERR(0, 231, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":242 - * return cgraphLib.gp_DeleteEdge(self._theGraph, e, nextLink) + /* "planarity/full/graph.pyx":239 + * return cgraphLib.gp_DeleteEdge(self._theGraph, e) * * def gp_AttachDrawPlanar(self): # <<<<<<<<<<<<<< * if cgraphLib.gp_AttachDrawPlanar(self._theGraph) != cappconst.OK: * raise RuntimeError("Failed to attach DrawPlanar algorithm.") */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_59gp_AttachDrawPlanar, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_AttachDrawPlanar, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[27])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_59gp_AttachDrawPlanar, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_AttachDrawPlanar, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[27])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_AttachDrawPlanar, __pyx_t_3) < (0)) __PYX_ERR(0, 242, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_AttachDrawPlanar, __pyx_t_3) < (0)) __PYX_ERR(0, 239, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":246 + /* "planarity/full/graph.pyx":243 * raise RuntimeError("Failed to attach DrawPlanar algorithm.") * * def gp_AttachK23Search(self): # <<<<<<<<<<<<<< * if cgraphLib.gp_AttachK23Search(self._theGraph) != cappconst.OK: * raise RuntimeError("Failed to attach K23Search algorithm.") */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_61gp_AttachK23Search, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_AttachK23Search, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[28])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 246, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_61gp_AttachK23Search, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_AttachK23Search, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[28])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_AttachK23Search, __pyx_t_3) < (0)) __PYX_ERR(0, 246, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_AttachK23Search, __pyx_t_3) < (0)) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":250 + /* "planarity/full/graph.pyx":247 * raise RuntimeError("Failed to attach K23Search algorithm.") * * def gp_AttachK33Search(self): # <<<<<<<<<<<<<< * if cgraphLib.gp_AttachK33Search(self._theGraph) != cappconst.OK: * raise RuntimeError("Failed to attach K33Search algorithm.") */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_63gp_AttachK33Search, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_AttachK33Search, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[29])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 250, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_63gp_AttachK33Search, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_AttachK33Search, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[29])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_AttachK33Search, __pyx_t_3) < (0)) __PYX_ERR(0, 250, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_AttachK33Search, __pyx_t_3) < (0)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":254 + /* "planarity/full/graph.pyx":251 * raise RuntimeError("Failed to attach K33Search algorithm.") * * def gp_AttachK4Search(self): # <<<<<<<<<<<<<< * if cgraphLib.gp_AttachK4Search(self._theGraph) != cappconst.OK: * raise RuntimeError("Failed to attach K4Search algorithm.") */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_65gp_AttachK4Search, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_AttachK4Search, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[30])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_65gp_AttachK4Search, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_AttachK4Search, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[30])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_AttachK4Search, __pyx_t_3) < (0)) __PYX_ERR(0, 254, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_AttachK4Search, __pyx_t_3) < (0)) __PYX_ERR(0, 251, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":258 + /* "planarity/full/graph.pyx":255 * raise RuntimeError("Failed to attach K4Search algorithm.") * * def gp_Embed(self, int embedFlags) -> int: # <<<<<<<<<<<<<< * return cgraphLib.gp_Embed(self._theGraph, embedFlags) * */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 258, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 258, __pyx_L1_error) - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_67gp_Embed, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_Embed, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[31])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 255, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_67gp_Embed, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_Embed, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[31])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_Embed, __pyx_t_2) < (0)) __PYX_ERR(0, 258, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_Embed, __pyx_t_2) < (0)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/graph.pyx":261 + /* "planarity/full/graph.pyx":258 * return cgraphLib.gp_Embed(self._theGraph, embedFlags) * * def gp_TestEmbedResultIntegrity(self, Graph copy_of_orig_graph, int embed_result) -> int: # <<<<<<<<<<<<<< * return cgraphLib.gp_TestEmbedResultIntegrity(self._theGraph, copy_of_orig_graph._theGraph, embed_result) */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 261, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 261, __pyx_L1_error) - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_69gp_TestEmbedResultIntegrity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_TestEmbedResultIntegrit, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[32])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 261, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 258, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_69gp_TestEmbedResultIntegrity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_TestEmbedResultIntegrit, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[32])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_TestEmbedResultIntegrity, __pyx_t_3) < (0)) __PYX_ERR(0, 261, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_TestEmbedResultIntegrity, __pyx_t_3) < (0)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "(tree fragment)":1 @@ -10396,42 +10321,42 @@ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); { - const struct { const unsigned int length: 8; } index[] = {{2},{38},{37},{37},{36},{25},{32},{34},{31},{31},{4},{179},{77},{67},{29},{51},{1},{1},{2},{1},{8},{13},{7},{6},{9},{2},{22},{37},{21},{43},{49},{47},{45},{44},{22},{16},{17},{24},{30},{22},{9},{50},{24},{14},{15},{21},{22},{17},{23},{23},{22},{8},{5},{23},{25},{28},{16},{25},{24},{24},{23},{18},{19},{17},{18},{28},{23},{14},{26},{23},{20},{21},{23},{22},{20},{30},{19},{24},{18},{14},{17},{13},{26},{33},{22},{14},{13},{19},{3},{13},{5},{2},{20},{1},{18},{18},{18},{1},{10},{12},{7},{8},{1},{22},{12},{10},{19},{18},{18},{17},{12},{13},{11},{12},{22},{17},{8},{20},{17},{14},{15},{17},{16},{14},{24},{13},{18},{12},{8},{11},{7},{20},{27},{16},{8},{7},{11},{3},{13},{13},{5},{1},{8},{4},{9},{10},{1},{8},{16},{9},{11},{8},{12},{20},{3},{11},{12},{10},{17},{13},{6},{4},{12},{10},{12},{19},{9},{8},{12},{1},{5},{1},{6},{5},{38},{14},{77},{44},{44},{44},{44},{42},{70},{118},{91},{28},{14},{27},{114},{14},{11},{27},{30},{39},{14},{44},{27},{40},{40},{13},{9},{100},{27},{55},{18}}; - #if (CYTHON_COMPRESS_STRINGS) == 3 && __PYX_LIMITED_VERSION_HEX >= 0x030e0000 /* compression: zstd (1992 bytes) */ -const char* const cstring = "(\265/\375`\201\020\365=\000\312U\010\0229\000\231\033\374\377\367\372U\247\376u|\215:\276F\035_\243N\375[`\302\235\022\263\233\314O\255\345Rr\017\025\310D\343\032\351\350\204\243-,\320po\342'\274\202)\025$9\372\000\014\001\020\001W\367\360\343\312\\\220\246;R~\\\235\023\365\025\305<*e.\324\311+\352\237Cr\034\363\345Z+\365\255\177X\376\370xd\330\265\330\311\253w\331\353\246\254\273\337\227\273\353\275\026u\330K\022(\246\375\230qt\323\356[\274\260\034\337\230\223\373\347Or\236a\367k\177\271\326}\237y\232\337\222\364]\334\316\215y\315\363\375\313\367\037w\251tq\344\365\332\373<\206J\245\277\376\207zI\367+\362|e-2\222\237\331\317\345]\377p\367\357\257o\324?w\255\264G-rR\367}6\272\177\365'k\232\223\265\246\261\204\335\027\332\177\322\374>i\221\211\357Q\343v\275q;\324<\177\177\336u\022\227\273b\023\337\211\211\032j\217y\377\315\367\375$\277~_\035/\367\034Y\212.\354Y\003\245\240\360\354t\177w27\346\3333\317\343\217S\3567W\027\346\377\363%\377\025\365\2703N\014\026\373\346\311\367\2031\217\017\217O\220OmF\253\001oj>5\332N\215F\023\252a\277s<\337\370\316\347;^\337\276\327A^\367\234\276\351d\250o\2316\244\225v\"/\311\232\035^)K\021E\020\3630\356\232\347\204\277\316\375\374\375\327\036\3430\246w\271\246\307\215#K\271\371\340\350\330\334\300\031\320m\026$\344s\003k \355\207\010\274\335`\240\034\220\206s3\253\351\231\225W\367\267\323\005\231\3619\036\363\344\343\305J\306\261\304\225\3600\016\307\274\233v\377$\034c\035\226\242\356\030\337?\226\031\247\305Kr\321\357\030l\2275b\243V\312\343\3150\030\216\324\177w\"1\353\233\223\256\375\315w\236:\251\244\313m]\373O\372w\335\364}\3378_\347\204\276\277\303\314\3136a\007u/=\207y!\276\303+a7\354y\337\227\231\376z\3247 \0376\230\227\013s1\334\205i\277ELsGb\260\330\036y\245\3305\337\371s2\274N\232\007%?-\215%Z7V\0265@\245\241-\036\023\302\352\025\200z\234\242Yc>\230+6v\203\035U\016\325\245\236\200k\202z\223\236\244\"V'\350\013\365\347\213u\261 \013\355\2351\254\225\226\266\322\036\312\300b{+Mo\315\353LVGR\021\265\241\ny\265\2552\257\325""\2531\351G3\272pV\030\000\014\\\331TP\225\271\322\0205:!\316n\332\230.V\254\265\247\2624\374\300\323\305\374\010\275T\226\276\322\020\212\026\234\262\241\020(\013-8)\n~\2753\237#\246C\302\317vn\234QT2\252\004\003\200\202+\326I\321j\233\274.\233J^)b\335\367\372\343\260{\334\250=\357\345\177\322c.{<\214y$/\026\303\330I\217%\346;\3570\336\371\035\366\033\377]\346X\217\033\3077\316a\034\362\022\207E2\344\272c\237\313#\216\326\271\335I\214#1S\230\225t\230\373\307|\3431\364\232\357_\222\235\014c\344\016\271\317\347\214\3237\374\303/uD9P\027j@\323Be\314\207\202\250\007\224\311\204A#\320W\372\321j\305\260\r\211Z\242Yk\261\006\035\031\265F\255\266g\305B3.LW\352\343a\235@\346\013Z\236\031\005VY\344\0148ez\254\214}\255\024\\\264Z\233)Bu\320\372\261\246\\hx\3020t\021\365x\275\"~0\360C\242\3450=\025\203\002\310&\300\216R\0134H\207E\220\"\235\027S\346\313th\370\271\214\212ZZ\025\355\245\035{\021\277W\352QXD\013a\206T\013\t?\203\023V\352\304\303\225S\216\324\225\202\234\364\252bX\204u)\035A\305\323v\356\200(G\301\317\245\262\324\2114\351\3040\0008\270\002\325\0235E$\344w\302\006\260*\353.\215u\374@\366\201\235\2551\037\355G\306\217\265\002\251\002\252\tFkdF\330X\2135\t\242\265\245\020)+\375p\261I\352F\020P+\305\306\254 \352\210r\240.\264'\247\272\215\323\233OV\256\206\037x\206\364V\233\365a\245P\rR t\003\255%`4\374zlfqTZPm\251\2754\201y\250q%R\206\221\221\021\021\005I\222\244\003A\010\002\241\244\204\216\363\262\201\"\3450N\022\343\014\221\"\031\021\221\202\244 I\007\000Q\364\020\252\n\227\212\032\207\264\370\2640\0348\302\223\272\235\220#CwM\374\263u\352\010\010\276`<\320VBd\263\270x\243\204\20695s\313\307}\311\324\022\363f\n\334\327;\r1\370\214\321#\246W\020\027\ts\375,\335\226\365O\2504V\204\216B_-Y\204\005\273\346<\351\371\210\224\226 \252\316\207\027\275\\\240R3?\313\231\201{\221\317\036\274\245\260\2739\254\030y\020\372.\034%\266\324\326rW\277\334F}\306\036Q\250\346\nl\365\003\2109\252Z\320\322\353\256\235\013\262\247\263q\326\365Q\363\226\336>\350b\033\265\236\202J\212)""\013\0065l\244d\000\020%\240?\340p\215\330(\371\257\240\307\300\255\t\343\214\242\300\235\330\356\375!\332\331\200\362|q\247\243\024\215\226y\n\005\001J\324\317;\237\232\233\325\227\347\177\016\315\200\346T\276\037V\272\244O\223\264\247\035\0002~\024\253\350\357!\2523X\253\323\035\005\225\220\020\211\340\033\033k`\303\003\246\213P\265\010\243A\221'4\2231=wn|\024`\342\036ug\002\377\243\214il@!E\315:\212\331,\022\277\314:\"\247$6M(\003E\205)\014V|\221\205\200\013\014_\240\020\203P\006#h\274\010\003\0337\n\342\340\205\016\tw\370\350\021\243\017\035D0x\014C$\000\204\n#\002\217\030H\202\242\022\014&.lB\300\023\r\241$\327\"9\000\306sU8\236\274\201J\356\343\203\252\266,\226~\222^\01688\347z\211ld\002\004\341K\211\300\240@N8,hr\274\220\261\203\031\356\333\250_'\372ocm z\227\0221\010\031{jUe\267\260\341\253\261\305\244\263w\225\267\345\344rC\327\3334!R\374\323\342!G\035\372^\016\317\240\020\212\025\215\344\360.\204\255\232\331o\014\252f\241|\335\304Qb\nu\007\225_^l(el\216K\245~\354\300$\016\244\203Y\322\004\3445\372NB'\231\023q5?\370EkF\201dE~\035\002\277\033\020\220L\337!'a\224\345\331\302\211\210)$A6\234\262\241|\021b\345\035k\350\372\350)H:vG\027*\240\371\315\236@{Ou\353A \275\322\t\310wd\277\245\303\252\3003\00570\333\376\010\277\363^\016\036\305A\370\344\2651\"\262\017a:\330\037\325\0072\254\n\236\326\3571\366\252\023\220R7\233\330<\360\346\224\036\002J{\206H\345\227\205\230{\3333m<\336\373\200\334]\300\211F\221iYjO1\365\034\232X\232\303\374\241\302m\005\276\004,\216\344){\266s\335\353~\000\372\3222\3149\250\266\3554\255G\0342\323\322O\242\254\274\336\1771\350\034@\033\005K\001\350\244\250\250;\344\224\241\212\230i%\223<\210 \327\302\273*b\033J(\t= 0x030e0000 /* compression: zstd (1976 bytes) */ +const char* const cstring = "(\265/\375`L\020u=\000:V\034\022G\000\2578\007\374?WUB\277/\277F\277\372\325/u|\215~\257v\rm0\022)\322\233\342\035\312\267N\224$$\367\230\247\326\202O)g\1775i\024\201\235\301'\267D}4\232\223\327;<\006\036\356\t\024g\370}\364\000\007\001\021\001\330\362\354]J\363\231\276\276\"\232BGfh\t(\242\017\343\236r\334w.\233a\264G\271\347\366z]gi\376wi\374\374\202.\264\317\273\3729\355\321\227\331mc\224oPF\367~\356\257\006\275\326\350wgQ?\2035\346h\010\226q\315\036\346\226{9\333\020\345\277i\376\030\337\366\373LA\217F_+t\264\377\243q\2321\3570\350\242/\217\356\337\333v\327\005n\272\371}\025\257)\227--q(Up9\271\320\254\237_\254\371\246\264\356\271\325\357\302\335s\331\213q\232J\214\323\347\236\352\263\247\232\t\321\023\220\326<\267\"\343.\002\325\217_\370\376\267)\2672\355\275`\224\233\311+#\356Y\340\316b\2163\246\334\313tc\032\373\254\026Q2\211]m\277e\202\201E\026\343X{\260\316Rm\263\355\\h\2546\321\330\265\234[\352q\312}\207-j\024\n\257gU~\261\251\206\346R+K\013K\313K\213\352\224\n\261\231T-\252\324\212*\225\202Q\325\215\271\374wg\313\312+<\257\354g\361\375/\3735\354M\332\273\317R\331T\t\356]2\026\270E\263Zo%\023\216\333\352W\253\376\217\246\362\207q\3137\377]\353\035\275\314\252\276\303\250\222\t\253\0055B\205\265\235Z\254\323\013L\013kSm)\227\230\215e\252-\021[\ne:\205 q\002i\214c\032:\362a\3032J\r\355\033Y\350:\360e\341\253\365v\026\317`\315+\344Z\377\202\334\353Z)\357@\373z\216z\231\333x\024\222\331\010\243\356]\266\2436\024zy\317\261\216\341\354\263h^\305q^\251\321\236+\006\303\257\3425\317\365\317\360\2551\212\277\210K\343\370\332\317\252\\\275\275\006w\016m\230\274\362\201!z\265\305\364\344\364\374\2737\215\210T\352\007\273\260\321\213\206~c\256\202\240%\243\320\010w\037\310\351\317\001=\244\253\302\0166\033\0178j3\323\232\250\014\347Fv\310\331h\301\345L\2311eH\271\201\314 S\275\303\022z\334\2002\372\004\221\013C\204\035\241\206\225\031bv\244\010\371!I[\271A\232F\322HrC\352\240\276E\220\37117N\237\211(\23425v\306YG\3001g%\210Yi\313\017\226,\031\271\276\352\006l\271*SH""\224\221w\333\017\210\0144\000\010\210\301)g\344\006\216\332&v\010y\201\331X\032A#\005\220\023\304S\333^\254\272G\347t\217\010\342\271\231\211V,\t\023l\324Vb\210\330\302\246d\263\241\001\300\023\203#\202t\316\231\375\340\014\370\201\\\215\361\375\274^\275_\335\357\254A^\363\235\005g_\255\237\367\215F\365j[i\276\003k\306VV\253l\313\352\306\225\313l\256\337\341W\306\025V\353\315\340\253r\336\315\257\353\206\331\016\365\017\303\332\253/\257\256\270\326\365\327j^3\256\335\335\2371\007=\355\335\221\207o\246mk\003 \262\353\"\375\3235D\020\235\236\022vxZt\364\025\241\207\376\321A\243\250sr\367\2741g\314\351lP\276\220\033Y:!s\312t\316\331\r\247Cp\020~<7\234\221\326w\007\216\330\nO:(B\360\334X\0221CL\231\231%\023\244\301\343\240s\256B\022\033\002\235\032\347\305\247_\321\003\002\224\3165\327'\200@\037\265\320&Rp\212\204\333\006\201\201\315\334\010\235\030\033\364\227\021\234\001#\n\321\201\347&\004\205\t8j\037\031\023g\nF\352\344\3548f\352\243\006\032w\017}\234\036\341\2659\260Q\323 \231.H\023>$\037\3558\262\243\310\370\031GH3\030(f\201R\305X\3229q%\256l]\304S\373\220\034r\301\230B|\240\001\200@\214\215$\221&$\024j$3\303\314P\312\306\221\204\332fv\230\247\022Et\212 \3248e\213\014@^xp\312\204\037+\263A\231\302\343\\\215\036#g\024}\314\024d\310K\353ta\242\224#d\327E\372\247\223\260c\254\313\354\260\346\346\303Q\333D\n\263R\245\354(AH\215\261\025\201r\250q!R\206\231\231\021\221\202$I\032\003A\010\002\241\244t\014?\262\241\236%)\310\210qD\244FFD\244 )H!\035T\300\237S\225p))9\024\216E\216\215asL\277\333K\3453\263\266\353K=\032\030\333MX\251\364\304\204eo.\303\035\241y\005r\t\323\270ZV\026\006l\343\324\037z\203+\036O$\227.\357\214\301\013\231\322\241-\327\210\331\207o\366\250\342\253\337\3020\r3W2\275\201\366\261'\361\016)G\314p\246e`\303\370S\324\n\357\334\256\344\003\324\203$\300\325\203e\213\344J\232\276MV\273\201p[\2142\201\207\370\333^\240\327\277I\330Q\243B\216\226\033Ngs\201\013F\243\327\201z\346\240\274\330\340\243\024Y\247\035X\221PA\036\021\004 \360\211\350\034r\334v""\230\003|\251\204\212%\267\334\300\260-[\330~\227\023\277\212\323Ir\316\024\345\372\233\324\377\354\236+\235kwN\233\240\013\265T\037NwI\253VU\2016\001pT\005[\321\343O\254\235\341\023\010\013\201\234!\334O\030\214\272\365\242\337A\th4\240\350I\231) |\245\3241\361\036t\177\302o\344\341\234\036\350\020\251sU5$\230\240qk%\356nZ8\224\225\247\034\255\\1\313#\227\n\277\324\025\363\262\314\214h\276\031\246\360$\211qb\351\\\360\316\262zJ\366\231\004\007\007Sj\210M@\3642\202\343#\247$,+\321b\342q\223KO\256\014\245#)\256\\\n\233\017C\021D\262\2137_\335\272\374W\001 f\013\211\364\350\277\330\034B3\"\016\352'P\367\340\027Un\263\307\033\032\320x\254\330\335\"\203\255W\253'*\205\323v\350 '\343\361\013\r{\334\n\365>\255F\371D\216\321\372fj\322\234\262\341\234\271\311\002>\231\200\250\272hL \231\347|\275\302\316PE\"\232N*\314\305A\013tP\354\272y\255\2720\354\031\307\2625L\335\0335\312k\204\272\237\300\261\017\301\256\303L\205\362\224\331\325\316\020x\035\376/\350\226rrX\363\230\217\265\246\024\310\217\312\371\342n\356\032e'W\262\271HX\nYF\030#\347\205\264\315vM\266U,fV\271FKC\237e\006\274\376vl\254BHj.\005\224\315\325%7\201\367\225\203\027\256*\313\234\216\374\0054\302\344\021\270\372Wy!=\032\030\257\003!\311\333cFe\212\302\324\332\217j\007U\326\005/\350\365\003\226\303\035H!\232\315m\036\270\321Y\217\204\"\314\020R\303\261|S\261mK\313\313\353\324K\325. \002\243h\3324j\252XKGMV\024\230\331;\277E\001\014\001\316,/\200\032\033\246\013\215\216\201\230\367:\031*\240j[^_\0173\244-\345\350\363\023P\325\361\322m\003}\201\016\250\\\n\212\344\001P\000\310\007\241\212$>A\345\232\002\273\200\002\334\231\217|\300\255n\303\035b\203\364\363\017\306\320\207\216\260\233O\252C\r"; + PyObject *data = __Pyx_DecompressString(cstring, 1976, 3); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif - #elif (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (2152 bytes) */ -const char* const cstring = "BZh91AY&SY\331GS\212\000\001\024\177\377\357\377\377\347\377\377\377\377\277\357\377\374\277\377\377\374@@@@@@@@@@@@@\000@\000`\010\037z{\327\267\232\333\275\325\356\343F\3474\342\205;b{G\327\301\221MLE<\247\352G\251\372OR~\224\374\212i\372Sh\236\247\246\204\310\364\312\0324\000\000\302\031\014\206OQ\241\352i\210\323\320\232\006HCS\323@\023I\2114\310\323\324\365= \r\006F\203@\000\000\000\000\000\0004h\001\251\350\021&!@=F\215\000\320\000\032\001\240\000\000\000\000\000h\000\320=@\004\232\241\024\304\311\225=\241M\352M\3516\246\247\250\031\244\365\036\240\000\320\000\000\001\240\003@\320\000\000\003 \230\232`\031#\000\002`!\200\000\214\0010\000\002`\010\3010\000\000\022D&\206\224\362#&S\321\032\032L4\032\236S\305\000\003 \000\000\003@\000\0324\031=#\324'P\254\367\003\204\355\377G\017i\337\206!!\243\334\211\002P\342\342DJ\202K\376\023\264\202\177\313\025\025D\025 \252\210`\312\003vY~\315 \030\346\220\262\226\302\001^f*3\2039\024\006\224\006\n\025\254\031\237X,\020\252?\322t\2360\222)+\010\004\312\"\242\022u&J\370\2272W\242\252\034\241\017r\223{\265\304e|\270\262\311\365d\341\003\230\333\277\200\337}\275\361^\036\033K\351\2251\027\336Og,\374`\010\205\t\022\316\224\0349u\317`\021S\n\002\031Qe\247\304\3759\233,&\262\246:\302\025#\364^\311e\260\327e\346\010B\233\366\315\241\021,k\336z\n\246\345mAP\016\223*(\357\203jQjl\371$\222.]&\032\203\tT\2428\032\245\233T7*cn\206\027D\251\206GGJm\253{\230\331S\321\304\322X!\266\205\254{\347\025\347\213\331\201[\030\306\213\366o\342\351\362\300=\270\242\277z\371\333A\037\365\205|\376O\r\241\rZ\271\335\2077\265\344s\rA\246\2744\3369\374\312\326E\026\000\210)\201\300\371\327[>\347\231\230\331j[F~\277\232P\274\245\017\230\017[\327U\\>\327\253pn\302%\312\2333\n\303b\303oZa\343\001d\340\021-\201\235\024\002p\025f\316\254\\nth\306\227\337r\007Jt\347\327\3208\014B\263\255F\240lnr\340\230\337\036Cy\220\331\332\276V\314B\241\007\254\237-\300+\023\235\311\022\233\0315\226\311\201\241\016\010\260\205\232}\307\316M\330e5\0045\356\322\212\232G\305'"",1\214b\004\001\367\301\372\234\200\036\250\3412\376\024A\230A\r\271\203\363L\354\014\275\353\354\002\023d\2504\013\211\005\331\241\031\226\034`)]j\025U}r\305\214-$\202\3653\0177x\210Y\257e\343\273\216\356v\010\237\220\262-\217\324\330\3750\007\347\345\236f/\366\022d\032\2233\234 \250\\a\nB\211mm\301\233~\331F\330\353\212\372]\203\0138\305fM\\\333hm\254p\223q\330:\235\035\002\320\264\374SIg49\316\031jvE\324:l3\t\200S\\\371s8R\315\226\240AkoI\024\001\232\340\240\253t\260\335\261bQG\007\353\217\366\200*\247C\261\204\332d\201A\223xsX\347\335hV2P4\347:\312\205J\274\034\275\036\311\270P\200\233.%1-\347\2644\357.5wg\237 A\332\206\264\031 q\034\352N\251\310g\037\036\375\360D\030X1y2\274S\362d\032W\314\026\tp\336Y\374=\233a@Yl\356V\036\220\207\007\363\247\034\270t1\243>\222,[\206\366\217\005\r\252\220\005eY\362 \202\2675\016\003\331\216\254\351\252\206\272\330\\\031\212\344\271{<\301.\355\035-\370E\201E\266NQ\224\230\314\332Xd\205rHfJm\337\345p\3351C\016\232\312\003\021\210\231]]\261\003\224r#\033\216\254\310\363\243K\311\022\016\256\246N\376\252s\335*\340\302q\360\202\024F\200\330\242\352,\373\243dW\353\263\315\353\0210\335\000q\3439\020\023T\330n\230`lq\263\275\354\351\364\264J\034\343\226fi\350\220\326i\250(\221lm\013x\250\315!\004\232\254Arf\2037\014\245YI0\343Q-\214\200\265\361\230/\356\223\002\361\272\020\221\222\003\322\340\010\266\203\"P\300\310\342\023\212\0224~\354 \314\"!T\222\313#Los\326\265\254J\214[\262#\205\221R\034\226\017\310!\301m\320\rl\342lf\215\002Eh\001JPv\343D\273\026\3330\342`\2102ie\245\207vt1Ss\220\02175\260X0\217\007\341[\257\342\273 \026B7\025\315B\370c\013U\327r\272\023\212\210A\255\034\310\252VK\"\034{\250\206fg\036iQUJ\030T\203Qc/ol\340K\327\014\312\353\311jX83k\311\311\206\313$\n\013\020H\311K\327f\024\225KJ\005\001`\233\372j\031\315\355\252\020\342\301\\\220\343\211x\007\036\307\306\370\n\327\213kaK\256++F\353\014\304 (\326f\275(\205\331''\310\024T\337\252\001\020\240\343\014\3035\036\340\226\345@T\306\323c\225E\370p,e\2075lea\003\226\005""\240\3258\212\252\317jwf\2108\305\031\341\206\2304N\320\315m\320\337\321\265\203\206-\362R\303\261\202\325\337W\035:\271\031MjQ\357I\030\244\023EX\266j\212\201\021X\016XB\214\232\272\360\205\362,\032\304\300\017\310\220\270\326O\022\235,\035\014\r\254\202l\017\206\256\3231EI_[\003\307\223>3p&\345\222c\\\030\204\032\026\363\002Q(\225\231|\200\3335\367\263\032\025\000A\231\215\tb\236\232\244@\001\265\261\331\226I\355G6F\341\261\311t\314\007)AC\203|\357o\255|\013Wc&:\010\214(\320M\\[b\244\200\260H\2503\242\245\323S\340\020\331\262(( \265All\345\353\263\027\032\320+\257\006n\3718@\250\214/\243\226\245\000Q\311\267\035f\261\212\252\304\347@\"\027\303\245\264\301\315\302\252\311\230\302\234P\261\222\032udH\021h\212\230@\201P\376\020\250\310R\032\215Y\000ed\301]\302\332\224-]\034wTh\250RM\311\254P\260\220R\301u\327W%\3230JV\026E\254i\274\023\270\232C\274\353\307-0Z\225i\204\231\321\314C\005wTZ[4*\344z-\033\202\240\343\200\366\244W^T\032\211b\361\370\2567\021\246\330\366\336\206\236\331\216\261\231\350\033*c\250\254\334\210.\216\2754 m\333\265`3\026\364\363\222L\243\235<\016S \253\003F=\274\301\307ZF3]\302\235\236\220\272\367\250\312\030\251\274s\272:z(\347\246\256\221\374\324\375Z2\224n\272\337'L\207\306\202\317\247\352<\324\020P\356\212\025o\207\336\211@A\343\302@\272\005\355R\210\023w;_4o`\344\366=\277D\033dO\341\237\220vq\007_\354]\243P\353?o\272Fg\207\333\330\031\201\2306\210:C\231\233\240\007X4\324\004\373(\271X\006\257\010Z\346\311\263pu1\331\247\316\214\352\246\213F\233t\302\016\345o\215\340\221\355R\241\222\210\230\272\313\032\3139CPF\201\000\361\236\332D\177\270\373b\234C\206\270\306J1\304\026\314V\024*\001\312\314C\026\372A\352\305]L\315\355a\277\311\327A\301\242\361\300\306\363_\204D\273]\367\202;o\2019\357\367h7\003\240p:\226\001/\236Q0R\265\365\362\374S!\241\027@\361d\346+\020u\231+\376\205\020~\300\"Y0 \260\002\267*b\260F\235\2302\257\307@\032\207\004\236\255\270`\276\235\004\365r\325\207M\224\006\272\027\241W\325AiT\rl\306.kg:\027\250SX\223\241y[5p\350\003""\327r\243q\004Q@R$\\\320$\325a\231\301\017%g\n\344\305\"a\377\342\356H\247\n\022\033(\352q@"; - PyObject *data = __Pyx_DecompressString(cstring, 2152, 2); + #elif (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (2130 bytes) */ +const char* const cstring = "BZh91AY&SY8\225\262I\000\001\017\177\377\357\377\377\347\377\377\377\377\277\357\377\374\277\377\377\374@@@@@@@@@@@@@\000@\000`\007\373\276a\357{\303\327\275n\201\355\272\342\025JSg\200\357\tMST\203\3244l\232\371p1G\024\3056\3476YL\303'*\314To\254\370\260\201\312\202\260j\035\005\024jV;\263D\034b\306tT\364\352\207L\311\035\212Z\030\362""\355i\260\251\270\232/Z\234\264\000\273\032-\216+\2108\252\213&\211V\325Y7(\212\212\034\244{\0314\350\302*c\026&B}\251\213V\234\231\024\354\250t33\232U\211E\375~\220+\035\224\275hJ'\267\257\021\276f\332\202\316HR\221+\232!(\226%V;f\266+UT!\006:\211_FET@\001\265p\253BI\352F\354\216\023cdg\021\264\235C\223\244r\273\365\3418\337u\2563\014\207g\030\332\350b\000\233H\032\023\001!\356\0354\236jV\267\211\2437-\311\311\245c\223\317\333\322\367\231\213\215x\024\323\221\233\2258@\240\214+\301\313B\304\240\nZP\326j\230\224\260sx\"\027\324G\203}\203s\t\324Re\014\333\364F7\254\330\242\341\240\314\371\t\n*\365\216\036C*\302\3653\222\332O\016c\257\004)\313\026\265$\210\001(o-\326\240\024X\210JR\205\262X\002x\"\250\265M7\202w\024\207v\2359%\224\026j2\204\231\321\272\206\nm\240\254\256hT\310\362\3326\205\001\252\003\326\221M-\220\nQ\nv\257\177\037\n\362\r\231R\226z\033\224\024\200c-\034\247\203$\271P\3069Ii1\002F\255\334\311 W8x\225\030\347\211\302K\322Y04i\014\026\303]\256!ny5\274\305\336v~\255\244m\261z/4\332\343\206\257\311\277\204SA\355\312\014'\254\333\031 TG8a\342:\242\315\240\026\036\004\266Qf\230:\341\013\261?\034\273%|\227X\224\332\353R\230M\340\315\021KJ\237\302\340\252~g?\226,\204L\330\210\031\206\2615&\323n\312\230\333\371[d\262\365S)I&K\036\223*\263\317&\223\234\232V\352\177[\327Y\316\316\255w`\223\273#\342\215\355H\255#'\304B$\260\355\344E\202\"\336\352T\203J\030\r\365{\014\305~\333\264hf\304\261K\277\317\277\257\032\356gOS\231\201\033\365\014m\231\374\245\376'\325\361\341aZ\217\223o\027\006\030\353>\014\307\314\261\261\032{5~\224\2100/\340\301{\205\243[\206\331\250\\,\260\326|]\304\314\034\371\2338\361\323KJ\242\236s\316\226\222\272p\220\301\033+\251\250\200\255$\001\014\201\261\234\216(\216\254\0301\"\273\205s7W\200_\370\273\222)\302\204\201\304\255\222H"; + PyObject *data = __Pyx_DecompressString(cstring, 2130, 2); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif - #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (1975 bytes) */ -const char* const cstring = "x\332\215V\315W\333V\026\217O\230\031hi\023\027\230a\316\311\307sa0$\324\031\006\267\235\246\2449\n\230\324\007\327`C\206\322\346\234w\236\245g[\215,\331z\022\340i\027Y\262\324RK-\265\324RK/\273\324\322K\376\204\374\t\275O\262\345O\222.0\357\335\257w\357}\277\337\273Jg\366\211\254P\t\031\032\"\206A\304:\332\323\311\305\221BT\242#\242\3244]6\352\215I\253\203\377l\037S\242\303\352}F\333\177\306(;a\363R'\315:\222\031R5\003\311\252l\310D\221\377O\245L^=\207\225\204j\241AU\323\033\304@\254IE\271*S\035}\336\327+\262\372\006\034%z\311\215\220J/\215\002\210\236\242\364\r\026\246\362^\365yO]\324TZ\324\014\212\214:\034\274\3336\352\232\312\363\224\250\"W\250N\014\252\264\0213tY4 \0350R\321Q\356\350\213\354\177\263\210\250\022\322\351/T4\030bfET\010c\224!\255\212*\246\254\030\262\212\214v\223\262\014\312WQ[3!\347\250KM\260\033v0\352TE\214\032|\201\322D\205\026\021C\326T\014\356\262ZK#I\326\341\020\371\234r\357}\2420\2329\326L]\244a\n\022epV\350\021u\221\241\206\311\014T'\334\001B2\322\240H\323%\236\277\206D\255\331\216\354\216x]\246h\364\203EW@\341\276\300\262N\242\273\252PH\216(\212&B+$\304[\337\227\016_\343+\225T\2240?\"I\210J5\212\326\315Mt\276\201\236\241\365\201R\324)\204\201N\\\240\010\021\242\246\032DV\341@~)\222\331Td~P&\235\331D\317!\024V\371\335\3602\303\013\203h\222\314x4\032\306L\243j\010\276LM\2545\361.\224\026\206]\337\210\345M\274G\025j\320\034\244\024\213\237B\356\021*\000\246(\315\215\314\346\244'\367\311\253\257\3304\307\260\304\010N\334?\2472S\247\202.\356\222&\021e\243\035\273\360\262\371\345\212=\005\337\203\303Kj\354\313:3\300eJ\364s\252\033\020YV\215^|0/R\271V\257h\372\207\223\t\215/o\010=f\233\207K\234\254\274H/F\366eJ\244\021\301)\320\232\267\005\300\036\301\006\252J\247\373\004'h\244\014\205T\250\222\371\274\257\005\306q\277t\2154\322\031\231E7)\251\032 \271JL\305@\030\353T2E\2121 \"\304\215\252\251_\000\007\317\001n\240\0259\3620n\206O\032\264\364I\325T\224'a\036\231f\373r\207\323U\255\261\020\325\337m\240\013@t\364\034\000|r?\274\310\355\355\027""\204\227\307x\257,\234\036\025\204\242P\036\022\036\276:\311\225'\244\023\202\343\234P\336\375~\377\260\014\257\346T\361\366tqv\037:X\004B\206=\017\1772q\271b\370\372`\334\027\003l\030<\005\343\212\0325\360\005\254\232T\307\300\032\034\221\271\247kbA\2228p\007\373\360Q\036\314\2001E\374\354\217\313\267o\220g\307\3041\353b\311\200q\003Q\217_\261 \346\326\244$\317\301\371B3UiL7)nT\350\320n\234\203\261\006\010q\203\270\317\301\t\331H\366}\341\377B<\017\213\013d\232\264O\325i2\036\270LEx\217G\265\227\343iDa\367hM\247\203Lb\272\016$l\330/\317\306\262\341\314\035\332\014\336\354\321('0D\302n\226)\003\n\346\341\341\251\351\303\275\212\302\346\3252Q\207\032\023>\003\361\016\200Y\21462\213P\211\213\257\n\205b\276P<,\206t\330\023^\024r\305\303\223\303\203\303\003\214\217\332\227\360\267\007\243\025\363\372\313@\177\302\332\252(k\031\350\217f\302X\243L\004\342R,\3034\324\211H+D|\303'\030\326\252\030>-j\3211\224\362\324\367\025Rc\341\n\010\305\253\240\252\250I\260\303US\0251\256M'\016\346yG<\303\003\372L!\316$e&\3112A\223a\202\214Pc\210\024\303\340\237N\204\t\n\364\301?\r\366\023\200\037\205\372\030\310'\340=\016\354Q\370\336\004\346\021\030O\002x\030\272}\320\016\301\265\007\324i\020}\0178\307a\331\007d\017\212\262Z\205\307\026\253\360\332\302 \305\200\311\030U#\370\004\217\006k`\334\200\017\021\370\005\310\360?\314\261\023nM\010\202A\303\003\301/\275\300p\261\270?\317\371>\214\305\027=t\365\277N\341\2608\205xZe\370\264\312\204.M\255\tc\014X\320\203_\313$Jt\312`\004NL\207X@/\371\3220u\225Q\245\032\216\213^\216\260\352\315\322\241!\202\247\014\024\006\205D\215\300\0064\031~\353Q\3271|\212\231\341\314<\207QnR\026~~\0053\313v\342\335\354\255\271\371\253\354\325\257\366\212]\352\316\177fm\332\304nug\227\355Y'\341,:\245\267\002l\202\345Gn\312\315\272-\276\373\030\314\r\353\033[\210\035\272w\277\366Z~\342\032T\337X\273\226n/\332g\216\350&cu\326\023\274\322\273\277\336\232\373\247\375\251C\034\303\335\361\230\237\272)\3303\277\344\223\310\372\023\247\344H\356\246Gn\262\375\316'~k4""\362\215I>\367[\235Dd{\307i\2713n\301O\014lw\354\226\223\210m\205N\262\223\372S\2666sR\316\3265o\322cw\313\335\363\346}\341}\226\037\210\261\345%\275UO\351\254tJQ\224\257\254\005\353\205%\331k\316mp\356\347\307\315R\327\037R/Z\007p\312\214S\360n{_\373+\376i\247\020\034\r\032\362\304my3\236\020|\271\337!\235V\367\356\003~\367o\005^\366<\334d\321Yq\216\3359o\331_\360w\375\026w{d\013\335\273\311\353\260\204K\213\001h\316\234\272K\206U\213\326\017N\322Yu\024o\303\337\351\374\026\034\237\304\260\342\005\r\324+\336\353NrD\007\345\257\273\tw\321\rK_\014\026\243\335k\377^\2474b\270d\235\005\017\376\355\375\305;\366\023\335\207\353\301\372\216\237\353,t\204\356\2772n\303\377\262s\273\263\325}\3648\352\364 \357mo\313\023\336}tk\356\201\375\332\375\207\227\360\222\335\331UG\340)\347\355\222-9\233\356/\376\307\235\235\337[q\2078\354\267z\251m\270Iw\325\345HL\256\205P\333\352e\271\326\003\336o\235\255\221,\347\272\363\237^\211\326b\260\224v\230\233\352.\255\r#\024\034\243\210J\360\264\360{!\370\361,>5\331\275\373\231\225\262\372\007\367\256\351-dz\337\376\331\375\033l\023q\346\337\003\304O\234{\356O\023\307\303\001\351\036t\347\2415\243\231}r\347\212Y\253\301\337\327A/\304\2734\257\252\273\224\202\033J\215\332\255\001\rS|\247G\365\204v\017\372\361\356\000\236\277\265E'\3716\321\235\371\350\352\261U\nf\356\003\363f\277\002$\247:Y\000\027\334\3053\373\266\035\246\370\030\272M\256g\037\332\246\023B\374\251ul'\206\024\374\0319\340\234\350.\335\347\022\273\355\302\343\222\264\356Cs\340\337C\007vw\256Z\301\314Yp\366S\330\"\376\300\234\370\367\202\334ip*\006\242\024\314\000t\272\263)g\311\t\343}k\275q\026\340\260^\274_\241\226\331\005\353\031P\003\232\270`=\207\243\242\210\217\270f\331\236\353a4\365\007\265\232\243E"; - PyObject *data = __Pyx_DecompressString(cstring, 1975, 1); + #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (1959 bytes) */ +const char* const cstring = "x\332\215V\315W\333V\026\217O\230\031\323\320&.0\303\234\223\217\347\302\304\220Pg\030h;MIs\0240\251\017\256\001C\206\322\346\234w\036\322\263\255F\226l=\t\360\264\213,Yj\251\245\226Zj\251\245\226]z\351%\177B\376\204\336'\311\362'I\026\230w?\337\275\367\375~\357)\227\337!\262B%dh\210\030\006\021\353h['\347\373\nQ\211\216\210R\323t\331\2507\306\275v\377\263~H\211\016\253\3679\255\177\214\323\306\230\317K\2354\353HfH\325\014$\253\262!\023E\376?\225\362E\365\014V\022\252\205\016UMo\020\003\261&\025\345\252Lu\364E\317\256\310\352\033\010\224\350\005wB&\227\237\242\3345\346\263\330\\\326TZ\326\014\212\214:\244\335j\033uM\345UHT\221O\251N\014\252\264\0213tY4`3pR\321~a\377\313\215\377n \242JH\247\277R\321`\210\231\247\242B\030\243\014iUtj\312\212!\253\310h7)\313\243b\025\2655\023\2514\232A\023\374\006\003\214:U\021\243\006_\240\034Qa\000\304\2205\025C\270\254\326rH\222u\330D>\243\227_E\317!\025V\371\331\3606\303\003\203l\222\314x6\032\346\314\241j\010\255|M\2545\361\026\264\026\246]^I\364M\274M\025j\320\002\224\224\250\237B\355\021*\000\204(\307\235\314\346x$\217)\252\257\330\244\300\260\305\010N<\276\2402S\247\202.n\221&\021e\243\235\204\360\266\371\341\212\261\201\313\020\360\222\032;\262\316\014\010\231\220\375\214\352\006d\226U#\316\017\356e*\327\352\247\232\376\341bB\347\213kR\217\370\026\341\020\307;/\323\363!\271B\2114\2448\006\322\362\261\000\330#\330@W\271\\\217\276\004\r\265\241\220S\252\344\277\350Y\201q<.W#\215\\^f\321IJ\252\006H\256\022S1\020\306:\225L\221b\014\210\010q\243j\352\227\300\3013\200\033XE\216<\214\233\341\205\005#}R5\025\345IXG\276\331\276\330\344tUk,D\365\367+\350\034\020\035]\007\000\237\302\217/\n\333;%\341\345!\336\256\010""\307\373%\241,T\006\224{\257\216\n\2251\355\230\342\260 T\266~\330\331\253\300\2358Q\275>Y\275\261\003\023,\003!\303\231\207?\371\244]1\274}0\356\251\0016\014\256\202QC\215\032\370\034VM\252c`\r\216\310\034\333\232X\220$\016\334\276\034^\271\375\033~\304\220\\\352\243\372\365k\364\033#\352\204u\211\246\317\270\276*\346W\242\340VA\327I\373\020\356\217!m\310\270q\315\004\347\306)\225\372\322(\003\023\013\320\341\032u\217\201c\272\241\332{\312\377\205h\036T\227\310$myH\210Y;I\307w\251P\021\256\346a\353\305hM\321\036\333\264\246\323~Y\ts\373\0326\030Wd#\245q\022\017\010\375\353{8\313\021\274'\341h+\224\001\033\213p\007\325\364\301\301Ei\213j\205\250p\206L\244\252\004tK\314\341\325\020I2\213\300\211\313\257J\245r\261T\336+\207\254\330\026^\224\n\345\275\243\275\335\275]\214\367\333\027\360\267\r/,\346\275W\340\026 \254\255\212\262\226\207\331h&\274n\224\211\300_\212ex\024u\"\322S\"\276\341\017\031\326\252\030\276\037j\3216\224\362\262w\024Rc\341\nx\305;\240\252\250I \341\252\251\212\030\327&\363\007\014=\272\341>\213&\360g\2349\343\234\031c\313 O\206\0302\300\215QV\014\242\177\"\023z\034\230\204\3761\334\017#~\004\353c(\037\305w\014\315a\374^\207\346!\034\217#x\020\273=\324\016\3405F\352$\214\276\007\235\327\342\262\207HY\255\302\325\213U\270{\341Y\305\000\315\004\\C0\005\327\006k`\334\200\317\022\370\005\344\360?\314!\024\212&$\301`\341\211\340\227\236c8_\334{\335\271\034\346\342\213\030d\260I\262u\362f\345\371\233\225\017]\233Z\023\0363 A\214\276\226I\224({\377!\034{#\022\005\275\340K\303\324UF\225j\370h\304\265\301*~Q\007\236\022<\341Ya\320@4\000l\300x\341\267\036\315\033\303\007\231\031\276\234g\360\240\233\224\205\037a\235\251\005;\365.}cz\346r\343\3627{\321>\350\316|n\255\332\304n]\245\027\354\264\223r\346\234\203\267B7\275\320Yx\344f\335\r\267\305\245[\340nX\337\332B\022\320\275\363\215\327\362S\357\376zc\372\237\366g\016q\014w\323\273\326\367\231\177\340\223\310\367S\347\300\221\334U\217\\\347\373\275O\374\326G\346}\356\267\202\270\206\333N\313\235rK~\252\357""\273i\267\234T\342+\004\231 \373Q\2766s\262\316\332\025\237\301cw\315\335\366f|\341}\236\037\310\261\346e\274%O\t\026\203\203(\313\327\326\254\365\302\222\354\207\316M\010\356\325\307\335\262W\0372\317Y\273\260\313\224S\362nz\337\370\213\376qP\352\354\367\007\362\304myS\236\320\371j' A\253{\347>?\332\267\002o{\346\362[\253\354,:\207\356\264\267\340\317\372[~\213\207=\262\205\356\235\314U\330\302\205\305\000\023'N\335%\203\2469\353G'\343,9\212\267\342o\006\277w\016\217\022\324\360\206\372\346E\357u\220\031\262A\373\313n\312\235s\303\326\347:s\221\364\332\277\033\034\0149\316['\235\373\377\366\376\342\035\372\251\356\203\345\316\362\246_\010f\003\241\373\257\274\333\360\277\nn\006k\335G\217\243I\367\353^\367\326<\341\335'7\246\357\333\257\335\177x)/\323M/9\002/\271h\037\330\222\263\352\376\352\337\n6\377h%\023\342\250^\213K[q3\356\222Kb)\357\022\327\360\270-\3630\004\336Z\\\363\303\030\206\277\007kC5Owg>\273\024\255\271\316|\316an\266;\037M\277\024\244\342\300(\277\322yZ\372\243\324\371\351$\251!\323\275\363\271\225\265 \377U\372\236\375\213\3737\210K%\225\377\000\020?r\356\272?\217m\010)s1tg`4\303\265|z\373\222YK\235\277/\203]H\244\034\357\243;\237\215O(;\354\373\020\250\230\345\222\316\273\210\244y\216\031\303\331\214\230\177\033p\375\235-:\231\267\251\356\324'\227\217\255\203\316\324=``\372k@t6\330\000\220\301\231<\263o\332a\251\217a\352\344*\375\3006\235\020\352O\255C;5`\270\005 \334\345\334\350\316\337\343\032\273\355\246\256\322\031\353\036\214\005\376=p@\272}\331\352L\235tN~\016Oe\303\023\274#\377n\247p\3349\026;\242\324\231\002\010u\323Yg\336\t\363}g\275qfa\2638\337o\320Az\326z\006\024\201a\316Z\317a\253(\343#nY\260\247{\223\370\023\231\316\217_"; + PyObject *data = __Pyx_DecompressString(cstring, 1959, 1); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif - #else /* compression: none (4481 bytes) */ -const char* const bytes = "'.Failed to attach DrawPlanar algorithm.Failed to attach K23Search algorithm.Failed to attach K33Search algorithm.Failed to attach K4Search algorithm.Graph is not initialized.Invalid graph format specifier \"Invalid link index for nextLink: 'Invalid link index for ulink: 'Invalid link index for vlink: 'NoneNote that Cython is deliberately stricter than PEP-484 and rejects subclasses of builtin types. If you need to pass subclasses then set the 'annotation_typing' directive to False.Source and destination graphs must have the same order to copy graphP struct.Source graph either has not been allocated or not been initialized.Unable to add edge (u, v) = (Unable to create new Graph container for duplicate.'., ?add_note and vlink = disableenable' failed.gcgp_CopyGraph() failed.gp_DeleteEdge() failed: invalid arc 'gp_DupGraph() failed.gp_EdgeInUse() failed: invalid edge index 'gp_EnsureArcCapacity() failed to set capacity to gp_GetFirstArc() failed: invalid vertex intex 'gp_GetNeighbor() failed: invalid edge index 'gp_GetNextArc() failed: invalid edge index 'gp_InitGraph() failed.gp_New() failed.gp_Read() failed.gp_Write() of graph to '' is not a valid vertex label.\" is not one of 'gam'.isenabledno default __reduce__ due to non-trivial __cinit__planarity/full/graph.pyx) with ulink = EMBEDFLAGS_DRAWPLANAREMBEDFLAGS_OUTERPLANAREMBEDFLAGS_PLANAREMBEDFLAGS_SEARCHFORK23EMBEDFLAGS_SEARCHFORK33EMBEDFLAGS_SEARCHFORK4FileNameGraphGraph.__reduce_cython__Graph.__setstate_cython__Graph.get_wrapper_for_graphPGraph.gp_AddEdgeGraph.gp_AttachDrawPlanarGraph.gp_AttachK23SearchGraph.gp_AttachK33SearchGraph.gp_AttachK4SearchGraph.gp_CopyGraphGraph.gp_DeleteEdgeGraph.gp_DupGraphGraph.gp_EdgeInUseGraph.gp_EdgeInUseIndexBoundGraph.gp_EdgeIndexBoundGraph.gp_EmbedGraph.gp_EnsureArcCapacityGraph.gp_GetArcCapacityGraph.gp_GetFirstArcGraph.gp_GetFirstEdgeGraph.gp_GetFirstVertexGraph.gp_GetLastVertexGraph.gp_GetNeighborGraph.gp_GetNeighborEdgeRecordGraph.gp_GetNextArcGraph.gp_GetVerte""xDegreeGraph.gp_InitGraphGraph.gp_IsArcGraph.gp_IsVertexGraph.gp_ReadGraph.gp_ReinitializeGraphGraph.gp_TestEmbedResultIntegrityGraph.gp_VertexInRangeGraph.gp_WriteGraph.gp_getNGraph.is_graph_NULLNILNONEMBEDDABLENOTOKOK__Pyx_PyDict_NextRefaasyncio.coroutinescline_in_tracebackcopy_of_orig_grapheembedFlagsembed_resultencoded__func__gget_wrapper_for_graphP__getstate__gp_AddEdgegp_AttachDrawPlanargp_AttachK23Searchgp_AttachK33Searchgp_AttachK4Searchgp_CopyGraphgp_DeleteEdgegp_DupGraphgp_EdgeInUsegp_EdgeInUseIndexBoundgp_EdgeIndexBoundgp_Embedgp_EnsureArcCapacitygp_GetArcCapacitygp_GetFirstArcgp_GetFirstEdgegp_GetFirstVertexgp_GetLastVertexgp_GetNeighborgp_GetNeighborEdgeRecordgp_GetNextArcgp_GetVertexDegreegp_InitGraphgp_IsArcgp_IsVertexgp_Readgp_ReinitializeGraphgp_TestEmbedResultIntegritygp_VertexInRangegp_Writegp_getNinfile_nameint_is_coroutineis_graph_NULLitemsm__main__modemode_code__module__n__name__new_arc_capacitynew_graphnew_wrappernextLinkoutfile_nameplanarity.full.graphpop__pyx_state__qualname____reduce____reduce_cython____reduce_ex__returnself__set_name__setdefault__setstate____setstate_cython__src_graph__test__theGraph_dupuulinkvvaluesvlink\320\004\030\230\001\360\010\000\t\014\2104\210{\230#\230Q\330\014\022\220,\230a\230q\330\010\030\230\010\240\001\240\024\240Q\200A\330\010\030\320\030*\250!\2504\250q\200A\330\010\013\2104\210t\2209\230A\230Q\330\014\022\220,\230a\330\0207\260q\270\001\340\010\013\2109\220C\220r\230\024\230Y\240c\250\021\330\014\022\220,\230a\330\0204\260A\260Q\360\006\000\t\031\230\016\240a\240t\250<\260s\270!\200A\330\010\013\2104\210t\2209\230A\230Q\330\014\022\220,\230a\330\020=\270Q\270a\360\006\000\t\031\230\r\240Q\240d\250,\260a\200A\330\010\013\2104\210t\2209\230A\230Q\330\014\022\220,\230a\330\020>\270a\270q\360\006\000\t\031\230\016\240a\240t\250<\260q\200A\330\010\013\2104\210t\2209\230A\230Q\330\014\022\220,\230a\330\020?\270q\300\001\360\006\000\t\031\230\017\240q\250\004\250L\270\001\200A\330\010\013\2104\210t\220<\230q\240""\001\330\014\022\220,\230a\330\020A\300\021\300!\360\006\000\t\031\230\017\240q\250\004\250L\270\001\200A\330\010\013\2104\210t\220<\230q\240\001\330\014\022\220,\230a\230s\240!\2401\340\010\030\320\030+\2501\250D\260\014\270A\200A\330\010\013\2104\210t\220<\230q\240\001\330\014\022\220,\230a\230s\240!\2401\330\010\013\2104\210t\220<\230q\240\001\330\014\022\220,\230a\230s\240!\2401\340\010\030\320\0301\260\021\260$\260l\300#\300Q\200A\330\010\013\2106\220\023\220B\220d\230&\240\003\2401\330\014\022\220,\230a\330\0201\260\021\260!\340\010\013\2106\220\023\220B\220d\230&\240\003\2401\330\014\022\220,\230a\330\0201\260\021\260!\340\010\024\220K\230q\240\004\240L\260\003\2607\270#\270W\300L\320PQ\330\014\022\220,\230a\330\020/\250q\260\004\260A\3205F\300a\300q\330\020\036\230a\230q\200A\360\006\000\t\014\2109\220N\240#\240S\250\t\260\030\270\023\270C\270q\330\014\022\220*\230A\330\020\021\340\010\013\2104\210x\220s\230#\230Y\240h\250a\330\014\022\220*\230A\330\020\021\340\010\024\220M\240\021\240$\240l\260)\270<\300|\320ST\330\014\022\220,\230a\230q\200A\330\010\024\220M\240\021\240$\240l\260#\260\\\300\021\330\014\022\220,\230a\230q\200A\330\010\030\320\030(\250\001\250\024\250Q\200A\330\010\024\320\024(\250\001\250\024\250\\\270\034\300Q\330\014\022\220,\230a\230q\200A\330\010\025\220Y\320\0360\260\005\260S\270\001\330\037(\320(<\270E\300\023\300A\330%.\250m\2705\300\003\3001\330*+\330\010\013\2104\210q\330\014\022\220*\230A\330\0203\2601\260A\360\n\000\t\036\230\\\250\027\260\001\260\021\330\010$\240A\340\010\024\220I\230Q\230d\240,\250j\270\013\300<\310q\330\014\022\220,\230a\330\020*\250!\2501\200A\330\010\030\320\030)\250\021\250$\250a\200A\330\021&\240a\240t\2501\200A\330\010\024\320\024&\240a\240t\250<\260|\3001\330\014\022\220,\230a\230q\200A\330\010\t\330\014\016\210c\220\024\320\025'\240s\250!\330\025&\240a\240t\250<\260q\200A\330\010\024\320\024)\250\021\250$\250l\320:L\310L\320XY\330\014\022\220,\230a\330\020\021\330\020\022\220!\2201\200A\330\010\030\320""\030/\250q\260\004\260A\200A\340\010\035\230[\250\007\250q\260\001\330\010$\240A\340\010\024\220H\230A\230T\240\034\250Z\260|\3001\330\014\022\220,\230a\230q\200A\330\010\024\320\024'\240q\250\004\250L\270\014\300A\330\014\022\220,\230a\230q\200A\330\010\t\330\r\017\210s\220$\320\026(\250\004\250A\330\r\017\210s\220$\320\026'\240t\2501\330\025!\240\021\240!\200A\330\010\t\330\r\017\210s\220$\320\026&\240d\250!\330\r\017\210r\220\024\320\025'\240t\2501\330\025\036\230a\230q\200A\330\010\017\210t\220;\230c\240\021\200\001\330\004\n\210+\220Q\320\004\035\230Q\330\0106\260l\300!\3004\300q\330\010\013\210=\230\003\2301\330\014\022\220+\230Q\230a\340\010\037\230u\240A\330\010\013\210:\220S\230\001\330\014\022\220+\230Q\230a\340\010\013\2109\220K\230s\240!\330\025\035\230Q\230a\230y\250\001\340\010\021\220\035\230a\330\010\021\220\037\240\001\340\010\017\210q\320\004Y\320YZ\330\010\030\320\0304\260A\260T\270\034\320EW\320Wc\320cd\320\004(\250\001\330\010!\240\025\240a\340\010\013\210;\220k\240\023\240A\330\025\035\230Q\230a\230{\250!\330\010\023\220=\240\004\240A\340\010\023\220?\240!\330\010\017\210q\320\004*\250!\330\010\030\230\t\240\021\240$\240l\260!"; + #else /* compression: none (4428 bytes) */ +const char* const bytes = "'.Failed to attach DrawPlanar algorithm.Failed to attach K23Search algorithm.Failed to attach K33Search algorithm.Failed to attach K4Search algorithm.Graph is not initialized.Invalid graph format specifier \"Invalid link index for ulink: 'Invalid link index for vlink: 'NoneNote that Cython is deliberately stricter than PEP-484 and rejects subclasses of builtin types. If you need to pass subclasses then set the 'annotation_typing' directive to False.Source and destination graphs must have the same order to copy graphP struct.Source graph either has not been allocated or not been initialized.Unable to add edge (u, v) = (Unable to create new Graph container for duplicate.'., ?add_note and vlink = disableenable' failed.gcgp_CopyGraph() failed.gp_DeleteEdge() failed: invalid arc 'gp_DupGraph() failed.gp_EdgeInUse() failed: invalid edge index 'gp_EnsureArcCapacity() failed to set capacity to gp_GetFirstArc() failed: invalid vertex intex 'gp_GetNeighbor() failed: invalid edge index 'gp_GetNextArc() failed: invalid edge index 'gp_InitGraph() failed.gp_New() failed.gp_Read() failed.gp_Write() of graph to '' is not a valid vertex label.\" is not one of 'gam'.isenabledno default __reduce__ due to non-trivial __cinit__planarity/full/graph.pyx) with ulink = EMBEDFLAGS_DRAWPLANAREMBEDFLAGS_OUTERPLANAREMBEDFLAGS_PLANAREMBEDFLAGS_SEARCHFORK23EMBEDFLAGS_SEARCHFORK33EMBEDFLAGS_SEARCHFORK4FileNameGraphGraph.__reduce_cython__Graph.__setstate_cython__Graph.get_wrapper_for_graphPGraph.gp_AddEdgeGraph.gp_AttachDrawPlanarGraph.gp_AttachK23SearchGraph.gp_AttachK33SearchGraph.gp_AttachK4SearchGraph.gp_CopyGraphGraph.gp_DeleteEdgeGraph.gp_DupGraphGraph.gp_EdgeArraySizeGraph.gp_EdgeInUseGraph.gp_EdgeInUseArraySizeGraph.gp_EmbedGraph.gp_EnsureArcCapacityGraph.gp_GetArcCapacityGraph.gp_GetFirstArcGraph.gp_GetFirstEdgeGraph.gp_GetFirstVertexGraph.gp_GetLastVertexGraph.gp_GetNGraph.gp_GetNeighborGraph.gp_GetNeighborEdgeRecordGraph.gp_GetNextArcGraph.gp_GetVertexDegreeGraph.gp_InitGra""phGraph.gp_IsArcGraph.gp_IsVertexGraph.gp_ReadGraph.gp_ReinitializeGraphGraph.gp_TestEmbedResultIntegrityGraph.gp_VertexInRangeAscendingGraph.gp_WriteGraph.is_graph_NULLNILNONEMBEDDABLENOTOKOK__Pyx_PyDict_NextRefaasyncio.coroutinescline_in_tracebackcopy_of_orig_grapheembedFlagsembed_resultencoded__func__gget_wrapper_for_graphP__getstate__gp_AddEdgegp_AttachDrawPlanargp_AttachK23Searchgp_AttachK33Searchgp_AttachK4Searchgp_CopyGraphgp_DeleteEdgegp_DupGraphgp_EdgeArraySizegp_EdgeInUsegp_EdgeInUseArraySizegp_Embedgp_EnsureArcCapacitygp_GetArcCapacitygp_GetFirstArcgp_GetFirstEdgegp_GetFirstVertexgp_GetLastVertexgp_GetNgp_GetNeighborgp_GetNeighborEdgeRecordgp_GetNextArcgp_GetVertexDegreegp_InitGraphgp_IsArcgp_IsVertexgp_Readgp_ReinitializeGraphgp_TestEmbedResultIntegritygp_VertexInRangeAscendinggp_Writeinfile_nameint_is_coroutineis_graph_NULLitemsm__main__modemode_code__module__n__name__new_arc_capacitynew_graphnew_wrapperoutfile_nameplanarity.full.graphpop__pyx_state__qualname____reduce____reduce_cython____reduce_ex__returnself__set_name__setdefault__setstate____setstate_cython__src_graph__test__theGraph_dupuulinkvvaluesvlink\320\004\030\230\001\360\010\000\t\014\2104\210{\230#\230Q\330\014\022\220,\230a\230q\340\010\030\230\010\240\001\240\024\240Q\200A\330\010\030\320\030*\250!\2504\250q\200A\330\010\013\2104\210t\2209\230A\230Q\330\014\022\220,\230a\330\0207\260q\270\001\360\006\000\t\031\230\016\240a\240t\250<\260q\200A\330\010\013\2104\210t\2209\230A\230Q\330\014\022\220,\230a\330\020=\270Q\270a\360\006\000\t\031\230\r\240Q\240d\250,\260a\200A\330\010\013\2104\210t\2209\230A\230Q\330\014\022\220,\230a\330\020>\270a\270q\360\006\000\t\031\230\016\240a\240t\250<\260q\200A\330\010\013\2104\210t\2209\230A\230Q\330\014\022\220,\230a\330\020?\270q\300\001\360\006\000\t\031\230\017\240q\250\004\250L\270\001\200A\330\010\013\2104\210t\220<\230q\240\001\330\014\022\220,\230a\330\020A\300\021\300!\360\006\000\t\031\230\017\240q\250\004\250L\270\001\200A\330\010\013\2104\210t""\220<\230q\240\001\330\014\022\220,\230a\230s\240!\2401\340\010\030\320\030+\2501\250D\260\014\270A\200A\330\010\013\2104\210t\220<\230q\240\001\330\014\022\220,\230a\230s\240!\2401\330\010\013\2104\210t\220<\230q\240\001\330\014\022\220,\230a\230s\240!\2401\340\010\030\320\0301\260\021\260$\260l\300#\300Q\200A\330\010\013\2106\220\023\220B\220d\230&\240\003\2401\330\014\022\220,\230a\330\0201\260\021\260!\340\010\013\2106\220\023\220B\220d\230&\240\003\2401\330\014\022\220,\230a\330\0201\260\021\260!\340\010\024\220K\230q\240\004\240L\260\003\2607\270#\270W\300L\320PQ\330\014\022\220,\230a\330\020/\250q\260\004\260A\3205F\300a\300q\330\020\036\230a\230q\200A\360\006\000\t\014\2109\220N\240#\240S\250\t\260\030\270\023\270C\270q\330\014\022\220*\230A\330\020\021\340\010\013\2104\210x\220s\230#\230Y\240h\250a\330\014\022\220*\230A\330\020\021\340\010\024\220M\240\021\240$\240l\260)\270<\300|\320ST\330\014\022\220,\230a\230q\200A\330\010\024\220M\240\021\240$\240l\260#\260\\\300\021\330\014\022\220,\230a\230q\200A\330\010\030\320\030(\250\001\250\024\250Q\200A\330\010\024\320\024(\250\001\250\024\250\\\270\034\300Q\330\014\022\220,\230a\230q\200A\330\010\025\220Y\320\0360\260\005\260S\270\001\330\037(\320(<\270E\300\023\300A\330%.\250m\2705\300\003\3001\330*+\330\010\013\2104\210q\330\014\022\220*\230A\330\0203\2601\260A\360\n\000\t\036\230\\\250\027\260\001\260\021\330\010$\240A\340\010\024\220I\230Q\230d\240,\250j\270\013\300<\310q\330\014\022\220,\230a\330\020*\250!\2501\200A\330\010\030\320\030)\250\021\250$\250a\200A\330\010\030\320\030.\250a\250t\2601\200A\330\021&\240a\240t\2501\200A\330\010\024\320\024&\240a\240t\250<\260|\3001\330\014\022\220,\230a\230q\200A\330\010\t\330\014\016\210c\220\024\320\025'\240s\250!\330\025/\250q\260\004\260L\300\001\200A\330\010\024\320\024)\250\021\250$\250l\320:L\310L\320XY\330\014\022\220,\230a\330\020\021\330\020\022\220!\2201\200A\340\010\035\230[\250\007\250q\260\001\330\010$\240A\340\010\024\220H\230A\230T\240\034\250Z\260|""\3001\330\014\022\220,\230a\230q\200A\330\010\024\320\024'\240q\250\004\250L\270\014\300A\330\014\022\220,\230a\230q\200A\330\010\t\330\r\017\210s\220$\320\026(\250\004\250A\330\r\017\210s\220$\320\026'\240t\2501\330\025!\240\021\240$\240l\260!\200A\330\010\t\330\r\017\210s\220$\320\026&\240d\250!\330\r\017\210r\220\024\320\025&\240d\250!\330\025\036\230a\230t\240<\250q\200A\330\010\017\210t\220;\230c\240\021\200\001\330\004\n\210+\220Q\320\004\035\230Q\330\0106\260l\300!\3004\300q\330\010\013\210=\230\003\2301\330\014\022\220+\230Q\230a\340\010\037\230u\240A\330\010\013\210:\220S\230\001\330\014\022\220+\230Q\230a\340\010\013\2109\220K\230s\240!\330\025\035\230Q\230a\230y\250\001\340\010\021\220\035\230a\330\010\021\220\037\240\001\340\010\017\210q\320\004Y\320YZ\330\010\030\320\0304\260A\260T\270\034\320EW\320Wc\320cd\320\004(\250\001\330\010!\240\025\240a\340\010\013\210;\220k\240\023\240A\330\025\035\230Q\230a\230{\250!\330\010\023\220=\240\004\240A\340\010\023\220?\240!\330\010\017\210q\320\004*\250!\330\010\030\230\t\240\021\240$\240l\260!"; PyObject *data = NULL; CYTHON_UNUSED_VAR(__Pyx_DecompressString); #endif PyObject **stringtab = __pyx_mstate->__pyx_string_tab; Py_ssize_t pos = 0; - for (int i = 0; i < 174; i++) { + for (int i = 0; i < 172; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); - if (likely(string) && i >= 45) PyUnicode_InternInPlace(&string); + if (likely(string) && i >= 44) PyUnicode_InternInPlace(&string); if (unlikely(!string)) { Py_XDECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) @@ -10439,7 +10364,7 @@ const char* const bytes = "'.Failed to attach DrawPlanar algorithm.Failed to att stringtab[i] = string; pos += bytes_length; } - for (int i = 174; i < 205; i++) { + for (int i = 172; i < 203; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length); stringtab[i] = string; @@ -10450,14 +10375,14 @@ const char* const bytes = "'.Failed to attach DrawPlanar algorithm.Failed to att } } Py_XDECREF(data); - for (Py_ssize_t i = 0; i < 205; i++) { + for (Py_ssize_t i = 0; i < 203; i++) { if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { __PYX_ERR(0, 1, __pyx_L1_error) } } #if CYTHON_IMMORTAL_CONSTANTS { - PyObject **table = stringtab + 174; + PyObject **table = stringtab + 172; for (Py_ssize_t i=0; i<31; ++i) { #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #if PY_VERSION_HEX < 0x030E0000 @@ -10542,7 +10467,7 @@ static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 51}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; - __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_IsArc, __pyx_mstate->__pyx_kp_b_iso88591_A_s_d_r_t1_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_IsArc, __pyx_mstate->__pyx_kp_b_iso88591_A_s_d_r_d_at_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 58}; @@ -10557,12 +10482,12 @@ static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 69}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; - __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_EdgeIndexBound, __pyx_mstate->__pyx_kp_b_iso88591_A_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_EdgeArraySize, __pyx_mstate->__pyx_kp_b_iso88591_A_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 72}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; - __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_EdgeInUseIndexBound, __pyx_mstate->__pyx_kp_b_iso88591_A_q_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_EdgeInUseArraySize, __pyx_mstate->__pyx_kp_b_iso88591_A_at1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 75}; @@ -10582,7 +10507,7 @@ static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 99}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; - __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_IsVertex, __pyx_mstate->__pyx_kp_b_iso88591_A_s_A_s_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_IsVertex, __pyx_mstate->__pyx_kp_b_iso88591_A_s_A_s_t1_l, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 106}; @@ -10597,100 +10522,100 @@ static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 112}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; - __pyx_mstate_global->__pyx_codeobj_tab[13] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_VertexInRange, __pyx_mstate->__pyx_kp_b_iso88591_A_c_s_at_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[13])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[13] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_VertexInRangeAscending, __pyx_mstate->__pyx_kp_b_iso88591_A_c_s_q_L, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[13])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 118}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; - __pyx_mstate_global->__pyx_codeobj_tab[14] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_getN, __pyx_mstate->__pyx_kp_b_iso88591_4_Q_aq_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[14])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[14] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetN, __pyx_mstate->__pyx_kp_b_iso88591_4_Q_aq_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[14])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 126}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 127}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_n}; __pyx_mstate_global->__pyx_codeobj_tab[15] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_InitGraph, __pyx_mstate->__pyx_kp_b_iso88591_A_M_l_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[15])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 130}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 131}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; - __pyx_mstate_global->__pyx_codeobj_tab[16] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ReinitializeGraph, __pyx_mstate->__pyx_kp_b_iso88591_A_at1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[16])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[16] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ReinitializeGraph, __pyx_mstate->__pyx_kp_b_iso88591_A_at1_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[16])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 133}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 134}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_src_graph}; __pyx_mstate_global->__pyx_codeobj_tab[17] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_CopyGraph, __pyx_mstate->__pyx_kp_b_iso88591_A_9N_S_Cq_A_4xs_Yha_A_M_l_ST_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[17])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 147}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 148}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_theGraph_dup, __pyx_mstate->__pyx_n_u_new_graph}; __pyx_mstate_global->__pyx_codeobj_tab[18] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_DupGraph, __pyx_mstate->__pyx_kp_b_iso88591_Q_6l_4q_1_Qa_uA_S_Qa_9Ks_Qay_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[18])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 164}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 165}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_infile_name, __pyx_mstate->__pyx_n_u_encoded, __pyx_mstate->__pyx_n_u_FileName}; __pyx_mstate_global->__pyx_codeobj_tab[19] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_Read, __pyx_mstate->__pyx_kp_b_iso88591_A_q_A_HAT_Z_1_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[19])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 172}; + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 173}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_outfile_name, __pyx_mstate->__pyx_n_u_mode, __pyx_mstate->__pyx_n_u_mode_code, __pyx_mstate->__pyx_n_u_encoded, __pyx_mstate->__pyx_n_u_FileName}; __pyx_mstate_global->__pyx_codeobj_tab[20] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_Write, __pyx_mstate->__pyx_kp_b_iso88591_A_Y_0_S_E_A_m5_1_4q_A_31A_A_IQd, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[20])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 192}; + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 193}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_u, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[21] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetNeighborEdgeRecord, __pyx_mstate->__pyx_kp_b_iso88591_A_4t_q_as_1_4t_q_as_1_1_l_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[21])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 200}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 201}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[22] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetVertexDegree, __pyx_mstate->__pyx_kp_b_iso88591_A_4t_q_as_1_1D_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[22])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 206}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 207}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[23] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetArcCapacity, __pyx_mstate->__pyx_kp_b_iso88591_A_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[23])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 209}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 210}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_new_arc_capacity}; __pyx_mstate_global->__pyx_codeobj_tab[24] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_EnsureArcCapacity, __pyx_mstate->__pyx_kp_b_iso88591_A_l_LLXY_a_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[24])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 215}; + const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 216}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_u, __pyx_mstate->__pyx_n_u_ulink, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_vlink}; __pyx_mstate_global->__pyx_codeobj_tab[25] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_AddEdge, __pyx_mstate->__pyx_kp_b_iso88591_A_6_Bd_1_a_1_6_Bd_1_a_1_Kq_L_7_W, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[25])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 230}; - PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e, __pyx_mstate->__pyx_n_u_nextLink}; - __pyx_mstate_global->__pyx_codeobj_tab[26] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_DeleteEdge, __pyx_mstate->__pyx_kp_b_iso88591_A_4t9AQ_a_7q_9Cr_Yc_a_4AQ_at_s, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[26])) goto bad; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 231}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; + __pyx_mstate_global->__pyx_codeobj_tab[26] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_DeleteEdge, __pyx_mstate->__pyx_kp_b_iso88591_A_4t9AQ_a_7q_at_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[26])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 242}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 239}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[27] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_AttachDrawPlanar, __pyx_mstate->__pyx_kp_b_iso88591_A_Q_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[27])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 246}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 243}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[28] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_AttachK23Search, __pyx_mstate->__pyx_kp_b_iso88591_A_q_L_A_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[28])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 250}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 247}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[29] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_AttachK33Search, __pyx_mstate->__pyx_kp_b_iso88591_A_q_L_A_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[29])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 254}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 251}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[30] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_AttachK4Search, __pyx_mstate->__pyx_kp_b_iso88591_A_at_1_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[30])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 258}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 255}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_embedFlags}; __pyx_mstate_global->__pyx_codeobj_tab[31] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_Embed, __pyx_mstate->__pyx_kp_b_iso88591_l, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[31])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 261}; + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 258}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_copy_of_orig_graph, __pyx_mstate->__pyx_n_u_embed_result}; __pyx_mstate_global->__pyx_codeobj_tab[32] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_TestEmbedResultIntegrity, __pyx_mstate->__pyx_kp_b_iso88591_YYZ_4AT_EWWccd, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[32])) goto bad; } diff --git a/planarity/full/graph.pyx b/planarity/full/graph.pyx index 55c8fac..7e1707c 100644 --- a/planarity/full/graph.pyx +++ b/planarity/full/graph.pyx @@ -51,8 +51,8 @@ cdef class Graph: def gp_IsArc(self, int e): return ( (e >= self.gp_GetFirstEdge()) and - (e < self.gp_EdgeIndexBound()) and - cgraphLib.gp_IsArc(e) + (e < self.gp_EdgeArraySize()) and + cgraphLib.gp_IsArc(self._theGraph, e) ) def gp_GetFirstEdge(self): @@ -66,11 +66,11 @@ cdef class Graph: return cgraphLib.gp_EdgeInUse(self._theGraph, e) - def gp_EdgeIndexBound(self): - return cgraphLib.gp_EdgeIndexBound(self._theGraph) + def gp_EdgeArraySize(self): + return cgraphLib.gp_EdgeArraySize(self._theGraph) - def gp_EdgeInUseIndexBound(self): - return cgraphLib.gp_EdgeInUseIndexBound(self._theGraph) + def gp_EdgeInUseArraySize(self): + return cgraphLib.gp_EdgeInUseArraySize(self._theGraph) def gp_GetFirstArc(self, int v): if not self.gp_IsVertex(v): @@ -100,7 +100,7 @@ cdef class Graph: return ( (v >= self.gp_GetFirstVertex()) and (v <= self.gp_GetLastVertex()) and - cgraphLib.gp_IsVertex(v) + cgraphLib.gp_IsVertex(self._theGraph, v) ) def gp_GetFirstVertex(self): @@ -109,19 +109,20 @@ cdef class Graph: def gp_GetLastVertex(self): return cgraphLib.gp_GetLastVertex(self._theGraph) - def gp_VertexInRange(self, int v): + def gp_VertexInRangeAscending(self, int v): return ( v >= self.gp_GetFirstVertex() and - cgraphLib.gp_VertexInRange(self._theGraph, v) + cgraphLib.gp_VertexInRangeAscending(self._theGraph, v) ) - def gp_getN(self)-> int: + def gp_GetN(self)-> int: """ Returns the number of vertices in the graph. """ if self._theGraph == NULL: raise RuntimeError("Graph is not initialized.") - return cgraphLib.gp_getN(self._theGraph) + + return cgraphLib.gp_GetN(self._theGraph) def gp_InitGraph(self, int n): if cgraphLib.gp_InitGraph(self._theGraph, n) != cappconst.OK: @@ -133,11 +134,11 @@ cdef class Graph: def gp_CopyGraph(self, Graph src_graph): # NOTE: this is interpreting the self as the dstGraph, i.e. copying # the Graph wrapper that is passed in as the srcGraph - if src_graph.is_graph_NULL() or src_graph.gp_getN() == 0: + if src_graph.is_graph_NULL() or src_graph.gp_GetN() == 0: raise ValueError( "Source graph either has not been allocated or not been " "initialized.") - if self.gp_getN() != src_graph.gp_getN(): + if self.gp_GetN() != src_graph.gp_GetN(): raise ValueError( "Source and destination graphs must have the same order " "to copy graphP struct.") @@ -227,17 +228,13 @@ cdef class Graph: f"and vlink = {vlink}." ) - def gp_DeleteEdge(self, int e, int nextLink): + def gp_DeleteEdge(self, int e): if not self.gp_IsArc(e): raise RuntimeError( f"gp_DeleteEdge() failed: invalid arc '{e}'." ) - if nextLink != 0 and nextLink != 1: - raise RuntimeError( - f"Invalid link index for nextLink: '{nextLink}'." - ) - - return cgraphLib.gp_DeleteEdge(self._theGraph, e, nextLink) + + return cgraphLib.gp_DeleteEdge(self._theGraph, e) def gp_AttachDrawPlanar(self): if cgraphLib.gp_AttachDrawPlanar(self._theGraph) != cappconst.OK: