diff --git a/examples/ascii.py b/examples/classic/ascii.py similarity index 99% rename from examples/ascii.py rename to examples/classic/ascii.py index b61f0b2..1772a34 100644 --- a/examples/ascii.py +++ b/examples/classic/ascii.py @@ -1,4 +1,6 @@ import planarity + + # Example of the complete graph of 5 nodes, K5 # K5 is not planar diff --git a/examples/graph_formats.py b/examples/classic/graph_formats.py similarity index 99% rename from examples/graph_formats.py rename to examples/classic/graph_formats.py index 697302f..0e601d4 100644 --- a/examples/graph_formats.py +++ b/examples/classic/graph_formats.py @@ -1,4 +1,6 @@ import planarity + + # Example of the complete graph of 5 nodes, K5 # K5 is not planar # any of the following formats can bed used for representing the graph diff --git a/examples/kuratowski.py b/examples/classic/kuratowski.py similarity index 99% rename from examples/kuratowski.py rename to examples/classic/kuratowski.py index 29fde9f..e7d313b 100644 --- a/examples/kuratowski.py +++ b/examples/classic/kuratowski.py @@ -1,4 +1,6 @@ import planarity + + # Example of the complete graph of 5 nodes, K5 # K5 is not planar diff --git a/examples/networkx_draw.py b/examples/classic/networkx_draw.py similarity index 98% rename from examples/networkx_draw.py rename to examples/classic/networkx_draw.py index 7be75f0..b3cd944 100644 --- a/examples/networkx_draw.py +++ b/examples/classic/networkx_draw.py @@ -1,6 +1,8 @@ import planarity import networkx as nx import matplotlib.pyplot as plt + + G=nx.wheel_graph(10) planarity.draw(G) plt.axis('off') diff --git a/examples/networkx_interface.py b/examples/classic/networkx_interface.py similarity index 99% rename from examples/networkx_interface.py rename to examples/classic/networkx_interface.py index 17f3756..2cd42ac 100644 --- a/examples/networkx_interface.py +++ b/examples/classic/networkx_interface.py @@ -1,5 +1,7 @@ import planarity import networkx as nx + + # Example of the complete graph of 5 nodes, K5 G=nx.complete_graph(5) # K5 is not planar diff --git a/examples/pgraph_class.py b/examples/classic/pgraph_class.py similarity index 99% rename from examples/pgraph_class.py rename to examples/classic/pgraph_class.py index ac3f9ef..0570afa 100644 --- a/examples/pgraph_class.py +++ b/examples/classic/pgraph_class.py @@ -1,4 +1,6 @@ import planarity + + # Example of the complete graph of 5 nodes, K5 # K5 is not planar # any of the following formats can bed used for representing the graph diff --git a/examples/write_adjlist.py b/examples/classic/write_adjlist.py similarity index 99% rename from examples/write_adjlist.py rename to examples/classic/write_adjlist.py index ec1156d..91a5a89 100644 --- a/examples/write_adjlist.py +++ b/examples/classic/write_adjlist.py @@ -1,4 +1,6 @@ import planarity + + # Example of the complete graph of 5 nodes, K5 # K5 is not planar diff --git a/examples/full/planarity_app_utils.py b/examples/full/planarity_app_utils.py new file mode 100644 index 0000000..375f268 --- /dev/null +++ b/examples/full/planarity_app_utils.py @@ -0,0 +1,135 @@ +"""Utilities to support planarity app implementation""" +__all__ = [ + "PLANARITY_PACKAGE_INFO", + "PLANARITY_ALGORITHM_SPECIFIERS", + "ALGORITHM_SPECIFIER_NAME_CORRESPONDENCE", + "ALGORITHM_SPECIFIER_OUTPUT_CORRESPONDENCE", + "EMBED_RESULT_NAME_CORRESPONDENCE", + "extend_graph", + "get_embed_flags", +] + +from planarity import ( + gp_GetProjectVersionFull, + gp_GetLibPlanarityVersionFull, + Graph, +) + +from planarity import ( + EMBEDFLAGS_PLANAR, + EMBEDFLAGS_DRAWPLANAR, + EMBEDFLAGS_OUTERPLANAR, + EMBEDFLAGS_SEARCHFORK23, + EMBEDFLAGS_SEARCHFORK33, + EMBEDFLAGS_SEARCHFORK4, + OK, + NONEMBEDDABLE, + NOTOK, +) + + +def PLANARITY_PACKAGE_INFO() -> str: + return ( + "\n===================================================\n" + "This program imports the planarity package, which\n" + "is based on the Edge Addition Planarity Suite\n" + f"version {gp_GetProjectVersionFull()}, which contains " + "the libPlanarity\ngraph library version " + f"{gp_GetLibPlanarityVersionFull()}." + "\n===================================================\n" + ) + +def PLANARITY_ALGORITHM_SPECIFIERS() -> tuple[str, ...]: + """Returns immutable tuple containing algorithm command specifiers""" + return ("p", "d", "o", "2", "3", "4") + + +def ALGORITHM_SPECIFIER_NAME_CORRESPONDENCE() -> dict[str, str]: + """Returns mapping of command specifier to name""" + return { + "p": "Planarity", + "d": "Draw Planar", + "o": "Outerplanarity", + "2": "K_{2, 3} Search", + "3": "K_{3, 3} Search", + "4": "K_4 Search", + } + + +def ALGORITHM_SPECIFIER_OUTPUT_CORRESPONDENCE() -> dict[str, str]: + """Returns mapping of command specifier to output type""" + return { + "p": "planar", + "d": "planar", + "o": "outerplanar", + "2": "K_{2, 3}-free", + "3": "K_{3, 3}-free", + "4": "K_4-free", + } + + +def EMBED_RESULT_NAME_CORRESPONDENCE() -> dict[int, str]: + """Returns mapping of embed result to name""" + return { + OK: "OK", + NONEMBEDDABLE: "NONEMBEDDABLE", + NOTOK: "NOTOK", + } + + +def extend_graph(theGraph: Graph, command: str) -> None: + """Extend the graph with structures, methods, and method overloads required by the specified algorithm. + + Args: + graph: The Graph object to be extended + command: The algorithm command specifier + + Raises: + ValueError: If the command is not recognized + RuntimeError: If the underlying C function to extend the graph with the + pertinent structures fails. + """ + if command not in PLANARITY_ALGORITHM_SPECIFIERS(): + raise ValueError(f"Unsupported algorithm specifier: {command}") + + command_attach_extension_function_correspondence = { + "p": theGraph.gp_ExtendWith_Planarity, + "d": theGraph.gp_ExtendWith_DrawPlanar, + "o": theGraph.gp_ExtendWith_Outerplanarity, + "2": theGraph.gp_ExtendWith_K23Search, + "3": theGraph.gp_ExtendWith_K33Search, + "4": theGraph.gp_ExtendWith_K4Search, + } + + command_attach_extension_function_correspondence.get( + command, lambda *a, **k: None + )() + + +def get_embed_flags(command: str) -> int: + """Get embedFlags corresponding to the command + + Args: + command: The algorithm command specifier + + Returns: + int: The corresponding embed flag from the C graphLib exposed by the + Cython wrapper. + + Raises: + ValueError: If an invalid command is provided + """ + command_embed_flag_correspondence = { + "p": EMBEDFLAGS_PLANAR, + "d": EMBEDFLAGS_DRAWPLANAR, + "o": EMBEDFLAGS_OUTERPLANAR, + "2": EMBEDFLAGS_SEARCHFORK23, + "3": EMBEDFLAGS_SEARCHFORK33, + "4": EMBEDFLAGS_SEARCHFORK4, + } + + embed_flags = command_embed_flag_correspondence.get(command) + if embed_flags is None: + raise ValueError(f"Unsupported algorithm specifier: {command}") + + return embed_flags diff --git a/examples/full/test_specific_graph.py b/examples/full/test_specific_graph.py new file mode 100644 index 0000000..2216501 --- /dev/null +++ b/examples/full/test_specific_graph.py @@ -0,0 +1,242 @@ +""" +A simple script that imports the planarity Cython package, reads in a graph, +calls gp_Embed() and tests embed result integrity, then writes the result to +file. + +Functions: + def specific_graph( + infile: Path, + outdir: Optional[Path], + command: str, + output_mode: str, + ) -> int +""" +#!/usr/bin/env python + +__all__ = ["specific_graph"] + +# STANDARD LIBRARY IMPORTS +import argparse +from pathlib import Path +import re +from typing import Optional + +# THIRD PARTY IMPORTS +from planarity import ( + Graph, + OK, + NONEMBEDDABLE, + NOTOK, +) + +# LOCAL IMPORTS +from planarity_app_utils import ( + PLANARITY_PACKAGE_INFO, + PLANARITY_ALGORITHM_SPECIFIERS, + ALGORITHM_SPECIFIER_NAME_CORRESPONDENCE, + ALGORITHM_SPECIFIER_OUTPUT_CORRESPONDENCE, + EMBED_RESULT_NAME_CORRESPONDENCE, + extend_graph, + get_embed_flags, +) + + +def specific_graph( + infile: Path, + outdir: Optional[Path], + command: str, + output_mode: str, +) -> int: + """Run gp_Embed() for the specified algorithm and output the result to file + + When the embed result is OK, writes the embedding (po), planar drawing (d), + or an empty graph (234). + + When the embed_result is NONEMBEDDABLE, writes the obstruction (pdo) or + the target homeomorph (234). + + Args: + infile: name of graph input file to read + outdir: parent directory under which to make output directory + command: algorithm command specifier + output_mode: desired output format: .g6 (g), Adjacency List (a), or + Adjacency Matrix (m) + + Returns: + OK, NONEMBEDDABLE, or NOTOK based on the embed_result + + Raises: + ValueError: If invalid command specifier provided + RuntimeError: If unable to extend graph for the specified command, or if + embedding result does not match integrity check result + """ + embed_flags = get_embed_flags(command) + + if outdir is None: + outdir = infile.parent + if outdir.is_file(): + raise argparse.ArgumentTypeError( + f"Output directory '{outdir}' corresponds to a file." + ) + + outdir = Path.joinpath(outdir, f"{infile.stem}") + + Path.mkdir(outdir, parents=True, exist_ok=True) + + outfile = Path.joinpath(outdir, f"{infile.stem}.s.{command}.out.txt") + + graph_for_embedding_check = Graph() + graph_for_embedding = Graph() + + graph_for_embedding_check.gp_Read(str(infile)) + order = graph_for_embedding_check.gp_GetN() + + graph_for_embedding.gp_InitGraph(order) + graph_for_embedding.gp_CopyGraph(graph_for_embedding_check) + + extend_graph(graph_for_embedding, command) + + embed_result = graph_for_embedding.gp_Embed(embed_flags) + if ( + graph_for_embedding.gp_TestEmbedResultIntegrity( + graph_for_embedding_check, embed_result + ) + != embed_result + ): + raise RuntimeError( + f"Failed embed integrity check for command '{command}' on graph in " + f"'{infile}'." + ) + + # NOTE: When the embed_result is OK for K_{2,3}, K_{3,3}, and K_4 + # homeomorph search, the graph contents are thrown away by their respective + # EmbedPostprocess, so the output will be the empty graph, i.e. there is no + # subgraph homeomorphic to the target homeomorph + graph_for_embedding.gp_Write(str(outfile), output_mode) + + if embed_result == OK and command == "d": + choice = input( + "Do you wish to render the drawing to screen (s) " + "or file (f)? (Select any other input to dismiss.)\n\t" + ) + if choice.lower() == "s": + print(graph_for_embedding.gp_DrawPlanar_RenderToString()) + pass + elif choice.lower() == "f": + render_outfile = Path.joinpath( + outdir, f"{infile.stem}.s.{command}.render.txt" + ) + graph_for_embedding.gp_DrawPlanar_RenderToFile(str(render_outfile)) + + return embed_result + +def print_embed_result(command: str, embed_result: int) -> None: + """Renders the embed result for the given algorithm extension + + Args: + command: algorithm command specifier + embed_result: OK, NONEMBEDDABLE, or NOTOK based on the embed_result from + specific_graph() + + Raises: + ValueError: If the command is not a valid algorithm extension specifier, + or if the embed_result does not correspond to a valid return code. + """ + if command not in PLANARITY_ALGORITHM_SPECIFIERS(): + raise ValueError( + f"Command '{command}' is not one of " + f"({', '.join(PLANARITY_ALGORITHM_SPECIFIERS())})" + ) + + if embed_result not in (OK, NONEMBEDDABLE, NOTOK): + raise ValueError( + f"Embed result '{embed_result}' does not correspond to OK ({OK}), " + f"NONEMBEDDABLE ({NONEMBEDDABLE}), or NOTOK ({NOTOK})." + ) + + print( + f"{ALGORITHM_SPECIFIER_NAME_CORRESPONDENCE().get(command)} " + "embed result was " + f"{EMBED_RESULT_NAME_CORRESPONDENCE().get(embed_result)}." + ) + + if embed_result == NOTOK: + return + + print( + f"\tThe graph is {'not ' if embed_result == NONEMBEDDABLE else ''}" + f"{ALGORITHM_SPECIFIER_OUTPUT_CORRESPONDENCE().get(command)}" + ) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + formatter_class=argparse.RawTextHelpFormatter, + usage="python %(prog)s [options]", + description="Python implementation of Planarity SpecificGraph()\n\n" + "Reproduces Planarity's SpecificGraph() using graphLib functions " + "exposed by the Cython wrapper.\n", + ) + + parser.add_argument( + "-i", + "--infile", + required=True, + type=Path, + help="Path to graph input file containing a single input graph; if a " + ".g6 input file is specified, only the first graph in the file will be " + "processed.", + ) + parser.add_argument( + "-o", + "--outdir", + required=False, + type=Path, + default=None, + help="Path of directory in which to make the output directory which " + "will contain the output from running all chosen graph algorithm " + "commands on the input graph. Defaults to:\n" + "\t{infile_parent_dir}/{infile_stem}/\n" + "Where output filenames will be of the form:\n" + "\t{infile_stem}.s.{command}.out.txt\n" + "For each specified graph algorithm command.", + ) + + parser.add_argument( + "-c", + "--commands", + type=str, + required=False, + default=None, + help="Delimited list of algorithm command specifiers you wish to use " + "when testing all graphs in the input file(s). Defaults to:\n" + f"\t{','.join(PLANARITY_ALGORITHM_SPECIFIERS())}", + ) + + parser.add_argument( + "-m", + "--mode", + type=str, + required=False, + default="a", + help="Desired graph output format: .g6 (g), Adjacency List (a), or " + "Adjacency Matrix (m). Defaults to 'a'\n", + ) + + args = parser.parse_args() + + print(PLANARITY_PACKAGE_INFO()) + + commands = [ + command.strip() for command in re.split(r'[ ,.;]', args.commands) + ] if args.commands else PLANARITY_ALGORITHM_SPECIFIERS() + + for command in commands: + embed_result = specific_graph( + infile=args.infile, + outdir=args.outdir, + command=command, + output_mode=args.mode, + ) + print_embed_result(command=command, embed_result=embed_result) + diff --git a/planarity/__init__.py b/planarity/__init__.py index 0ea255a..a5645d8 100644 --- a/planarity/__init__.py +++ b/planarity/__init__.py @@ -4,6 +4,8 @@ from .full.g6IterationUtils import G6ReadIterator, G6WriteIterator from .full.graph import ( + gp_GetProjectVersionFull, + gp_GetLibPlanarityVersionFull, Graph, OK, NONEMBEDDABLE, @@ -16,14 +18,7 @@ EMBEDFLAGS_SEARCHFORK33, EMBEDFLAGS_SEARCHFORK4, ) -from .full.planarity_app_utils import ( - PLANARITY_ALGORITHM_SPECIFIERS, - ENSURE_ARC_CAPACITY_SPECIFIERS, - attach_algorithm, - get_embed_flags, - max_num_edges_for_order, -) # NOTE: In the future, we could automatically generate the version number by # configuring setuptools-scm, but presently this seems simpler. -__version__ = "0.7.10" +__version__ = "0.7.11" diff --git a/planarity/c/graphLib/extensionSystem/graphExtensions.c b/planarity/c/graphLib/extensionSystem/graphExtensions.c index 97cfa1e..c4778a9 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. */ @@ -75,7 +75,7 @@ static int moduleIDGenerator = 0; parameter to gp_AddExtension() 5) The expected method of attaching your feature to a graph is to - create a function called gp_AttachFeature(), where 'Feature' is + create a function called gp_ExtendWith_Feature(), where 'Feature' is the name of your module. The attach function allocates your context data structure, initializes the extension data, assigns overload function pointers, and invokes gp_AddExtension(). @@ -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. @@ -143,8 +138,8 @@ static int moduleIDGenerator = 0; a) The _Feature_ClearStructures() should simply null out pointers to extra structures on its first invocation, but thereafter it should free them and then null them. Since the null-only step - is done only once in gp_AttachFeature(), it seems reasonable to - not bother with a more complicated _Feature_ClearStructures(). + is done only once in gp_ExtendWith_Feature(), it seems reasonable + to not bother with a more complicated _Feature_ClearStructures(). But, as an extension is developed, the data structures change, so it is best to keep all this logic in one place. @@ -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() + 8) Define a function gp_Detach_Feature() 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 + do not attach it with gp_ExtendWith_Feature() 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..cc3a7d5 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. */ @@ -42,7 +42,7 @@ extern "C" // of the behaviors of gp_* function in the public API int (*fpInitGraph)(graphP, int); void (*fpReinitializeGraph)(graphP); - int (*fpEnsureArcCapacity)(graphP, int); + int (*fpEnsureEdgeCapacity)(graphP, int); int (*fpSortVertices)(graphP); int (*fpReadPostprocess)(graphP, char *); diff --git a/planarity/c/graphLib/graph.h b/planarity/c/graphLib/graph.h index 7ee07d7..1438fe8 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. */ @@ -16,6 +16,8 @@ extern "C" #include "io/g6-read-iterator.h" #include "io/g6-write-iterator.h" + +// Headers needed within library but not part of public API #include "io/strbuf.h" #include "io/strOrFile.h" @@ -25,117 +27,123 @@ extern "C" // Definitions for higher-order operations at the vertex, edge and graph levels /////////////////////////////////////////////////////////////////////////////// + // Methods related to graph allocation, initialization, and destruction graphP gp_New(void); int gp_InitGraph(graphP theGraph, int N); void gp_ReinitializeGraph(graphP theGraph); - int gp_CopyAdjacencyLists(graphP dstGraph, graphP srcGraph); + + void gp_Free(graphP *pGraph); + + int gp_EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity); + +// Basic graph structure interrogators +// N=# of vertices; NV=# of virtual vertices; M=# of edges +#define gp_GetN(theGraph) ((theGraph)->N) +#define gp_GetNV(theGraph) ((theGraph)->NV) +#define gp_GetM(theGraph) ((theGraph)->M) + +#define gp_GetEdgeCapacity(theGraph) ((theGraph)->edgeCapacity) + + // Basic graph utility methods int gp_CopyGraph(graphP dstGraph, graphP srcGraph); graphP gp_DupGraph(graphP theGraph); + int gp_CopyAdjacencyLists(graphP dstGraph, graphP srcGraph); int gp_CreateRandomGraph(graphP theGraph); int gp_CreateRandomGraphEx(graphP theGraph, int numEdges); - void gp_Free(graphP *pGraph); - + // Basic graph I/O methods int gp_Read(graphP theGraph, char const *FileName); int gp_ReadFromString(graphP theGraph, char *inputStr); + int gp_Write(graphP theGraph, char const *FileName, int Mode); + int gp_WriteToString(graphP theGraph, char **pOutputStr, int Mode); + +// Mode values for gp_Write() and gp_WriteToString() #define WRITE_ADJLIST 1 #define WRITE_ADJMATRIX 2 #define WRITE_DEBUGINFO 3 #define WRITE_G6 4 - int gp_Write(graphP theGraph, char const *FileName, int Mode); - int gp_WriteToString(graphP theGraph, char **pOutputStr, int Mode); - + // Basic vertex interrogators int gp_IsNeighbor(graphP theGraph, int u, int v); - int gp_GetNeighborEdgeRecord(graphP theGraph, int u, int v); + int gp_FindEdge(graphP theGraph, int u, int v); int gp_GetVertexDegree(graphP theGraph, int v); + + // Basic interrogators for directed graphs + // The direction can be EDGEFLAG_DIRECTION_INONLY or EDGEFLAG_DIRECTION_OUTONLY + int gp_IsNeighborDirected(graphP theGraph, int u, int v, unsigned direction); + int gp_FindDirectedEdge(graphP theGraph, int u, int v, unsigned direction); int gp_GetVertexInDegree(graphP theGraph, int v); int gp_GetVertexOutDegree(graphP theGraph, int v); - int gp_GetArcCapacity(graphP theGraph); - int gp_EnsureArcCapacity(graphP theGraph, int requiredArcCapacity); - + // Basic graph structure manipulators int gp_AddEdge(graphP theGraph, int u, int ulink, int v, int vlink); 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); + // Intermediate graph structure manipulators 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); + // Advanced graph structure manipulators int gp_ContractEdge(graphP theGraph, int e); int gp_IdentifyVertices(graphP theGraph, int u, int v, int eBefore); int gp_RestoreVertices(graphP theGraph); + // DFS-related methods int gp_CreateDFSTree(graphP theGraph); int gp_SortVertices(graphP theGraph); - int gp_LowpointAndLeastAncestor(graphP theGraph); - int gp_LeastAncestor(graphP theGraph); - int gp_PreprocessForEmbedding(graphP theGraph); - + int gp_ComputeLowpoints(graphP theGraph); + int gp_ComputeLeastAncestors(graphP theGraph); + +/* Graph Flags: + FLAGS_DFSNUMBERED is set if DFS numbering has been performed on 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_ZEROBASEDIO is typically set by gp_Read() to indicate that the + adjacency list representation in a file began with index 0. +*/ +#define gp_GetGraphFlags(theGraph) ((theGraph)->graphFlags) +#define FLAGS_DFSNUMBERED 1 +#define FLAGS_SORTEDBYDFI 2 +#define FLAGS_ZEROBASEDIO 4 + + // Graph embedding and result validation methods + // The embedResult output by gp_Embed() and input to gp_TestEmbedResultIntegrity() + // can be OK if the graph is embedded or embeddable, NONEMBEDDABLE if a minimal + // subgraph obstructing embedding has been isolated, or NOTOK on error 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 gp_GetEmbedFlags(theGraph) ((theGraph)->embedFlags) #define EMBEDFLAGS_PLANAR 1 #define EMBEDFLAGS_OUTERPLANAR 2 #define EMBEDFLAGS_DRAWPLANAR (4 | EMBEDFLAGS_PLANAR) -#define EMBEDFLAGS_SEARCHFORK23 (16 | EMBEDFLAGS_OUTERPLANAR) +#define EMBEDFLAGS_SEARCHFORK23 (8 | EMBEDFLAGS_OUTERPLANAR) +#define EMBEDFLAGS_SEARCHFORK33 (16 | EMBEDFLAGS_PLANAR) #define EMBEDFLAGS_SEARCHFORK4 (32 | EMBEDFLAGS_OUTERPLANAR) -#define EMBEDFLAGS_SEARCHFORK33 (64 | EMBEDFLAGS_PLANAR) -#define EMBEDFLAGS_SEARCHFORK5 (128 | EMBEDFLAGS_PLANAR) - -#define EMBEDFLAGS_MAXIMALPLANARSUBGRAPH 256 +// Reserve flag bits for possible future embedding-related extension modules +#define EMBEDFLAGS_SEARCHFORK5 (64 | EMBEDFLAGS_PLANAR) +#define EMBEDFLAGS_SEARCHFORK5MINOR (128 | EMBEDFLAGS_PLANAR) +#define EMBEDFLAGS_MAXIMALPLANARSUBGRAPH (256 | EMBEDFLAGS_PLANAR) #define EMBEDFLAGS_PROJECTIVEPLANAR 512 #define EMBEDFLAGS_TOROIDAL 1024 -/* If LOGGING is defined, then write to the log, otherwise no-op - By default, neither release nor DEBUG builds including LOGGING. - Logging is useful for seeing details of how various algorithms - handle a particular graph. */ - -// #define LOGGING -#ifdef LOGGING - -#define gp_LogLine _LogLine -#define gp_Log _Log - - void _LogLine(const char *Line); - void _Log(const char *Line); - -#define gp_MakeLogStr1 _MakeLogStr1 -#define gp_MakeLogStr2 _MakeLogStr2 -#define gp_MakeLogStr3 _MakeLogStr3 -#define gp_MakeLogStr4 _MakeLogStr4 -#define gp_MakeLogStr5 _MakeLogStr5 - - char *_MakeLogStr1(char *format, int); - char *_MakeLogStr2(char *format, int, int); - char *_MakeLogStr3(char *format, int, int, int); - char *_MakeLogStr4(char *format, int, int, int, int); - char *_MakeLogStr5(char *format, int, int, int, int, int); - -#else -#define gp_LogLine(Line) -#define gp_Log(Line) -#define gp_MakeLogStr1(format, one) -#define gp_MakeLogStr2(format, one, two) -#define gp_MakeLogStr3(format, one, two, three) -#define gp_MakeLogStr4(format, one, two, three, four) -#define gp_MakeLogStr5(format, one, two, three, four, five) -#endif - #ifdef __cplusplus } #endif diff --git a/planarity/c/graphLib/graphDFSUtils.c b/planarity/c/graphLib/graphDFSUtils.c index cd0677e..e1d3b38 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,20 +12,20 @@ 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 Assigns Depth First Index (DFI) to each vertex. Also records parent - of each vertex in the DFS tree, and marks DFS tree edges that go from - parent to child. Forward arc cycle edges are also distinguished from - edges leading from a DFS tree descendant to an ancestor-- both DFS tree - edges and back arcs. The forward arcs are moved to the end of the - adjacency list to make the set easier to find and process. - - NOTE: This is a utility function provided for general use of the graph - library. The core planarity algorithm uses its own DFS in order to build - up related data structures at the same time as the DFS tree is created. + of each vertex in the DFS tree, and marks DFS tree edges that connect + parent and child. Forward edge records are also distinguished from + edges leading from a DFS tree descendant back to an ancestor. + The forward edge records are moved to the end of the adjacency list + to make the set easier to find and process. + + NOTE: This is a utility function provided for general use. The core + planarity algorithm uses its own DFS so it can build related + data structures at the same time as the DFS tree is created. ********************************************************************/ #include "lowLevelUtils/platformTime.h" @@ -42,29 +42,33 @@ int gp_CreateDFSTree(graphP theGraph) if (theGraph == NULL) return NOTOK; - if (theGraph->internalFlags & FLAGS_DFSNUMBERED) + if (gp_GetGraphFlags(theGraph) & FLAGS_DFSNUMBERED) return OK; - gp_LogLine("\ngraphDFSUtils.c/gp_CreateDFSTree() start"); + _gp_LogLine("\ngraphDFSUtils.c/gp_CreateDFSTree() start"); theStack = theGraph->theStack; - /* There are 2M edge records (arcs) and for each we can push 2 integers, - so a stack of 2 * arcCapacity integers suffices. - This is already in theGraph structure, so we make sure it's empty, - then clear all visited flags in prep for the Depth first search. */ + /* There are 2M edge records and for each we can push 2 integers, + plus one extra (NIL, NIL) at the beginning to represent + arriving at a DFS tree root. So, a stack of 2 * 2 * (1+M) + integers suffices. + This stack is already in theGraph structure, so we make sure + it has the capacity and, if so, that it's empty. */ - if (sp_GetCapacity(theStack) < 2 * gp_GetArcCapacity(theGraph)) + if (sp_GetCapacity(theStack) < 2 * 2 * gp_GetM(theGraph) + 2) return NOTOK; sp_ClearStack(theStack); - _ClearVertexVisitedFlags(theGraph, FALSE); + /* Clear the visited flags because they are used to detect what has + been visited as the DFS traverses the graph. */ + _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,45 +77,45 @@ 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_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_IsEdge(theGraph, e)) { gp_SetEdgeType(theGraph, e, EDGE_TYPE_CHILD); - gp_SetEdgeType(theGraph, gp_GetTwinArc(theGraph, e), EDGE_TYPE_PARENT); + gp_SetEdgeType(theGraph, gp_GetTwin(theGraph, e), EDGE_TYPE_PARENT); } /* Push edges to all unvisited neighbors. These will be either - tree edges to children or forward arcs of back edges */ + tree edges to children or forward edge records of back edges */ - e = gp_GetFirstArc(theGraph, u); - while (gp_IsArc(e)) + e = gp_GetFirstEdge(theGraph, u); + while (gp_IsEdge(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); + e = gp_GetNextEdge(theGraph, e); } } else { // If the edge leads to a visited vertex, then it is - // the forward arc of a back edge. + // the forward component of a back edge. gp_SetEdgeType(theGraph, e, EDGE_TYPE_FORWARD); - gp_SetEdgeType(theGraph, gp_GetTwinArc(theGraph, e), EDGE_TYPE_BACK); + gp_SetEdgeType(theGraph, gp_GetTwin(theGraph, e), EDGE_TYPE_BACK); } } } - gp_LogLine("graphDFSUtils.c/gp_CreateDFSTree() end\n"); + _gp_LogLine("graphDFSUtils.c/gp_CreateDFSTree() end\n"); - theGraph->internalFlags |= FLAGS_DFSNUMBERED; + theGraph->graphFlags |= FLAGS_DFSNUMBERED; #ifdef PROFILE platform_GetTime(end); @@ -139,9 +143,34 @@ int gp_CreateDFSTree(graphP theGraph) int gp_SortVertices(graphP theGraph) { + if (theGraph == NULL) + return NOTOK; + return theGraph->functions.fpSortVertices(theGraph); } +// Give macro names to swap operations used when sorting vertices +// These are macros and hence not overloadable. If an extension +// needs to reorder parallel vertex data, then this must be done +// by a post-processing step in an overload of gp_SortVertices(). +// The index values of the first N vertices are changed to hold +// the prior locations of vertices when they are rearranged to +// or from DFI order. +#define _gp_SwapAnyTypeVertexRec(dstGraph, vdst, srcGraph, vsrc) \ + { \ + anyTypeVertexRec tempV = dstGraph->V[vdst]; \ + dstGraph->V[vdst] = srcGraph->V[vsrc]; \ + srcGraph->V[vsrc] = tempV; \ + } +#define _gp_SwapVertexInfo(dstGraph, dstPos, srcGraph, srcPos) \ + { \ + vertexInfo tempVI = dstGraph->VI[dstPos]; \ + dstGraph->VI[dstPos] = srcGraph->VI[srcPos]; \ + srcGraph->VI[srcPos] = tempVI; \ + } + +// This is the default method for sorting vertices into and back +// out of DFI order. int _SortVertices(graphP theGraph) { int v, EsizeOccupied, e, srcPos, dstPos; @@ -153,31 +182,31 @@ int _SortVertices(graphP theGraph) if (theGraph == NULL) return NOTOK; - if (!(theGraph->internalFlags & FLAGS_DFSNUMBERED)) + if (!(gp_GetGraphFlags(theGraph) & FLAGS_DFSNUMBERED)) if (gp_CreateDFSTree(theGraph) != OK) return NOTOK; - gp_LogLine("\ngraphDFSUtils.c/_SortVertices() start"); + _gp_LogLine("\ngraphDFSUtils.c/_SortVertices() start"); /* Change labels of edges from v to DFI(v)-- or vice versa 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); - for (e = gp_GetFirstEdge(theGraph); e < EsizeOccupied; e += 2) + EsizeOccupied = gp_EdgeInUseArraySize(theGraph); + for (e = gp_EdgeArrayStart(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 +216,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 +225,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_SwapVertexInfo(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; } @@ -215,9 +244,9 @@ int _SortVertices(graphP theGraph) /* Invert the bit that records the sort order of the graph */ - theGraph->internalFlags ^= FLAGS_SORTEDBYDFI; + theGraph->graphFlags ^= FLAGS_SORTEDBYDFI; - gp_LogLine("graphDFSUtils.c/_SortVertices() end\n"); + _gp_LogLine("graphDFSUtils.c/_SortVertices() end\n"); #ifdef PROFILE platform_GetTime(end); @@ -228,11 +257,14 @@ int _SortVertices(graphP theGraph) } /******************************************************************** - gp_LowpointAndLeastAncestor() + gp_ComputeLowpoints() leastAncestor(v): min(v, ancestor neighbors of v, excluding parent) Lowpoint(v): min(leastAncestor(v), Lowpoint of DFS children of v) - Lowpoint is computed via a post-order traversal of the DFS tree. + The Lowpoint of each vertex is computed via a post-order traversal of the + DFS tree. Lowpoint calculations require leastAncestor calculations, so + both are computed by this method. + We push the root of the DFS tree, then we loop while the stack is not empty. We pop a vertex; if it is not marked, then we are on our way down the DFS tree, so we mark it and push it back on, followed by pushing its @@ -247,24 +279,26 @@ int _SortVertices(graphP theGraph) sorted state on completion of this method. NOTE: This is a utility function provided for general use of the graph - library. The core planarity algorithm computes leastAncestor during its - initial DFS, and it computes the lowpoint of a vertex as it embeds the - tree edges to its children. + library. The core planarity algorithm computes leastAncestor during + its initial DFS, and it computes the lowpoint of each a vertex as + it embeds the tree edges to its children. ********************************************************************/ -int gp_LowpointAndLeastAncestor(graphP theGraph) +int gp_ComputeLowpoints(graphP theGraph) { - stackP theStack = theGraph->theStack; + stackP theStack = NULL; int v, u, uneighbor, e, L, leastAncestor; if (theGraph == NULL) return NOTOK; - if (!(theGraph->internalFlags & FLAGS_DFSNUMBERED)) + theStack = theGraph->theStack; + + if (!(gp_GetGraphFlags(theGraph) & FLAGS_DFSNUMBERED)) if (gp_CreateDFSTree(theGraph) != OK) return NOTOK; - if (!(theGraph->internalFlags & FLAGS_SORTEDBYDFI)) + if (!(gp_GetGraphFlags(theGraph) & FLAGS_SORTEDBYDFI)) if (gp_SortVertices(theGraph) != OK) return NOTOK; @@ -273,21 +307,22 @@ int gp_LowpointAndLeastAncestor(graphP theGraph) platform_GetTime(start); #endif - gp_LogLine("\ngraphDFSUtils.c/gp_LowpointAndLeastAncestor() start"); + _gp_LogLine("\ngraphDFSUtils.c/gp_ComputeLowpoints() start"); // A stack of size N suffices because at maximum every vertex is pushed only once - // However, since a larger stack is needed for the main DFS, this is mainly documentation - if (sp_GetCapacity(theStack) < theGraph->N) + // However, since a larger stack is needed for the main DFS, this is really + // just 'documentation' of the requirement + if (sp_GetCapacity(theStack) < gp_GetN(theGraph)) return NOTOK; 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,23 +334,23 @@ 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)) + e = gp_GetFirstEdge(theGraph, u); + while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) { sp_Push(theStack, gp_GetNeighbor(theGraph, e)); } - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } } @@ -326,8 +361,8 @@ int gp_LowpointAndLeastAncestor(graphP theGraph) leastAncestor = L = u; // Compute leastAncestor and L, the least lowpoint from the DFS children - e = gp_GetFirstArc(theGraph, u); - while (gp_IsArc(e)) + e = gp_GetFirstEdge(theGraph, u); + while (gp_IsEdge(theGraph, e)) { uneighbor = gp_GetNeighbor(theGraph, e); if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) @@ -341,7 +376,7 @@ int gp_LowpointAndLeastAncestor(graphP theGraph) leastAncestor = uneighbor; } - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } /* Assign leastAncestor and Lowpoint to the vertex */ @@ -351,7 +386,7 @@ int gp_LowpointAndLeastAncestor(graphP theGraph) } } - gp_LogLine("graphDFSUtils.c/gp_LowpointAndLeastAncestor() end\n"); + _gp_LogLine("graphDFSUtils.c/gp_ComputeLowpoints() end\n"); #ifdef PROFILE platform_GetTime(end); @@ -362,7 +397,7 @@ int gp_LowpointAndLeastAncestor(graphP theGraph) } /******************************************************************** - gp_LeastAncestor() + gp_ComputeLeastAncestors() By simple pre-order visitation, compute the least ancestor of each vertex that is directly adjacent to the vertex by a back edge. @@ -371,23 +406,25 @@ int gp_LowpointAndLeastAncestor(graphP theGraph) gp_SortVertices() are invoked on the graph, and it is left in the sorted state on completion of this method. - NOTE: This method is not called by gp_LowpointAndLeastAncestor(), - which computes both values at the same time. + NOTE: This method is not called by gp_ComputeLowpoints(), + which computes both values at the same time. ********************************************************************/ -int gp_LeastAncestor(graphP theGraph) +int gp_ComputeLeastAncestors(graphP theGraph) { - stackP theStack = theGraph->theStack; + stackP theStack = NULL; int v, u, uneighbor, e, leastAncestor; if (theGraph == NULL) return NOTOK; - if (!(theGraph->internalFlags & FLAGS_DFSNUMBERED)) + theStack = theGraph->theStack; + + if (!(gp_GetGraphFlags(theGraph) & FLAGS_DFSNUMBERED)) if (gp_CreateDFSTree(theGraph) != OK) return NOTOK; - if (!(theGraph->internalFlags & FLAGS_SORTEDBYDFI)) + if (!(gp_GetGraphFlags(theGraph) & FLAGS_SORTEDBYDFI)) if (gp_SortVertices(theGraph) != OK) return NOTOK; @@ -396,18 +433,18 @@ int gp_LeastAncestor(graphP theGraph) platform_GetTime(start); #endif - gp_LogLine("\ngraphDFSUtils.c/gp_LeastAncestor() start"); + _gp_LogLine("\ngraphDFSUtils.c/gp_ComputeLeastAncestors() start"); // A stack of size N suffices because at maximum every vertex is pushed only once - if (sp_GetCapacity(theStack) < theGraph->N) + if (sp_GetCapacity(theStack) < gp_GetN(theGraph)) return NOTOK; 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 +455,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)) + e = gp_GetFirstEdge(theGraph, u); + while (gp_IsEdge(theGraph, e)) { uneighbor = gp_GetNeighbor(theGraph, e); if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) @@ -438,14 +475,14 @@ int gp_LeastAncestor(graphP theGraph) leastAncestor = uneighbor; } - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } gp_SetVertexLeastAncestor(theGraph, u, leastAncestor); } } } - gp_LogLine("graphDFSUtils.c/gp_LeastAncestor() end\n"); + _gp_LogLine("graphDFSUtils.c/gp_ComputeLeastAncestors() end\n"); #ifdef PROFILE platform_GetTime(end); 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..c42b922 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. */ @@ -27,19 +27,19 @@ extern "C" // The initial setting for the edge storage capacity expressed as a constant factor of N, // which is the number of vertices in the graph. By default, array E is allocated enough -// space to contain 3N edges, which is 6N arcs (half edges), but this initial setting -// can be overridden using gp_EnsureArcCapacity(), which is especially efficient if done -// before calling gp_InitGraph() or gp_Read(). +// space to contain 3N edges, which is 6N edge records, but this initial setting +// can be overridden using gp_EnsureEdgeCapacity(). It is especially efficient to change +// to ensure a higher edge capacity if done before calling gp_InitGraph() or gp_Read(). #define DEFAULT_EDGE_LIMIT 3 /******************************************************************** Edge Record Definition - An edge is defined by a pair of edge records, or arcs, allocated in - array E of a graph. An edge record represents the edge in the - adjacency list of each vertex to which the edge is incident. + An edge is defined by a pair of edge records allocated in array E + of a graph. A pair of edge records represents the edge in the + adjacency lists of each vertex to which the edge is incident. - link[2]: the next and previous edge records (arcs) in the adjacency + link[2]: the next and previous edge records in the adjacency list that contains this edge record. v: The vertex neighbor of the vertex whose adjacency list contains @@ -47,12 +47,13 @@ extern "C" flags: Bits 0-15 reserved for library; bits 16 and higher for apps Bit 0: Visited - Bit 1: DFS type has been set, versus not set - Bit 2: DFS tree edge, versus cycle edge (co-tree edge, etc.) - Bit 3: DFS arc to descendant, versus arc to ancestor - Bit 4: Inverted (same as marking an edge with a "sign" of -1) - Bit 5: Arc is directed into the containing vertex only - Bit 6: Arc is directed from the containing vertex only + Bit 1: Marked (2nd visited flag, for while visiting all) + Bit 2: DFS type has been set, versus not set + Bit 3: DFS tree edge, versus cycle edge (co-tree edge, etc.) + Bit 4: DFS edge pointing to descendant, versus to ancestor + Bit 5: Inverted (same as marking an edge with a "sign" of -1) + Bit 6: Edge record is directed into the containing vertex only + Bit 7: Edge record is directed from the containing vertex only ********************************************************************/ typedef struct @@ -65,34 +66,57 @@ extern "C" typedef edgeRec *edgeRecP; #ifdef USE_FASTER_1BASEDARRAYS -#define gp_IsArc(e) (e) -#define gp_IsNotArc(e) (!(e)) -#define gp_GetFirstEdge(theGraph) (2) + +#ifndef DEBUG +#define gp_IsEdge(theGraph, e) (e) #else -#define gp_IsArc(e) ((e) != NIL) -#define gp_IsNotArc(e) ((e) == NIL) -#define gp_GetFirstEdge(theGraph) (0) +#define gp_IsEdge(theGraph, e) \ + ((e) == NIL \ + ? 0 \ + : ((e) < gp_EdgeArrayStart(theGraph) || (e) >= gp_EdgeArraySize(theGraph) \ + ? (NOTOK, 0) \ + : 1)) +#endif + +#define gp_IsNotEdge(theGraph, e) (!(e)) +#define gp_EdgeArrayStart(theGraph) (2) + +#else // When using slower 0-based Arrays + +#ifndef DEBUG +#define gp_IsEdge(theGraph, e) ((e) != NIL) +#else +#define gp_IsEdge(theGraph, e) \ + ((e) == NIL \ + ? 0 \ + : ((e) < gp_EdgeArrayStart(theGraph) || (e) >= gp_EdgeArraySize(theGraph) \ + ? (NOTOK, 0) \ + : 1)) +#endif + +#define gp_IsNotEdge(theGraph, e) ((e) == NIL) +#define gp_EdgeArrayStart(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_EdgeArrayStart(theGraph) + ((theGraph)->edgeCapacity << 1)) +#define gp_EdgeInUseArraySize(theGraph) (gp_EdgeArrayStart(theGraph) + ((gp_GetM(theGraph) + sp_GetCurrentSize((theGraph)->edgeHoles)) << 1)) -// An edge is represented by two consecutive edge records (arcs) in the edge array E. +// An edge is represented by two consecutive edge records in the edge array E. // If an even number, xor 1 will add one; if an odd number, xor 1 will subtract 1 -#define gp_GetTwinArc(theGraph, Arc) ((Arc) ^ 1) +#define gp_GetTwin(theGraph, e) ((e) ^ 1) // Access to adjacency list pointers -#define gp_GetNextArc(theGraph, e) (theGraph->E[e].link[0]) -#define gp_GetPrevArc(theGraph, e) (theGraph->E[e].link[1]) -#define gp_GetAdjacentArc(theGraph, e, theLink) (theGraph->E[e].link[theLink]) +#define gp_GetNextEdge(theGraph, e) (theGraph->E[e].link[0]) +#define gp_GetPrevEdge(theGraph, e) (theGraph->E[e].link[1]) +#define gp_GetAdjacentEdge(theGraph, e, theLink) (theGraph->E[e].link[theLink]) -#define gp_SetNextArc(theGraph, e, newNextArc) (theGraph->E[e].link[0] = newNextArc) -#define gp_SetPrevArc(theGraph, e, newPrevArc) (theGraph->E[e].link[1] = newPrevArc) -#define gp_SetAdjacentArc(theGraph, e, theLink, newArc) (theGraph->E[e].link[theLink] = newArc) +#define gp_SetNextEdge(theGraph, e, newNextEdge) (theGraph->E[e].link[0] = newNextEdge) +#define gp_SetPrevEdge(theGraph, e, newPrevEdge) (theGraph->E[e].link[1] = newPrevEdge) +#define gp_SetAdjacentEdge(theGraph, e, theLink, newEdge) (theGraph->E[e].link[theLink] = newEdge) -// Access to vertex 'neighbor' member indicated by arc +// Get/set 'neighbor' member indicated by edge record e #define gp_GetNeighbor(theGraph, e) (theGraph->E[e].neighbor) #define gp_SetNeighbor(theGraph, e, v) (theGraph->E[e].neighbor = v) @@ -105,23 +129,33 @@ extern "C" #define gp_ClearEdgeVisited(theGraph, e) (theGraph->E[e].flags &= ~EDGE_VISITED_MASK) #define gp_SetEdgeVisited(theGraph, e) (theGraph->E[e].flags |= EDGE_VISITED_MASK) -// The edge type is defined by bits 1-3, 2+4+8=14 -#define EDGE_TYPE_MASK 14 +// 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) + +// The edge type is defined by bits 2-4, 4+8+16=28 +#define EDGE_TYPE_MASK 28 // Call gp_GetEdgeType(), then compare to one of these four possibilities -// EDGE_TYPE_CHILD - edge record is an arc to a DFS child -// 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 -#define EDGE_TYPE_CHILD 14 -#define EDGE_TYPE_FORWARD 10 -#define EDGE_TYPE_PARENT 6 -#define EDGE_TYPE_BACK 2 +// EDGE_TYPE_CHILD - edge record points to a neighboring DFS child +// EDGE_TYPE_FORWARD - edge record points to a DFS descendant, not a DFS child +// EDGE_TYPE_PARENT - edge record points to the DFS parent +// EDGE_TYPE_BACK - edge record points to a DFS ancestor, not the DFS parent +// NOTE: A parent/child tree edge has bit 3 (4) set, forward/back edges do not +#define EDGE_TYPE_CHILD 28 +#define EDGE_TYPE_FORWARD 20 +#define EDGE_TYPE_PARENT 12 +#define EDGE_TYPE_BACK 4 // EDGE_TYPE_NOTDEFINED - the edge record type has not been defined // EDGE_TYPE_RANDOMTREE - edge record is part of a randomly generated tree +// NOTE: RANDOMTREE uses the same bit 3 as DFS tree edges above #define EDGE_TYPE_NOTDEFINED 0 -#define EDGE_TYPE_RANDOMTREE 4 +#define EDGE_TYPE_RANDOMTREE 8 #define gp_GetEdgeType(theGraph, e) (theGraph->E[e].flags & EDGE_TYPE_MASK) #define gp_ClearEdgeType(theGraph, e) (theGraph->E[e].flags &= ~EDGE_TYPE_MASK) @@ -129,44 +163,42 @@ extern "C" #define gp_ResetEdgeType(theGraph, e, type) \ (theGraph->E[e].flags = (theGraph->E[e].flags & ~EDGE_TYPE_MASK) | type) -#define EDGEFLAG_INVERTED_MASK 16 +#define EDGEFLAG_INVERTED_MASK 32 #define gp_GetEdgeFlagInverted(theGraph, e) (theGraph->E[e].flags & EDGEFLAG_INVERTED_MASK) #define gp_SetEdgeFlagInverted(theGraph, e) (theGraph->E[e].flags |= EDGEFLAG_INVERTED_MASK) #define gp_ClearEdgeFlagInverted(theGraph, e) (theGraph->E[e].flags &= (~EDGEFLAG_INVERTED_MASK)) #define gp_XorEdgeFlagInverted(theGraph, e) (theGraph->E[e].flags ^= EDGEFLAG_INVERTED_MASK) -#define EDGEFLAG_DIRECTION_INONLY 32 -#define EDGEFLAG_DIRECTION_OUTONLY 64 -#define EDGEFLAG_DIRECTION_MASK 96 +#define EDGEFLAG_DIRECTION_INONLY 64 +#define EDGEFLAG_DIRECTION_OUTONLY 128 +#define EDGEFLAG_DIRECTION_MASK 192 // Returns the direction, if any, of the edge record #define gp_GetDirection(theGraph, e) (theGraph->E[e].flags & EDGEFLAG_DIRECTION_MASK) // A direction of 0 clears directedness. Otherwise, edge record e is set -// to edgeFlag_Direction and e's twin arc is set to the opposing setting. -#define gp_SetDirection(theGraph, e, edgeFlag_Direction) \ - { \ - if (edgeFlag_Direction == EDGEFLAG_DIRECTION_INONLY) \ - { \ - theGraph->E[e].flags |= EDGEFLAG_DIRECTION_INONLY; \ - theGraph->E[gp_GetTwinArc(theGraph, e)].flags |= EDGEFLAG_DIRECTION_OUTONLY; \ - } \ - else if (edgeFlag_Direction == EDGEFLAG_DIRECTION_OUTONLY) \ - { \ - theGraph->E[e].flags |= EDGEFLAG_DIRECTION_OUTONLY; \ - theGraph->E[gp_GetTwinArc(theGraph, e)].flags |= EDGEFLAG_DIRECTION_INONLY; \ - } \ - else \ - { \ - theGraph->E[e].flags &= ~(EDGEFLAG_DIRECTION_INONLY | EDGEFLAG_DIRECTION_OUTONLY); \ - theGraph->E[gp_GetTwinArc(theGraph, e)].flags &= ~EDGEFLAG_DIRECTION_MASK; \ - } \ +// to direction and e's twin edge record is set to the opposing setting. +#define gp_SetDirection(theGraph, e, direction) \ + { \ + if (direction == EDGEFLAG_DIRECTION_INONLY) \ + { \ + theGraph->E[e].flags |= EDGEFLAG_DIRECTION_INONLY; \ + theGraph->E[gp_GetTwin(theGraph, e)].flags |= EDGEFLAG_DIRECTION_OUTONLY; \ + } \ + else if (direction == EDGEFLAG_DIRECTION_OUTONLY) \ + { \ + theGraph->E[e].flags |= EDGEFLAG_DIRECTION_OUTONLY; \ + theGraph->E[gp_GetTwin(theGraph, e)].flags |= EDGEFLAG_DIRECTION_INONLY; \ + } \ + else \ + { \ + theGraph->E[e].flags &= ~EDGEFLAG_DIRECTION_MASK; \ + theGraph->E[gp_GetTwin(theGraph, e)].flags &= ~EDGEFLAG_DIRECTION_MASK; \ + } \ } -#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,10 +207,10 @@ 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 + link[2]: the first and last edge records in the adjacency list of the vertex. index: In vertices, stores either the depth first index of a vertex or @@ -193,10 +225,12 @@ extern "C" flags: Bits 0-15 reserved for library; bits 16 and higher for apps Bit 0: visited, for vertices and virtual vertices - Use in lieu of TYPE_VERTEX_VISITED in K4 algorithm - Bit 1: Obstruction type VERTEX_TYPE_SET (versus not set, i.e. VERTEX_TYPE_UNKNOWN) - Bit 2: Obstruction type qualifier RYW (set) versus RXW (clear) - Bit 3: Obstruction type qualifier high (set) versus low (clear) + Bit 1: marked, 2nd visited flag, for while visiting all + Used in K4 homeomorph search algorithm + Bit 2: Obstruction type VERTEX_TYPE_SET (versus not set, i.e. VERTEX_TYPE_UNKNOWN) + Bit 3: Obstruction type qualifier RYW (set) versus RXW (clear) + Bit 4: Obstruction type qualifier high (set) versus low (clear) + Bits 2-4 used in planarity-related algorithms ********************************************************************/ typedef struct @@ -204,129 +238,235 @@ 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]) - -#define gp_SetFirstArc(theGraph, v, newFirstArc) (theGraph->V[v].link[0] = newFirstArc) -#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 +//////////////////////////////////////////// +#define gp_GetFirstEdge(theGraph, v) (theGraph->V[v].link[0]) +#define gp_GetLastEdge(theGraph, v) (theGraph->V[v].link[1]) +#define gp_GetEdgeByLink(theGraph, v, theLink) (theGraph->V[v].link[theLink]) + +#define gp_SetFirstEdge(theGraph, v, newFirstEdge) (theGraph->V[v].link[0] = newFirstEdge) +#define gp_SetLastEdge(theGraph, v, newLastEdge) (theGraph->V[v].link[1] = newLastEdge) +#define gp_SetEdgeByLink(theGraph, v, theLink, newEdge) (theGraph->V[v].link[theLink] = newEdge) + +/////////////////////////////////// +// 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_GetLastVertex(theGraph) (gp_GetN(theGraph)) -#define gp_PrimaryVertexIndexBound(theGraph) (gp_GetFirstVertex(theGraph) + (theGraph)->N) -#define gp_VertexIndexBound(theGraph) (gp_PrimaryVertexIndexBound(theGraph) + (theGraph)->N) +#define gp_GetFirstVirtualVertex(theGraph) (gp_GetN(theGraph) + 1) +#define gp_GetLastVirtualVertex(theGraph) (gp_GetN(theGraph) + gp_GetNV(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 + 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) > gp_GetN(theGraph)) +#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) <= gp_GetN(theGraph)) +#define gp_VertexInRangeDescending(theGraph, v) (v) + +#define gp_VirtualVertexInRangeAscending(theGraph, v) ((v) <= gp_GetN(theGraph) + gp_GetNV(theGraph)) +#define gp_VirtualVertexInRangeDescending(theGraph, v) ((v) > gp_GetN(theGraph)) + +#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) + gp_GetN(theGraph)) +#define gp_AnyTypeVertexArraySize(theGraph) (gp_VertexArraySize(theGraph) + gp_GetNV(theGraph)) + +#define gp_VirtualVertexInUse(theGraph, virtualVertex) (gp_IsEdge(theGraph, gp_GetFirstEdge(theGraph, virtualVertex))) +#define gp_VirtualVertexNotInUse(theGraph, virtualVertex) (gp_IsNotEdge(theGraph, gp_GetFirstEdge(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_GetLastVertex(theGraph) (gp_GetN(theGraph) - 1) + +#define gp_GetFirstVirtualVertex(theGraph) (gp_GetN(theGraph)) +#define gp_GetLastVirtualVertex(theGraph) (gp_GetN(theGraph) + gp_GetNV(theGraph) - 1) -#define gp_PrimaryVertexIndexBound(theGraph) (gp_GetFirstVertex(theGraph) + (theGraph)->N) -#define gp_VertexIndexBound(theGraph) (gp_PrimaryVertexIndexBound(theGraph) + (theGraph)->N) +#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) >= gp_GetN(theGraph)) +#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) < gp_GetN(theGraph)) +#define gp_VertexInRangeDescending(theGraph, v) ((v) >= 0) + +#define gp_VirtualVertexInRangeAscending(theGraph, v) ((v) < gp_GetN(theGraph) + gp_GetNV(theGraph)) +#define gp_VirtualVertexInRangeDescending(theGraph, v) ((v) >= gp_GetN(theGraph)) + +#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) + gp_GetN(theGraph)) +#define gp_AnyTypeVertexArraySize(theGraph) (gp_VertexArraySize(theGraph) + gp_GetNV(theGraph)) + +#define gp_VirtualVertexInUse(theGraph, virtualVertex) (gp_IsEdge(theGraph, gp_GetFirstEdge(theGraph, virtualVertex))) +#define gp_VirtualVertexNotInUse(theGraph, virtualVertex) (gp_IsNotEdge(theGraph, gp_GetFirstEdge(theGraph, virtualVertex))) + +#endif + /////////////////////////////////////////// + // End of Vertex iteration-related methods + ////////////////////////////////////////// + + // 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) + +// PLANARITY-RELATED ONLY +// +// 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) + +// PLANARITY-RELATED ONLY +// +// 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) + gp_GetN(theGraph)) +#define gp_GetDFSChildFromBicompRoot(theGraph, R) ((R) - gp_GetN(theGraph)) +#define gp_GetVertexFromBicompRoot(theGraph, R) gp_GetVertexParent(theGraph, gp_GetDFSChildFromBicompRoot(theGraph, R)) +#define gp_IsBicompRoot(theGraph, v) (!gp_VertexInRangeAscending(theGraph, v)) + +// PLANARITY-RELATED ONLY +// +// 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))) /******************************************************************** + // PLANARITY-RELATED ONLY + // This structure defines a pair of links used by each vertex and virtual vertex - to create "short circuit" paths that eliminate unimportant vertices from - the external face, enabling more efficient traversal of the external face. + to create "short circuit" paths that eliminate unimportant vertices from + the external face, enabling more efficient traversal of the external face. - It is also possible to embed the "short circuit" edges, but this approach - creates a better separation of concerns, imparts greater clarity, and - removes exceptionalities for handling additional fake "short circuit" edges. + It is also possible to embed the "short circuit" edges, but this approach + creates a better separation of concerns, imparts greater clarity, and + removes exceptionalities for handling additional fake "short circuit" edges. - vertex[2]: The two adjacent vertices along the external face, possibly + vertex[2]: The two adjacent vertices along the external face, possibly short-circuiting paths of inactive vertices. */ @@ -341,9 +481,12 @@ extern "C" #define gp_SetExtFaceVertex(theGraph, v, link, theVertex) (theGraph->extFace[v].vertex[link] = theVertex) /******************************************************************** + // PLANARITY-RELATED ONLY + // + 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 @@ -351,10 +494,10 @@ extern "C" lowpoint: min(leastAncestor, min(lowpoint of DFS Children)) visitedInfo: enables algorithms to manage vertex visitation with more than - just a flag. For example, the planarity test flags visitation - as a step number that implicitly resets on each step, whereas - part of the planar drawing method signifies a first visitation - by storing the index of the first edge used to reach a vertex + just a flag. For example, the planarity test flags visitation + as a step number that implicitly resets on each step, whereas + part of the planar drawing method signifies a first visitation + by storing the index of the first edge used to reach a vertex pertinentEdge: Used by the planarity method; during Walkup, each vertex that is directly adjacent via a back edge to the vertex v currently being embedded will have the forward edge's index @@ -379,12 +522,12 @@ extern "C" future pertinence management when processing the ancestors of the vertex. When a child C is merged into the same bicomp as the vertex, it is removed from the list. - fwdArcList: at the start of embedding, the "back" edges from a vertex to - its DFS *descendants* (i.e. the forward arcs of the back edges) - are separated from the main adjacency list and placed in a + fwdEdgeList: at the start of embedding, the "back" edges from a vertex to + its DFS *descendants* (i.e. the forward edge records) are + separated from the main adjacency list and placed in a circular list until they are embedded. The list is sorted in ascending DFI order of the descendants (in linear time). - This member indicates a node in that list. + This member indicates (by index) a node in that list. */ typedef struct @@ -397,7 +540,7 @@ extern "C" pertinentRoots, futurePertinentChild, sortedDFSChildList, - fwdArcList; + fwdEdgeList; } vertexInfo; typedef vertexInfo *vertexInfoP; @@ -420,31 +563,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 || \ @@ -465,19 +614,12 @@ extern "C" #define gp_AppendDFSChild(theGraph, v, c) \ LCAppend(theGraph->sortedDFSChildLists, gp_GetVertexSortedDFSChildList(theGraph, v), c) -#define gp_GetVertexFwdArcList(theGraph, v) (theGraph->VI[v].fwdArcList) -#define gp_SetVertexFwdArcList(theGraph, v, theFwdArcList) (theGraph->VI[v].fwdArcList = theFwdArcList) - -#define gp_CopyVertexInfo(dstGraph, dstI, srcGraph, srcI) (dstGraph->VI[dstI] = srcGraph->VI[srcI]) - -#define gp_SwapVertexInfo(dstGraph, dstPos, srcGraph, srcPos) \ - { \ - vertexInfo tempVI = dstGraph->VI[dstPos]; \ - dstGraph->VI[dstPos] = srcGraph->VI[srcPos]; \ - srcGraph->VI[srcPos] = tempVI; \ - } +#define gp_GetVertexFwdEdgeList(theGraph, v) (theGraph->VI[v].fwdEdgeList) +#define gp_SetVertexFwdEdgeList(theGraph, v, theFwdEdgeList) (theGraph->VI[v].fwdEdgeList = theFwdEdgeList) /******************************************************************** + // PLANARITY-RELATED ONLY + // Variables needed in embedding by Kuratowski subgraph isolator: minorType: the type of planarity obstruction found. v: the current vertex being processed @@ -523,17 +665,18 @@ 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) + E : Array of edge records (edge records come in pairs and represent + an edge in each of the two vertex endpoints of the edge) M: Number of edges (the "size" of the graph) - arcCapacity: the maximum number of edge records allowed in E (the size of E) + edgeCapacity: the maximum number of edges allowed in E edgeHoles: free locations in E where edges have been deleted theStack: Used by various graph routines needing a stack - internalFlags: Additional state information about the graph - embedFlags: controls type of embedding (e.g. planar) + graphFlags: Additional state information about the graph + embedFlags: records the type of embedding requested (uses EMBEDFLAGS) IC: contains additional useful variables for Kuratowski subgraph isolation. BicompRootLists: storage space for pertinent bicomp root lists that develop @@ -548,16 +691,16 @@ extern "C" struct baseGraphStructure { - vertexRecP V; + anyTypeVertexRecP V; vertexInfoP VI; int N, NV; edgeRecP E; - int M, arcCapacity; + int M, edgeCapacity; stackP edgeHoles; stackP theStack; - int internalFlags, embedFlags; + int graphFlags, embedFlags; isolatorContext IC; listCollectionP BicompRootLists, sortedDFSChildLists; @@ -570,137 +713,128 @@ extern "C" typedef struct baseGraphStructure baseGraphStructure; typedef baseGraphStructure *graphP; -#define gp_getN(theGraph) ((theGraph)->N) - - /* 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. - */ +// The current implementation extends the base graph with planarity and outerplanarity +// by default, but a future version may separate these into a "subclass" (extension). +#define gp_ExtendWith_Planarity(theGraph) (OK) +#define gp_ExtendWith_Outerplanarity(theGraph) (OK) -#define FLAGS_DFSNUMBERED 1 -#define FLAGS_SORTEDBYDFI 2 -#define FLAGS_OBSTRUCTIONFOUND 4 -#define FLAGS_ZEROBASEDIO 8 +// While the graph is extended with planarity and outerplanarity by default, +// the extensions are not removable. +#define gp_Detach_Planarity(theGraph) (NOTOK) +#define gp_Detach_Outerplanarity(theGraph) (NOTOK) /******************************************************************** More link structure accessors/manipulators ********************************************************************/ -// 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_GetPrevArcCircular(theGraph, e) \ - (gp_IsArc(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, -// e.g. see gp_AttachFirstArc() and gp_AttachLastArc() -#define gp_BindFirstArc(theGraph, v, arc) \ - { \ - gp_SetPrevArc(theGraph, arc, NIL); \ - gp_SetFirstArc(theGraph, v, arc); \ +// Methods that enable getting the next or previous edge as if +// the adjacency list of the containing vertex were circular, +// i.e. that the first and last edge records were linked +#define gp_GetNextEdgeCircular(theGraph, e) \ + (gp_IsEdge(theGraph, gp_GetNextEdge(theGraph, e)) \ + ? gp_GetNextEdge(theGraph, e) \ + : gp_GetFirstEdge(theGraph, theGraph->E[gp_GetTwin(theGraph, e)].neighbor)) + +#define gp_GetPrevEdgeCircular(theGraph, e) \ + (gp_IsEdge(theGraph, gp_GetPrevEdge(theGraph, e)) \ + ? gp_GetPrevEdge(theGraph, e) \ + : gp_GetLastEdge(theGraph, theGraph->E[gp_GetTwin(theGraph, e)].neighbor)) + +// Methods that make the cross-link binding between a vertex and an +// edge record. The old first or last edge record should be bound to +// this new first or last edge record, e, by separate calls, +// e.g. see gp_AttachFirstEdge() and gp_AttachLastEdge() +#define gp_BindFirstEdge(theGraph, v, e) \ + { \ + gp_SetPrevEdge(theGraph, e, NIL); \ + gp_SetFirstEdge(theGraph, v, e); \ } -#define gp_BindLastArc(theGraph, v, arc) \ - { \ - gp_SetNextArc(theGraph, arc, NIL); \ - gp_SetLastArc(theGraph, v, arc); \ +#define gp_BindLastEdge(theGraph, v, e) \ + { \ + gp_SetNextEdge(theGraph, e, NIL); \ + gp_SetLastEdge(theGraph, v, e); \ } -// Attaches an arc between the current binding between a vertex and its first arc -#define gp_AttachFirstArc(theGraph, v, arc) \ +// Attaches edge e between the current binding between v and its first edge +#define gp_AttachFirstEdge(theGraph, v, e) \ { \ - if (gp_IsArc(gp_GetFirstArc(theGraph, v))) \ + if (gp_IsEdge(theGraph, gp_GetFirstEdge(theGraph, v))) \ { \ - gp_SetNextArc(theGraph, arc, gp_GetFirstArc(theGraph, v)); \ - gp_SetPrevArc(theGraph, gp_GetFirstArc(theGraph, v), arc); \ + gp_SetNextEdge(theGraph, e, gp_GetFirstEdge(theGraph, v)); \ + gp_SetPrevEdge(theGraph, gp_GetFirstEdge(theGraph, v), e); \ } \ else \ - gp_BindLastArc(theGraph, v, arc); \ - gp_BindFirstArc(theGraph, v, arc); \ + gp_BindLastEdge(theGraph, v, e); \ + gp_BindFirstEdge(theGraph, v, e); \ } -// Attaches an arc between the current binding between a vertex and its last arc -#define gp_AttachLastArc(theGraph, v, arc) \ +// Attaches edge e between the current binding between v and its last edge +#define gp_AttachLastEdge(theGraph, v, e) \ { \ - if (gp_IsArc(gp_GetLastArc(theGraph, v))) \ + if (gp_IsEdge(theGraph, gp_GetLastEdge(theGraph, v))) \ { \ - gp_SetPrevArc(theGraph, arc, gp_GetLastArc(theGraph, v)); \ - gp_SetNextArc(theGraph, gp_GetLastArc(theGraph, v), arc); \ + gp_SetPrevEdge(theGraph, e, gp_GetLastEdge(theGraph, v)); \ + gp_SetNextEdge(theGraph, gp_GetLastEdge(theGraph, v), e); \ } \ else \ - gp_BindFirstArc(theGraph, v, arc); \ - gp_BindLastArc(theGraph, v, arc); \ + gp_BindFirstEdge(theGraph, v, e); \ + gp_BindLastEdge(theGraph, v, e); \ } -// Moves an arc that is in the adjacency list of v to the start of the adjacency list -#define gp_MoveArcToFirst(theGraph, v, arc) \ - if (arc != gp_GetFirstArc(theGraph, v)) \ - { \ - /* If the arc is last in the adjacency list of uparent, \ - then we delete it by adjacency list end management */ \ - if (arc == gp_GetLastArc(theGraph, v)) \ - { \ - gp_SetNextArc(theGraph, gp_GetPrevArc(theGraph, arc), NIL); \ - gp_SetLastArc(theGraph, v, gp_GetPrevArc(theGraph, arc)); \ - } \ - /* Otherwise, we delete the arc from the middle of the list */ \ - else \ - { \ - gp_SetNextArc(theGraph, gp_GetPrevArc(theGraph, arc), gp_GetNextArc(theGraph, arc)); \ - gp_SetPrevArc(theGraph, gp_GetNextArc(theGraph, arc), gp_GetPrevArc(theGraph, arc)); \ - } \ - \ - /* Now add arc e as the new first arc of uparent. \ - Note that the adjacency list is non-empty at this time */ \ - gp_SetNextArc(theGraph, arc, gp_GetFirstArc(theGraph, v)); \ - gp_SetPrevArc(theGraph, gp_GetFirstArc(theGraph, v), arc); \ - gp_BindFirstArc(theGraph, v, arc); \ +// Moves an edge e that is in the adjacency list of v to the start of the adjacency list +#define gp_MoveEdgeToFirst(theGraph, v, e) \ + if (e != gp_GetFirstEdge(theGraph, v)) \ + { \ + /* If e is last in the adjacency list of v, then we \ + detach it by adjacency list end management */ \ + if (e == gp_GetLastEdge(theGraph, v)) \ + { \ + gp_SetNextEdge(theGraph, gp_GetPrevEdge(theGraph, e), NIL); \ + gp_SetLastEdge(theGraph, v, gp_GetPrevEdge(theGraph, e)); \ + } \ + /* Otherwise, we detach e from the middle of the list */ \ + else \ + { \ + gp_SetNextEdge(theGraph, gp_GetPrevEdge(theGraph, e), gp_GetNextEdge(theGraph, e)); \ + gp_SetPrevEdge(theGraph, gp_GetNextEdge(theGraph, e), gp_GetPrevEdge(theGraph, e)); \ + } \ + \ + /* Now add e as the new first edge of v. \ + Note that the adjacency list is non-empty at this time */ \ + gp_SetNextEdge(theGraph, e, gp_GetFirstEdge(theGraph, v)); \ + gp_SetPrevEdge(theGraph, gp_GetFirstEdge(theGraph, v), e); \ + gp_BindFirstEdge(theGraph, v, e); \ } -// Moves an arc that is in the adjacency list of v to the end of the adjacency list -#define gp_MoveArcToLast(theGraph, v, arc) \ - if (arc != gp_GetLastArc(theGraph, v)) \ - { \ - /* If the arc is first in the adjacency list of vertex v, \ - then we delete it by adjacency list end management */ \ - if (arc == gp_GetFirstArc(theGraph, v)) \ - { \ - gp_SetPrevArc(theGraph, gp_GetNextArc(theGraph, arc), NIL); \ - gp_SetFirstArc(theGraph, v, gp_GetNextArc(theGraph, arc)); \ - } \ - /* Otherwise, we delete the arc from the middle of the list */ \ - else \ - { \ - gp_SetNextArc(theGraph, gp_GetPrevArc(theGraph, arc), gp_GetNextArc(theGraph, arc)); \ - gp_SetPrevArc(theGraph, gp_GetNextArc(theGraph, arc), gp_GetPrevArc(theGraph, arc)); \ - } \ - \ - /* Now add the arc as the new last arc of v. \ - Note that the adjacency list is non-empty at this time */ \ - gp_SetPrevArc(theGraph, arc, gp_GetLastArc(theGraph, v)); \ - gp_SetNextArc(theGraph, gp_GetLastArc(theGraph, v), arc); \ - gp_BindLastArc(theGraph, v, arc); \ +// Moves an edge e that is in the adjacency list of v to the end of the adjacency list +#define gp_MoveEdgeToLast(theGraph, v, e) \ + if (e != gp_GetLastEdge(theGraph, v)) \ + { \ + /* If e is first in the adjacency list of vertex v, then we \ + detach it by adjacency list beginning management */ \ + if (e == gp_GetFirstEdge(theGraph, v)) \ + { \ + gp_SetPrevEdge(theGraph, gp_GetNextEdge(theGraph, e), NIL); \ + gp_SetFirstEdge(theGraph, v, gp_GetNextEdge(theGraph, e)); \ + } \ + /* Otherwise, we detach e from the middle of the list */ \ + else \ + { \ + gp_SetNextEdge(theGraph, gp_GetPrevEdge(theGraph, e), gp_GetNextEdge(theGraph, e)); \ + gp_SetPrevEdge(theGraph, gp_GetNextEdge(theGraph, e), gp_GetPrevEdge(theGraph, e)); \ + } \ + \ + /* Now we add e as the new last edge of v. \ + Note that the adjacency list is non-empty at this time */ \ + gp_SetPrevEdge(theGraph, e, gp_GetLastEdge(theGraph, v)); \ + gp_SetNextEdge(theGraph, gp_GetLastEdge(theGraph, v), e); \ + gp_BindLastEdge(theGraph, v, e); \ } - // Methods for attaching an arc into the adjacency list or detaching an arc from it. - // The terms AddArc, InsertArc and DeleteArc are not used because the arcs are not - // inserted or added to or deleted from storage (only whole edges are inserted or deleted) - void gp_AttachArc(graphP theGraph, int v, int e, int link, int newArc); - void gp_DetachArc(graphP theGraph, int arc); - /******************************************************************** + // PLANARITY-RELATED ONLY + // PERTINENT() A vertex is pertinent in a partially processed graph if there is an unprocessed back edge between the vertex v whose edges are currently @@ -715,17 +849,22 @@ 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_IsEdge(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_IsNotEdge(theGraph, gp_GetVertexPertinentEdge(theGraph, theVertex)) && \ + gp_IsNotVertex(theGraph, gp_GetVertexPertinentRootsList(theGraph, theVertex))) /******************************************************************** + // PLANARITY-RELATED ONLY + // FUTUREPERTINENT() A vertex is future-pertinent in a partially processed graph if there is an unprocessed back edge between a DFS ancestor A of the @@ -756,24 +895,26 @@ 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_IsEdge(theGraph, theGraph->VI[theVertex].futurePertinentChild)) && // theGraph->VI[theGraph->VI[theVertex].futurePertinentChild].lowpoint < v) ) /******************************************************************** + // PLANARITY-RELATED ONLY + // INACTIVE() For planarity algorithms, a vertex is inactive if it is neither pertinent nor future pertinent. @@ -783,6 +924,46 @@ extern "C" (NOTPERTINENT(theGraph, theVertex) && \ NOTFUTUREPERTINENT(theGraph, theVertex, v)) +/* PRIVATE FUNCTIONS FOR ADDITIONAL INFORMATIONAL LOGGING. + + If LOGGING is defined by uncommenting it below, then log-related lines + write to the log, and otherwise they no-op. + + By default, neither release nor DEBUG builds including LOGGING. + Logging is used to see more details of how various algorithms + handle a particular graph. */ + +// #define LOGGING +#ifdef LOGGING + +#define _gp_LogLine _LogLine +#define _gp_Log _Log + + void _LogLine(const char *Line); + void _Log(const char *Line); + +#define _gp_MakeLogStr1 _MakeLogStr1 +#define _gp_MakeLogStr2 _MakeLogStr2 +#define _gp_MakeLogStr3 _MakeLogStr3 +#define _gp_MakeLogStr4 _MakeLogStr4 +#define _gp_MakeLogStr5 _MakeLogStr5 + + char *_MakeLogStr1(char *format, int); + char *_MakeLogStr2(char *format, int, int); + char *_MakeLogStr3(char *format, int, int, int); + char *_MakeLogStr4(char *format, int, int, int, int); + char *_MakeLogStr5(char *format, int, int, int, int, int); + +#else +#define _gp_LogLine(Line) +#define _gp_Log(Line) +#define _gp_MakeLogStr1(format, one) +#define _gp_MakeLogStr2(format, one, two) +#define _gp_MakeLogStr3(format, one, two, three) +#define _gp_MakeLogStr4(format, one, two, three, four) +#define _gp_MakeLogStr5(format, one, two, three, four, five) +#endif + #ifdef __cplusplus } #endif diff --git a/planarity/c/graphLib/graphUtils.c b/planarity/c/graphLib/graphUtils.c index 3d44464..5ceb730 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. */ @@ -29,8 +29,8 @@ extern int _WritePostprocess(graphP theGraph, char **pExtraData); /* Internal util functions for FUNCTION POINTERS */ int _HideVertex(graphP theGraph, int vertex); -void _HideEdge(graphP theGraph, int arcPos); -void _RestoreEdge(graphP theGraph, int arcPos); +void _HideEdge(graphP theGraph, int e); +void _RestoreEdge(graphP theGraph, int e); int _ContractEdge(graphP theGraph, int e); int _IdentifyVertices(graphP theGraph, int u, int v, int eBefore); int _RestoreVertex(graphP theGraph); @@ -40,19 +40,21 @@ 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 _ClearObstructionMarksInBicomp(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 _gp_FindEdge(graphP theGraph, int u, int v); -int _ComputeArcType(graphP theGraph, int a, int b, int edgeType); +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 _ComputeEdgeRecordType(graphP theGraph, int a, int b, int edgeType); int _SetEdgeType(graphP theGraph, int u, int v); int _HideInternalEdges(graphP theGraph, int vertex); @@ -84,17 +86,19 @@ int _GetRandomNumber(int NMin, int NMax); int _getUnprocessedChild(graphP theGraph, int parent); int _hasUnprocessedChild(graphP theGraph, int parent); -void _RestoreArc(graphP theGraph, int arc); +void _AttachEdgeRecord(graphP theGraph, int v, int e, int link, int newEdge); +void _DetachEdgeRecord(graphP theGraph, int e); +void _RestoreEdgeRecord(graphP theGraph, int e); /* 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); int _InitGraph(graphP theGraph, int N); void _ReinitializeGraph(graphP theGraph); -int _EnsureArcCapacity(graphP theGraph, int requiredArcCapacity); +int _EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity); /******************************************************************** gp_GetProjectVersionFull() @@ -192,7 +196,7 @@ void _InitFunctionTable(graphP theGraph) theGraph->functions.fpInitGraph = _InitGraph; theGraph->functions.fpReinitializeGraph = _ReinitializeGraph; - theGraph->functions.fpEnsureArcCapacity = _EnsureArcCapacity; + theGraph->functions.fpEnsureEdgeCapacity = _EnsureEdgeCapacity; theGraph->functions.fpSortVertices = _SortVertices; theGraph->functions.fpReadPostprocess = _ReadPostprocess; @@ -209,22 +213,23 @@ void _InitFunctionTable(graphP theGraph) /******************************************************************** gp_InitGraph() Allocates memory for vertex and edge records now that N is known. - The arcCapacity is set to (2 * DEFAULT_EDGE_LIMIT * N) unless it - has already been set by gp_EnsureArcCapacity() + The edgeCapacity is set to (DEFAULT_EDGE_LIMIT * N) unless it + has already been set by gp_EnsureEdgeCapacity() For V, we need 2N vertex records, N for vertices and N for virtual vertices (root copies). For VI, we need N vertexInfo records. - For E, we need arcCapacity edge records. + For E, we need 2*edgeCapacity edge records (plus 2 for default of using faster 1-based arrays). The BicompRootLists and sortedDFSChildLists are of size N and start out empty. The stack, initially empty, is made big enough for a pair of integers - per edge record (2 * arcCapacity), or 6N integers if the arcCapacity - was set below the default value. + per edge (2 * edgeCapacity), or 6N integers if the edgeCapacity + was set below the default value. Space for 2 extra integers is added + to allow depth-first search to push (NIL, NIL) to start at a DFS tree root - The edgeHoles stack, initially empty, is set to arcCapacity / 2, + The edgeHoles stack, initially empty, is set to the edgeCapacity, which is big enough to push every edge (to indicate an edge you only need to indicate one of its two edge records) @@ -240,7 +245,7 @@ int gp_InitGraph(graphP theGraph, int N) return NOTOK; // Should not call init a second time; use reinit - if (theGraph->N) + if (gp_GetN(theGraph) > 0) return NOTOK; return theGraph->functions.fpInitGraph(theGraph, N); @@ -253,24 +258,25 @@ int _InitGraph(graphP theGraph, int N) // Compute the vertex and edge capacities of the graph 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); + theGraph->edgeCapacity = theGraph->edgeCapacity > 0 ? theGraph->edgeCapacity : DEFAULT_EDGE_LIMIT * N; + 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; + // Stack size is 2 integers per edge record plus 2 to start depth-first search at a tree root + stackSize = (theGraph->edgeCapacity << 2) + 2; + // In case of small edgeCapacity, ensure minimum based on number of vertices + stackSize = stackSize <= 2 * 2 * DEFAULT_EDGE_LIMIT * N ? 2 * 2 * DEFAULT_EDGE_LIMIT * N + 2 : 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 || (theGraph->sortedDFSChildLists = LCNew(VIsize)) == NULL || (theGraph->theStack = sp_New(stackSize)) == NULL || (theGraph->extFace = (extFaceLinkRecP)calloc(Vsize, sizeof(extFaceLinkRec))) == NULL || - (theGraph->edgeHoles = sp_New(Esize / 2)) == NULL || + (theGraph->edgeHoles = sp_New(theGraph->edgeCapacity)) == NULL || 0) { _ClearGraph(theGraph); @@ -291,35 +297,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,21 +337,21 @@ 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); - for (e = gp_GetFirstEdge(theGraph); e < Esize; e++) + Esize = gp_EdgeArraySize(theGraph); + for (e = gp_EdgeArrayStart(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); - // for (e = gp_GetFirstEdge(theGraph); e < Esize; e++) + // Esize = gp_EdgeArraySize(theGraph); + // for (e = gp_EdgeArrayStart(theGraph); e < Esize; e++) // _InitEdgeRec(theGraph, e); } @@ -357,7 +363,7 @@ void _InitEdges(graphP theGraph) void gp_ReinitializeGraph(graphP theGraph) { - if (theGraph == NULL || theGraph->N <= 0) + if (theGraph == NULL || gp_GetN(theGraph) <= 0) return; theGraph->functions.fpReinitializeGraph(theGraph); @@ -366,7 +372,7 @@ void gp_ReinitializeGraph(graphP theGraph) void _ReinitializeGraph(graphP theGraph) { theGraph->M = 0; - theGraph->internalFlags = theGraph->embedFlags = 0; + theGraph->graphFlags = theGraph->embedFlags = 0; _InitVertices(theGraph); _InitEdges(theGraph); @@ -379,120 +385,100 @@ void _ReinitializeGraph(graphP theGraph) } /******************************************************************** - gp_GetArcCapacity() - Returns the arcCapacity of theGraph, which is twice the maximum - number of edges that can be added to the theGraph. - ********************************************************************/ -int gp_GetArcCapacity(graphP theGraph) -{ - return theGraph->arcCapacity - gp_GetFirstEdge(theGraph); -} + gp_EnsureEdgeCapacity() -/******************************************************************** - gp_EnsureArcCapacity() This method ensures that theGraph is or will be capable of storing - at least requiredArcCapacity edge records. Two edge records are + at least requiredEdgeCapacity edge records. Two edge records are needed per edge. This method is most performant when invoked immediately after - gp_New(), since it must only set the arcCapacity and then let + gp_New(), since it must only set the edgeCapacity and then let normal initialization to occur through gp_InitGraph(). This method is also a constant time operation if the graph already - has at least the requiredArcCapacity, since it will return OK + has at least the requiredEdgeCapacity, since it will return OK without making any structural changes. This method is generally more performant if it is invoked before attaching extensions to the graph. Some extensions associate parallel data with edge records, which is a faster operation if the associated data is created and initialized only after the - proper arcCapacity is specified. + proper edgeCapacity is specified. - If the graph has been initialized and has a lower arc capacity, - then the array of edge records is reallocated to satisfy the - requiredArcCapacity. The new array contains the old edges and - edge holes at the same locations, and all newly created edge records - are initialized. + If the graph has been initialized and has a lower edge capacity + than required, then the array of edge records is reallocated to + satisfy the requiredEdgeCapacity. The new array contains the + old edges and edge holes at the same locations, and all newly + created edge records are initialized. - Also, if the arc capacity must be increased, then the - arcCapacity member of theGraph is changed and both - theStack and edgeHoles are expanded (since the sizes of both - are based on the arc capacity). + Also, if the edge capacity was lower than required, then the + edgeCapacity member of theGraph is changed and storage for both + theStack and the edgeHoles are expanded (since the sizes of both + are based on the edge capacity). Extensions that add to data associated with edges must overload this method to ensure capacity in the parallel extension data structures. An extension can return NOTOK if it does not - support arc capacity expansion. The extension function will - not be called if arcCapacity is expanded before the graph is + support edge capacity expansion. The extension function will + not be called if edgeCapacity is expanded before the graph is initialized, and it is assumed that extensions will allocate - parallel data structures according to the arc capacity. - - If an extension supports arc capacity expansion, then higher - performance can be obtained by using the method of unhooking - the initializers for individual edge records before invoking - the superclass version of fpEnsureArcCapacity(). Ideally, - application authors should ensure the proper arc capacity before - attaching extensions to achieve better performance. + parallel data structures according to the edge capacity. Returns NOTOK on failure to reallocate the edge record array to - satisfy the requiredArcCapacity, or if the requested - capacity is odd - OK if reallocation is not required or if reallocation succeeds + satisfy the requiredEdgeCapacity + OK if reallocation succeeds or is not required ********************************************************************/ -int gp_EnsureArcCapacity(graphP theGraph, int requiredArcCapacity) +int gp_EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity) { - if (theGraph == NULL || requiredArcCapacity <= 0) - return NOTOK; - - // Train callers to only ask for an even number of arcs, since - // two are required per edge or directed edge. - if (requiredArcCapacity & 1) + if (theGraph == NULL || requiredEdgeCapacity <= 0) return NOTOK; - if (theGraph->arcCapacity >= requiredArcCapacity) + if (theGraph->edgeCapacity >= requiredEdgeCapacity) return OK; // In the special case where gp_InitGraph() has not yet been called, - // we can simply set the higher arcCapacity since normal initialization + // we can simply set the higher edgeCapacity since normal initialization // will then allocate the correct number of edge records. - if (theGraph->N == 0) + if (gp_GetN(theGraph) == 0) { - theGraph->arcCapacity = requiredArcCapacity; + theGraph->edgeCapacity = requiredEdgeCapacity; return OK; } - // Try to expand the arc capacity - return theGraph->functions.fpEnsureArcCapacity(theGraph, requiredArcCapacity); + // Try to expand the edge capacity + return theGraph->functions.fpEnsureEdgeCapacity(theGraph, requiredEdgeCapacity); } -int _EnsureArcCapacity(graphP theGraph, int requiredArcCapacity) +int _EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity) { - stackP newStack; - int e, Esize = gp_EdgeIndexBound(theGraph), - newEsize = gp_GetFirstEdge(theGraph) + requiredArcCapacity; + stackP newStack = NULL; + int e, Esize = gp_EdgeArraySize(theGraph), + newEsize = gp_EdgeArrayStart(theGraph) + (requiredEdgeCapacity << 1); // If the new size is less than or equal to the old size, then - // the graph already has the required arc capacity + // the graph already has the required edge capacity if (newEsize <= Esize) return OK; - // Expand theStack - if (sp_GetCapacity(theGraph->theStack) < 2 * requiredArcCapacity) + // Expand theStack. Depth-first search needs 2 integers per edge record + // (2 edge records per edge), plus 2 to start the DFS on a tree root + // + if (sp_GetCapacity(theGraph->theStack) < 2 * (2 * requiredEdgeCapacity) + 2) { - int stackSize = 2 * requiredArcCapacity; + int newStackSize = 2 * (2 * requiredEdgeCapacity) + 2; - if (stackSize < 6 * theGraph->N) + if (newStackSize < 2 * DEFAULT_EDGE_LIMIT * gp_GetN(theGraph) + 2) { - // NOTE: Since this routine only makes the stack bigger, this - // calculation is not needed here because we already ensured - // we had stack capacity of the greater of 2*arcs and 6*N - // But we do it for clarity and consistency (e.g. so this rule - // is not forgotten whenever a "SetArcCapacity" method or a - // "reduceArcCapacity" method is added) - stackSize = 6 * theGraph->N; + // NOTE: We enforce a minimum stack based on number of vertices + // if edgeCapacity is small. Currently, this will not + // happen because we only 'ensure' edge capacity, i.e., + // the capacity can only ever get bigger. However, this + // rule is enforced in case future methods are added + // that reduce edge capacity + newStackSize = 2 * DEFAULT_EDGE_LIMIT * gp_GetN(theGraph) + 2; } - if ((newStack = sp_New(stackSize)) == NULL) + if ((newStack = sp_New(newStackSize)) == NULL) return NOTOK; sp_CopyContent(newStack, theGraph->theStack); @@ -500,8 +486,8 @@ int _EnsureArcCapacity(graphP theGraph, int requiredArcCapacity) theGraph->theStack = newStack; } - // Expand edgeHoles - if ((newStack = sp_New(requiredArcCapacity / 2)) == NULL) + // Expand edgeHoles (at most, every edge is a hole if all edges deleted) + if ((newStack = sp_New(requiredEdgeCapacity)) == NULL) { return NOTOK; } @@ -519,22 +505,22 @@ int _EnsureArcCapacity(graphP theGraph, int requiredArcCapacity) for (e = Esize; e < newEsize; e++) _InitEdgeRec(theGraph, e); - // The new arcCapacity has been successfully achieved - theGraph->arcCapacity = requiredArcCapacity; + // The new edgeCapacity has been successfully allocated + theGraph->edgeCapacity = requiredEdgeCapacity; return OK; } /******************************************************************** - _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_SetFirstEdge(theGraph, v, NIL); + gp_SetLastEdge(theGraph, v, NIL); + gp_SetIndex(theGraph, v, NIL); + gp_InitFlags(theGraph, v); } /******************************************************************** @@ -553,7 +539,7 @@ void _InitVertexInfo(graphP theGraph, int v) gp_SetVertexPertinentRootsList(theGraph, v, NIL); gp_SetVertexFuturePertinentChild(theGraph, v, NIL); gp_SetVertexSortedDFSChildList(theGraph, v, NIL); - gp_SetVertexFwdArcList(theGraph, v, NIL); + gp_SetVertexFwdEdgeList(theGraph, v, NIL); } /******************************************************************** @@ -564,8 +550,8 @@ void _InitVertexInfo(graphP theGraph, int v) void _InitEdgeRec(graphP theGraph, int e) { gp_SetNeighbor(theGraph, e, NIL); - gp_SetPrevArc(theGraph, e, NIL); - gp_SetNextArc(theGraph, e, NIL); + gp_SetPrevEdge(theGraph, e, NIL); + gp_SetNextEdge(theGraph, e, NIL); gp_InitEdgeFlags(theGraph, e); } @@ -583,29 +569,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,16 +604,16 @@ void _ClearEdgeVisitedFlags(graphP theGraph) { int e, EsizeOccupied; - EsizeOccupied = gp_EdgeInUseIndexBound(theGraph); - for (e = gp_GetFirstEdge(theGraph); e < EsizeOccupied; e++) + EsizeOccupied = gp_EdgeInUseArraySize(theGraph); + for (e = gp_EdgeArrayStart(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. + Clears the visited flag of the vertices and edge records in the + bicomp rooted by BicompRoot. This method uses the stack but preserves whatever may have been on it. In debug mode, it will return NOTOK if the stack overflows. @@ -634,7 +622,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,28 +631,28 @@ 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)) + e = gp_GetFirstEdge(theGraph, v); + while (gp_IsEdge(theGraph, e)) { gp_ClearEdgeVisited(theGraph, e); if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) sp_Push(theGraph->theStack, gp_GetNeighbor(theGraph, e)); - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } } return OK; } /******************************************************************** - _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 +660,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,32 +676,32 @@ 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)) + e = gp_GetVertexFwdEdgeList(theGraph, v); + while (gp_IsEdge(theGraph, e)) { gp_ClearEdgeVisited(theGraph, e); - gp_ClearEdgeVisited(theGraph, gp_GetTwinArc(theGraph, e)); + gp_ClearEdgeVisited(theGraph, gp_GetTwin(theGraph, e)); - e = gp_GetNextArc(theGraph, e); - if (e == gp_GetVertexFwdArcList(theGraph, v)) + e = gp_GetNextEdge(theGraph, e); + if (e == gp_GetVertexFwdEdgeList(theGraph, v)) e = NIL; } } } /**************************************************************************** - _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,40 +710,40 @@ 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)) + eTwin = _gp_FindEdge(theGraph, v, u); + if (gp_IsNotEdge(theGraph, eTwin)) return NOTOK; - e = gp_GetTwinArc(theGraph, eTwin); + e = gp_GetTwin(theGraph, eTwin); v = u; do { // Mark the vertex and the exiting edge - gp_ClearVertexVisited(theGraph, v); + gp_ClearVisited(theGraph, v); gp_ClearEdgeVisited(theGraph, e); gp_ClearEdgeVisited(theGraph, eTwin); // Get the next vertex v = gp_GetNeighbor(theGraph, e); - e = gp_GetNextArcCircular(theGraph, eTwin); - eTwin = gp_GetTwinArc(theGraph, e); + e = gp_GetNextEdgeCircular(theGraph, eTwin); + eTwin = gp_GetTwin(theGraph, e); } 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,34 +752,34 @@ 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)) + eTwin = _gp_FindEdge(theGraph, v, u); + if (gp_IsNotEdge(theGraph, eTwin)) return NOTOK; - e = gp_GetTwinArc(theGraph, eTwin); + e = gp_GetTwin(theGraph, eTwin); v = u; do { // Mark the vertex and the exiting edge - gp_SetVertexVisited(theGraph, v); + gp_SetVisited(theGraph, v); gp_SetEdgeVisited(theGraph, e); gp_SetEdgeVisited(theGraph, eTwin); // Get the next vertex v = gp_GetNeighbor(theGraph, e); - e = gp_GetNextArcCircular(theGraph, eTwin); - eTwin = gp_GetTwinArc(theGraph, e); + e = gp_GetNextEdgeCircular(theGraph, eTwin); + eTwin = gp_GetTwin(theGraph, e); } while (v != x); // Mark the last vertex with 'visited' - gp_SetVertexVisited(theGraph, x); + gp_SetVisited(theGraph, x); return OK; } @@ -822,20 +810,20 @@ int _FillVertexVisitedInfoInBicomp(graphP theGraph, int BicompRoot, int FillValu if (gp_IsNotVirtualVertex(theGraph, v)) gp_SetVertexVisitedInfo(theGraph, v, FillValue); - e = gp_GetFirstArc(theGraph, v); - while (gp_IsArc(e)) + e = gp_GetFirstEdge(theGraph, v); + while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) sp_Push(theGraph->theStack, gp_GetNeighbor(theGraph, e)); - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } } return OK; } /******************************************************************** - _ClearVertexTypeInBicomp() + _ClearObstructionMarksInBicomp() Clears the 'obstruction type' bits for each vertex in the bicomp rooted by BicompRoot. @@ -847,7 +835,7 @@ int _FillVertexVisitedInfoInBicomp(graphP theGraph, int BicompRoot, int FillValu Returns OK on success, NOTOK on implementation failure. ********************************************************************/ -int _ClearVertexTypeInBicomp(graphP theGraph, int BicompRoot) +int _ClearObstructionMarksInBicomp(graphP theGraph, int BicompRoot) { int V, e; int stackBottom = sp_GetCurrentSize(theGraph->theStack); @@ -856,15 +844,15 @@ 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)) + e = gp_GetFirstEdge(theGraph, V); + while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) sp_Push(theGraph->theStack, gp_GetNeighbor(theGraph, e)); - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } } return OK; @@ -897,8 +885,8 @@ void _ClearGraph(graphP theGraph) theGraph->N = 0; theGraph->NV = 0; theGraph->M = 0; - theGraph->arcCapacity = 0; - theGraph->internalFlags = 0; + theGraph->edgeCapacity = 0; + theGraph->graphFlags = 0; theGraph->embedFlags = 0; _InitIsolatorContext(theGraph); @@ -921,8 +909,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) @@ -947,8 +935,8 @@ void gp_Free(graphP *pGraph) include NV). Returns OK on success, NOTOK on failures, e.g. if the two graphs - have different orders N or if the arcCapacity of dstGraph cannot - be increased to match that of srcGraph. + have different orders N or if the edgeCapacity of dstGraph cannot + be made to be at least that of srcGraph. ********************************************************************/ int gp_CopyAdjacencyLists(graphP dstGraph, graphP srcGraph) { @@ -957,30 +945,30 @@ int gp_CopyAdjacencyLists(graphP dstGraph, graphP srcGraph) if (dstGraph == NULL || srcGraph == NULL) return NOTOK; - if (dstGraph->N != srcGraph->N || dstGraph->N == 0) + if (gp_GetN(dstGraph) != gp_GetN(srcGraph) || gp_GetN(dstGraph) == 0) return NOTOK; - if (gp_EnsureArcCapacity(dstGraph, srcGraph->arcCapacity) != OK) + if (gp_EnsureEdgeCapacity(dstGraph, srcGraph->edgeCapacity) != OK) 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)); + gp_SetFirstEdge(dstGraph, v, gp_GetFirstEdge(srcGraph, v)); + gp_SetLastEdge(dstGraph, v, gp_GetLastEdge(srcGraph, v)); } - // Copy the adjacency links and neighbor pointers for each arc - EsizeOccupied = gp_EdgeInUseIndexBound(srcGraph); - for (e = gp_GetFirstEdge(theGraph); e < EsizeOccupied; e++) + // Copy the adjacency links and neighbor pointers for each edge record + EsizeOccupied = gp_EdgeInUseArraySize(srcGraph); + for (e = gp_EdgeArrayStart(theGraph); e < EsizeOccupied; e++) { gp_SetNeighbor(dstGraph, e, gp_GetNeighbor(srcGraph, e)); - gp_SetNextArc(dstGraph, e, gp_GetNextArc(srcGraph, e)); - gp_SetPrevArc(dstGraph, e, gp_GetPrevArc(srcGraph, e)); + gp_SetNextEdge(dstGraph, e, gp_GetNextEdge(srcGraph, e)); + gp_SetPrevEdge(dstGraph, e, gp_GetPrevEdge(srcGraph, e)); } // Tell the dstGraph how many edges it now has and where the edge holes are - dstGraph->M = srcGraph->M; + dstGraph->M = gp_GetM(srcGraph); sp_Copy(dstGraph->edgeHoles, srcGraph->edgeHoles); return OK; @@ -988,13 +976,24 @@ 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. + + NOTE: If the dstGraph has a higher edge capacity than the srcGraph, + then this call will fail unless the caller first ensures that the + edge capacity of the srcGraph is increased to match the dstGraph. Returns OK for success, NOTOK for failure. ********************************************************************/ +// Give macro names to three copy operations +#define _gp_CopyAnyTypeVertexRec(dstGraph, vdst, srcGraph, vsrc) (dstGraph->V[vdst] = srcGraph->V[vsrc]) +#define _gp_CopyVertexInfo(dstGraph, dstI, srcGraph, srcI) (dstGraph->VI[dstI] = srcGraph->VI[srcI]) +#define _gp_CopyEdgeRec(dstGraph, edst, srcGraph, esrc) (dstGraph->E[edst] = srcGraph->E[esrc]) + int gp_CopyGraph(graphP dstGraph, graphP srcGraph) { int v, e, Esize; @@ -1006,50 +1005,64 @@ int gp_CopyGraph(graphP dstGraph, graphP srcGraph) } // The graphs need to be the same order and initialized - if (dstGraph->N != srcGraph->N || dstGraph->N == 0) + if (gp_GetN(dstGraph) != gp_GetN(srcGraph) || gp_GetN(dstGraph) == 0) { return NOTOK; } - // Ensure dstGraph has the required arc capacity; this expands + // Ensure dstGraph has the required edge capacity; this expands // dstGraph if needed, but does not contract. An error is only // returned if the expansion fails. - if (gp_EnsureArcCapacity(dstGraph, srcGraph->arcCapacity) != OK) + if (gp_EnsureEdgeCapacity(dstGraph, srcGraph->edgeCapacity) != OK) { return NOTOK; } - // Copy the primary vertices. Augmentations to vertices created + // If the dstGraph has a larger edge capacity than the srcGraph + // then we report failure because the code below only gives valid + // values to edge records up to the edge capacity of the srcGraph + // It would be possible to invoke _InitEdgeRec() on the extra + // edge records 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->edgeCapacity > srcGraph->edgeCapacity) + { + 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_CopyVertexInfo(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)); } // 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); - for (e = gp_GetFirstEdge(theGraph); e < Esize; e++) - gp_CopyEdgeRec(dstGraph, e, srcGraph, e); + Esize = gp_EdgeArraySize(srcGraph); + for (e = gp_EdgeArrayStart(theGraph); e < Esize; e++) + _gp_CopyEdgeRec(dstGraph, e, srcGraph, e); // Give the dstGraph the same size and intrinsic properties - dstGraph->N = srcGraph->N; - dstGraph->NV = srcGraph->NV; - dstGraph->M = srcGraph->M; - dstGraph->internalFlags = srcGraph->internalFlags; - dstGraph->embedFlags = srcGraph->embedFlags; + dstGraph->N = gp_GetN(srcGraph); + dstGraph->NV = gp_GetNV(srcGraph); + dstGraph->M = gp_GetM(srcGraph); + dstGraph->graphFlags = gp_GetGraphFlags(srcGraph); + dstGraph->embedFlags = gp_GetEmbedFlags(srcGraph); dstGraph->IC = srcGraph->IC; @@ -1086,12 +1099,12 @@ int gp_CopyGraph(graphP dstGraph, graphP srcGraph) graphP gp_DupGraph(graphP theGraph) { - graphP result; + graphP result = NULL; if ((result = gp_New()) == NULL) return NULL; - if (gp_InitGraph(result, theGraph->N) != OK || + if (gp_InitGraph(result, gp_GetN(theGraph)) != OK || gp_CopyGraph(result, theGraph) != OK) { gp_Free(&result); @@ -1118,14 +1131,14 @@ int gp_CreateRandomGraph(graphP theGraph) { int N, M, u, v, m; - N = theGraph->N; + N = gp_GetN(theGraph); /* Generate a random tree; note that this method virtually guarantees that the graph will be renumbered, but it is linear time. 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) @@ -1136,7 +1149,7 @@ int gp_CreateRandomGraph(graphP theGraph) (actually, leave open a small chance that no additional edges will be added). */ - M = _GetRandomNumber(7 * N / 8, theGraph->arcCapacity / 2); + M = _GetRandomNumber(7 * N / 8, theGraph->edgeCapacity); if (M > N * (N - 1) / 2) M = N * (N - 1) / 2; @@ -1196,15 +1209,14 @@ int _GetRandomNumber(int NMin, int NMax) int _getUnprocessedChild(graphP theGraph, int parent) { - int e = gp_GetFirstArc(theGraph, parent); - int eTwin = gp_GetTwinArc(theGraph, e); + int e = gp_GetFirstEdge(theGraph, parent); + int eTwin = gp_GetTwin(theGraph, e); int child = gp_GetNeighbor(theGraph, e); // The tree edges were added to the beginning of the adjacency list, - // and we move processed tree edge records to the end of the list, - // so if the immediate next arc (edge record) is not a tree edge - // then we return NIL because the vertex has no remaining - // unprocessed children + // and we move processed tree edge records to the end of the list, so + // if the immediate next edge record is not a tree edge, then we + // return NIL because the vertex has no remaining unprocessed children if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_NOTDEFINED) return NIL; @@ -1223,11 +1235,11 @@ int _getUnprocessedChild(graphP theGraph, int parent) // Now we move the edge record in the parent vertex to the end // of the adjacency list of that vertex. - gp_MoveArcToLast(theGraph, parent, e); + gp_MoveEdgeToLast(theGraph, parent, e); // Now we move the edge record in the child vertex to the // end of the adjacency list of the child. - gp_MoveArcToLast(theGraph, child, eTwin); + gp_MoveEdgeToLast(theGraph, child, eTwin); // Now we set the child's parent and return the child. gp_SetVertexParent(theGraph, child, parent); @@ -1245,7 +1257,7 @@ int _getUnprocessedChild(graphP theGraph, int parent) int _hasUnprocessedChild(graphP theGraph, int parent) { - int e = gp_GetFirstArc(theGraph, parent); + int e = gp_GetFirstEdge(theGraph, parent); if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_NOTDEFINED) return 0; @@ -1258,28 +1270,29 @@ int _hasUnprocessedChild(graphP theGraph, int parent) /******************************************************************** gp_CreateRandomGraphEx() + Given a graph structure with a pre-specified number of vertices N, this function creates a graph with the specified number of edges. If numEdges <= 3N-6, then the graph generated is planar. If numEdges is larger, then a maximal planar graph is generated, then - (numEdges - 3N + 6) additional random edges are added. + (numEdges - (3N - 6)) additional random edges are added. This function assumes the caller has already called srand(). ********************************************************************/ int gp_CreateRandomGraphEx(graphP theGraph, int numEdges) { - int N, arc, M, root, v, c, p, last, u, e, EsizeOccupied; + int N, M, root, v, c, p, last, u, e, EsizeOccupied; - N = theGraph->N; + N = gp_GetN(theGraph); - if (numEdges > theGraph->arcCapacity / 2) - numEdges = theGraph->arcCapacity / 2; + if (numEdges > theGraph->edgeCapacity) + numEdges = theGraph->edgeCapacity; /* 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) @@ -1287,11 +1300,11 @@ int gp_CreateRandomGraphEx(graphP theGraph, int numEdges) else { - arc = gp_GetNeighborEdgeRecord(theGraph, u, v); - gp_SetEdgeType(theGraph, arc, EDGE_TYPE_RANDOMTREE); - gp_SetEdgeType(theGraph, gp_GetTwinArc(theGraph, arc), EDGE_TYPE_RANDOMTREE); - gp_ClearEdgeVisited(theGraph, arc); - gp_ClearEdgeVisited(theGraph, gp_GetTwinArc(theGraph, arc)); + e = _gp_FindEdge(theGraph, u, v); + gp_SetEdgeType(theGraph, e, EDGE_TYPE_RANDOMTREE); + gp_SetEdgeType(theGraph, gp_GetTwin(theGraph, e), EDGE_TYPE_RANDOMTREE); + gp_ClearEdgeVisited(theGraph, e); + gp_ClearEdgeVisited(theGraph, gp_GetTwin(theGraph, e)); } } @@ -1302,11 +1315,11 @@ int gp_CreateRandomGraphEx(graphP theGraph, int numEdges) root = gp_GetFirstVertex(theGraph); v = last = _getUnprocessedChild(theGraph, root); - while (v != root && theGraph->M < M) + while (v != root && gp_GetM(theGraph) < M) { c = _getUnprocessedChild(theGraph, v); - if (gp_IsVertex(c)) + if (gp_IsVertex(theGraph, c)) { if (last != v) { @@ -1323,18 +1336,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) { @@ -1367,7 +1380,7 @@ int gp_CreateRandomGraphEx(graphP theGraph, int numEdges) /* Add additional edges if the limit has not yet been reached. */ - while (theGraph->M < numEdges) + while (gp_GetM(theGraph) < numEdges) { u = _GetRandomNumber(gp_GetFirstVertex(theGraph), gp_GetLastVertex(theGraph)); v = _GetRandomNumber(gp_GetFirstVertex(theGraph), gp_GetLastVertex(theGraph)); @@ -1379,7 +1392,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 +1401,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; @@ -1397,93 +1410,218 @@ int gp_CreateRandomGraphEx(graphP theGraph, int numEdges) /******************************************************************** gp_IsNeighbor() - Checks whether v is already in u's adjacency list, i.e. does the arc - u -> v exist. - If there is an edge record for v in u's list, but it is marked INONLY, - then it represents the arc v->u but not u->v, so it is ignored. + Checks whether the adjacency list of an any-type vertex u contains an + edge record with a neighbor field indicating v. Returns TRUE or FALSE. + + NOTE: The edge may be undirected, INONLY or OUTONLY. To test if + v is an in-neighbor or out-neighbor of u, use the directed + method gp_IsNeighborDirected() instead. ********************************************************************/ 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_GetFirstEdge(theGraph, u); + while (gp_IsEdge(theGraph, e)) + { + if (gp_GetNeighbor(theGraph, e) == v) + return TRUE; + + e = gp_GetNextEdge(theGraph, e); + } + return FALSE; +} + +/******************************************************************** + gp_IsNeighborDirected() + + Checks whether the adjacency list of an any-type vertex u contains an + edge record with a neighbor field indicating v and a direction flag + matching the direction parameter. + + Returns TRUE or FALSE. + + NOTE: The valid direction flag values are 0 to match any edge record, + or EDGEFLAG_DIRECTION_INONLY to test if v is an in-neighbor of u, + or EDGEFLAG_DIRECTION_OUTONLY to test if v is an out-neighbor of u. + ********************************************************************/ +int gp_IsNeighborDirected(graphP theGraph, int u, int v, unsigned direction) +{ + int e = NIL; + + if (theGraph == NULL || + u < gp_GetFirstVertex(theGraph) || u >= gp_AnyTypeVertexArraySize(theGraph) || + v < gp_GetFirstVertex(theGraph) || v >= gp_AnyTypeVertexArraySize(theGraph) || + (direction != 0 && direction != EDGEFLAG_DIRECTION_INONLY && direction != EDGEFLAG_DIRECTION_OUTONLY)) + { +#ifdef DEBUG + NOTOK; +#endif + return FALSE; + } + + e = gp_GetFirstEdge(theGraph, u); + while (gp_IsEdge(theGraph, e)) { if (gp_GetNeighbor(theGraph, e) == v) { - if (gp_GetDirection(theGraph, e) != EDGEFLAG_DIRECTION_INONLY) + if (direction == 0 || direction == gp_GetDirection(theGraph, e)) return TRUE; } - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } return FALSE; } /******************************************************************** - gp_GetNeighborEdgeRecord() - Searches the adjacency list of u to obtains the edge record for v. - - NOTE: The caller should check whether the edge record is INONLY; - This method returns any edge record representing a connection - between vertices u and v, so this method can return an - edge record even if gp_IsNeighbor(theGraph, u, v) is false (0). - To filter out INONLY edge records, use gp_GetDirection() on - the edge record returned by this method. - - Returns NIL if there is no edge record indicating v in u's adjacency - list, or the edge record location otherwise. + gp_FindEdge() + + Searches the adjacency list of an any-type of vertex u to obtain an + edge record with v in the neighbor field. + + Returns the edge record's location, or NIL if there is no such edge. + + NOTE: The returned edge may be undirected, INONLY or OUTONLY. + This method is intended for when a graph is undirected or + when an application must treat a directed graph as if it + is undirected. To obtain a result for INONLY or OUTONLY + edges, use gp_FindDirectedEdge() instead. ********************************************************************/ -int gp_GetNeighborEdgeRecord(graphP theGraph, int u, int v) +int gp_FindEdge(graphP theGraph, int u, int v) { - int e; + 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)) + return _gp_FindEdge(theGraph, u, v); +} + +/***************************************************************** + * _gp_FindEdge() + * + * Private version of the public method that performs the search + * without preceding parameter validation checks. This is called + * from other private methods of the graph library, to avoid + * duplication of the effort of the checks performed by invoking + * public methods. + */ +int _gp_FindEdge(graphP theGraph, int u, int v) +{ + int e = gp_GetFirstEdge(theGraph, u); + while (gp_IsEdge(theGraph, e)) { if (gp_GetNeighbor(theGraph, e) == v) return e; - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } return NIL; } /******************************************************************** - gp_GetVertexDegree() + gp_FindDirectedEdge() - Counts the number of edge records in the adjacency list of a given - vertex V. + Searches the adjacency list of an any-type of vertex u to obtain an + edge record that matches the direction flag and that has v in the + neighbor field. - Note: For digraphs, this method returns the total degree of the - vertex, including outward arcs (undirected and OUTONLY) - as well as INONLY arcs. Other functions are defined to get - the in-degree or out-degree of the vertex. + Returns the edge record's location, or NIL if there is no such edge. - Note: This function determines the degree by counting. An extension - could cache the degree value of each vertex and update the - cached value as edges are added and deleted. + NOTE: The valid direction flag value are 0 for any direction, + EDGEFLAG_DIRECTION_INONLY, or EDGEFLAG_DIRECTION_OUTONLY. ********************************************************************/ +int gp_FindDirectedEdge(graphP theGraph, int u, int v, unsigned direction) +{ + int e = NIL; + + if (theGraph == NULL || + u < gp_GetFirstVertex(theGraph) || u >= gp_AnyTypeVertexArraySize(theGraph) || + v < gp_GetFirstVertex(theGraph) || v >= gp_AnyTypeVertexArraySize(theGraph) || + (direction != 0 && direction != EDGEFLAG_DIRECTION_INONLY && direction != EDGEFLAG_DIRECTION_OUTONLY)) + { +#ifdef DEBUG + NOTOK; +#endif + + return NIL; + } + + // If undirected, call the undirected version + if (direction == 0) + return _gp_FindEdge(theGraph, u, v); + + // If a direction was given, then use it + e = gp_GetFirstEdge(theGraph, u); + while (gp_IsEdge(theGraph, e)) + { + if (gp_GetNeighbor(theGraph, e) == v && + gp_GetDirection(theGraph, e) == direction) + return e; + + e = gp_GetNextEdge(theGraph, e); + } + return NIL; +} + +/******************************************************************** + gp_GetVertexDegree() + +Counts the number of edge records in the adjacency list of a given +vertex V. + +NOTE: For digraphs, this method returns the total degree of the + vertex, including undirected, OUTONLY and INONLY edge records. + Other functions are defined to get the in-degree or out-degree + of a vertex. + +NOTE: This function determines the degree by counting. An extension + could cache the degree value of each vertex and update the + cached value as edges are added and deleted. +********************************************************************/ 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)) + e = gp_GetFirstEdge(theGraph, v); + while (gp_IsEdge(theGraph, e)) { degree++; - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } return degree; @@ -1493,11 +1631,11 @@ int gp_GetVertexDegree(graphP theGraph, int v) gp_GetVertexInDegree() Counts the number of edge records in the adjacency list of a given - vertex V that represent arcs from another vertex into V. - This includes undirected edges and INONLY arcs, so it only excludes - edges records that are marked as OUTONLY arcs. + vertex v that represent edge records from another vertex into v. + This includes undirected edges and INONLY edge records, so it only + excludes edges records that are marked as OUTONLY. - Note: This function determines the in-degree by counting. An extension + NOTE: This function determines the in-degree by counting. An extension could cache the in-degree value of each vertex and update the cached value as edges are added and deleted. ********************************************************************/ @@ -1506,17 +1644,24 @@ 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)) + e = gp_GetFirstEdge(theGraph, v); + while (gp_IsEdge(theGraph, e)) { if (gp_GetDirection(theGraph, e) != EDGEFLAG_DIRECTION_OUTONLY) degree++; - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } return degree; @@ -1526,11 +1671,11 @@ int gp_GetVertexInDegree(graphP theGraph, int v) gp_GetVertexOutDegree() Counts the number of edge records in the adjacency list of a given - vertex V that represent arcs from V to another vertex. - This includes undirected edges and OUTONLY arcs, so it only excludes - edges records that are marked as INONLY arcs. + vertex V that represent edges from V to another vertex. + This includes undirected edges and OUTONLY edges, so it only excludes + edges records that are marked as INONLY edges. - Note: This function determines the out-degree by counting. An extension + NOTE: This function determines the out-degree by counting. An extension could cache the out-degree value of each vertex and update the cached value as edges are added and deleted. ********************************************************************/ @@ -1539,124 +1684,134 @@ 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)) + e = gp_GetFirstEdge(theGraph, v); + while (gp_IsEdge(theGraph, e)) { if (gp_GetDirection(theGraph, e) != EDGEFLAG_DIRECTION_INONLY) degree++; - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } return degree; } /******************************************************************** - gp_AttachArc() + _AttachEdgeRecord() - This routine adds newArc into v's adjacency list at a position + This routine adds newEdge into v's adjacency list at a position adjacent to the edge record for e, either before or after e, - depending on link. If e is not an arc (e.g. if e is NIL), - then link is assumed to indicate whether the new arc is to be + depending on link. If e is not an edge (e.g. if e is NIL), + then link is assumed to indicate whether the newEdge is to be placed at the beginning or end of v's adjacency list. NOTE: The caller can pass NIL for v if e is not NIL, since the vertex is implied (gp_GetNeighbor(theGraph, eTwin)) - The arc is assumed to already exist in the data structure (i.e. - the storage of edges), as only a whole edge (two arcs) can be - inserted into or deleted from the data structure. Hence there is - no such thing as gp_InsertArc() or gp_DeleteArc(). + The newEdge is assumed to already exist in the data structure (i.e. + the storage of edges), as only a whole edge (both edge records) can + be inserted into or deleted from the data structure. - See also gp_DetachArc(), gp_InsertEdge() and gp_DeleteEdge() + See also _RestoreEdgeRecord() ********************************************************************/ -void gp_AttachArc(graphP theGraph, int v, int e, int link, int newArc) +void _AttachEdgeRecord(graphP theGraph, int v, int e, int link, int newEdge) { - if (gp_IsArc(e)) + if (gp_IsEdge(theGraph, e)) { - int e2 = gp_GetAdjacentArc(theGraph, e, link); + int e2 = gp_GetAdjacentEdge(theGraph, e, link); - // e's link is newArc, and newArc's 1^link is e - gp_SetAdjacentArc(theGraph, e, link, newArc); - gp_SetAdjacentArc(theGraph, newArc, 1 ^ link, e); + // e's link is newEdge, and newEdge's 1^link is e + gp_SetAdjacentEdge(theGraph, e, link, newEdge); + gp_SetAdjacentEdge(theGraph, newEdge, 1 ^ link, e); - // newArcs's link is e2 - gp_SetAdjacentArc(theGraph, newArc, link, e2); + // newEdge's link is e2 + gp_SetAdjacentEdge(theGraph, newEdge, 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)) - gp_SetAdjacentArc(theGraph, e2, 1 ^ link, newArc); + // if e2 is an edge, then e2's 1^link is newEdge, + // else v's 1^link is newEdge + if (gp_IsEdge(theGraph, e2)) + gp_SetAdjacentEdge(theGraph, e2, 1 ^ link, newEdge); else - gp_SetArc(theGraph, v, 1 ^ link, newArc); + gp_SetEdgeByLink(theGraph, v, 1 ^ link, newEdge); } else { - int e2 = gp_GetArc(theGraph, v, link); + int e2 = gp_GetEdgeByLink(theGraph, v, link); - // v's link is newArc, and newArc's 1^link is NIL - gp_SetArc(theGraph, v, link, newArc); - gp_SetAdjacentArc(theGraph, newArc, 1 ^ link, NIL); + // v's link is newEdge, and newEdge's 1^link is NIL + gp_SetEdgeByLink(theGraph, v, link, newEdge); + gp_SetAdjacentEdge(theGraph, newEdge, 1 ^ link, NIL); - // newArcs's elink is e2 - gp_SetAdjacentArc(theGraph, newArc, link, e2); + // newEdge's elink is e2 + gp_SetAdjacentEdge(theGraph, newEdge, 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)) - gp_SetAdjacentArc(theGraph, e2, 1 ^ link, newArc); + // if e2 is an edge, then e2's 1^link is newEdge, + // else v's 1^link is newEdge + if (gp_IsEdge(theGraph, e2)) + gp_SetAdjacentEdge(theGraph, e2, 1 ^ link, newEdge); else - gp_SetArc(theGraph, v, 1 ^ link, newArc); + gp_SetEdgeByLink(theGraph, v, 1 ^ link, newEdge); } } /**************************************************************************** - gp_DetachArc() + _DetachEdge() - This routine detaches arc from its adjacency list, but it does not delete - it from the data structure (only a whole edge can be deleted). + This routine detaches edge record e from its adjacency list, but it does not + delete it from the data structure (only a whole edge can be deleted). Some algorithms must temporarily detach an edge, perform some calculation, and eventually put the edge back. This routine supports that operation. The neighboring adjacency list nodes are cross-linked, but the two link - members of the arc are retained, so the arc can be reattached later by - invoking _RestoreArc(). A sequence of detached arcs can only be restored - in the exact opposite order of their detachment. Thus, algorithms do not - directly use this method to implement the temporary detach/restore method. - Instead, gp_HideEdge() and gp_RestoreEdge are used, and algorithms push - edge hidden edge onto the stack. One example of this stack usage is - provided by detaching edges with gp_ContractEdge() or gp_IdentifyVertices(), - and reattaching with gp_RestoreIdentifications(), which unwinds the stack - by invoking gp_RestoreVertex(). + members of edge record e are retained, so edge record e can be reattached + later by invoking _RestoreEdgeRecord(). + + A sequence of detached edge records can only be restored in the exact opposite + order of their detachment. Thus, algorithms do not directly use this method to + implement the temporary detach/restore method. Instead, gp_HideEdge() and + gp_RestoreEdge() are used, and algorithms push and pop hidden edges onto and + from a stack. A example of this is shown by detaching edges with + gp_ContractEdge() or gp_IdentifyVertices(), and then reattaching them with + gp_RestoreIdentifications(), which unwinds the stack with gp_RestoreVertex(). ****************************************************************************/ -void gp_DetachArc(graphP theGraph, int arc) +void _DetachEdgeRecord(graphP theGraph, int e) { - int nextArc = gp_GetNextArc(theGraph, arc), - prevArc = gp_GetPrevArc(theGraph, arc); + int nextEdge = gp_GetNextEdge(theGraph, e), + prevEdge = gp_GetPrevEdge(theGraph, e); - if (gp_IsArc(nextArc)) - gp_SetPrevArc(theGraph, nextArc, prevArc); + if (gp_IsEdge(theGraph, nextEdge)) + gp_SetPrevEdge(theGraph, nextEdge, prevEdge); else - gp_SetLastArc(theGraph, gp_GetNeighbor(theGraph, gp_GetTwinArc(theGraph, arc)), prevArc); + gp_SetLastEdge(theGraph, gp_GetNeighbor(theGraph, gp_GetTwin(theGraph, e)), prevEdge); - if (gp_IsArc(prevArc)) - gp_SetNextArc(theGraph, prevArc, nextArc); + if (gp_IsEdge(theGraph, prevEdge)) + gp_SetNextEdge(theGraph, prevEdge, nextEdge); else - gp_SetFirstArc(theGraph, gp_GetNeighbor(theGraph, gp_GetTwinArc(theGraph, arc)), nextArc); + gp_SetFirstEdge(theGraph, gp_GetNeighbor(theGraph, gp_GetTwin(theGraph, e)), nextEdge); } /******************************************************************** 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. upos receives the location in G where the u record in v's list will be - placed, and vpos is the location in G of the v record we placed in + placed, and vpos is the location in G of the v record we placed in u's list. These are used to initialize the short circuit links. ulink (0|1) indicates whether the edge record to v in u's list should @@ -1664,19 +1819,38 @@ 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 edge records. The edge 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_FindEdge() returns NIL. + + Returns OK on success, NOTOK on failure, NONEMBEDDABLE if adding the + edge would exceed the graph's edge 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) { int upos, vpos; - if (theGraph == NULL || u < gp_GetFirstVertex(theGraph) || v < gp_GetFirstVertex(theGraph) || - !gp_VirtualVertexInRange(theGraph, u) || !gp_VirtualVertexInRange(theGraph, v)) + if (theGraph == NULL || + u < gp_GetFirstVertex(theGraph) || v < gp_GetFirstVertex(theGraph) || + !gp_VirtualVertexInRangeAscending(theGraph, u) || !gp_VirtualVertexInRangeAscending(theGraph, v)) return NOTOK; /* We enforce the edge limit */ - if (theGraph->M >= theGraph->arcCapacity / 2) + if (gp_GetM(theGraph) >= theGraph->edgeCapacity) return NONEMBEDDABLE; if (sp_NonEmpty(theGraph->edgeHoles)) @@ -1684,14 +1858,14 @@ 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); + upos = gp_GetTwin(theGraph, vpos); gp_SetNeighbor(theGraph, upos, v); - gp_AttachArc(theGraph, u, NIL, ulink, upos); + _AttachEdgeRecord(theGraph, u, NIL, ulink, upos); gp_SetNeighbor(theGraph, vpos, u); - gp_AttachArc(theGraph, v, NIL, vlink, vpos); + _AttachEdgeRecord(theGraph, v, NIL, vlink, vpos); theGraph->M++; return OK; @@ -1701,34 +1875,46 @@ int gp_AddEdge(graphP theGraph, int u, int ulink, int v, int vlink) gp_DynamicAddEdge() 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. + Tries to call gp_AddEdge; if NONEMBEDDABLE, doubles the edge + capacity using gp_EnsureEdgeCapacity, 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) { - int candidateArcCapacity = gp_GetArcCapacity(theGraph) * 2; - int N = theGraph->N; - int newArcCapacity = (candidateArcCapacity > (N * (N - 1))) ? (N * (N - 1)) : candidateArcCapacity; - Result = gp_EnsureArcCapacity(theGraph, newArcCapacity); + // The candidate edge capacity is double the current capacity + int candidateEdgeCapacity = gp_GetEdgeCapacity(theGraph) << 1; + int N = gp_GetN(theGraph); + int newEdgeCapacity = candidateEdgeCapacity; + + // If the candidate edge capacity exceeds the number of edges + // needed in an undirected clique on N vertices, then attempt + // to use that as the new edge capacity. + if (candidateEdgeCapacity > ((N * (N - 1)) >> 1)) + newEdgeCapacity = ((N * (N - 1)) >> 1); + + // However, if the edge capacity is already greater than or + // equal to that maximum capacity needed for an undirected + // clique on N vertices, then we allow the capacity to double + // beyond the simple undirected graph limit. + if (newEdgeCapacity <= gp_GetEdgeCapacity(theGraph)) + newEdgeCapacity = candidateEdgeCapacity; + + Result = gp_EnsureEdgeCapacity(theGraph, newEdgeCapacity); if (Result != OK) - return Result; + return NOTOK; Result = gp_AddEdge(theGraph, u, ulink, v, vlink); } - return Result; + return Result != OK ? NOTOK : Result; } /******************************************************************** @@ -1738,28 +1924,40 @@ int gp_DynamicAddEdge(graphP theGraph, int u, int ulink, int v, int vlink) to the adjacency list of u is adjacent to e_u and the edge record added to the adjacency list of v is adjacent to e_v. The direction of adjacency is given by e_ulink for e_u and e_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 + for e_v. Specifically, the new edge will be comprised of two edge + records, 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 edge, 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 edge capacity (the caller can + invoke gp_EnsureEdgeCapacity() 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) + return NOTOK; + + vertMax = gp_GetLastVirtualVertex(theGraph); + edgeMax = gp_EdgeInUseArraySize(theGraph) - 1; - 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 (u < gp_GetFirstVertex(theGraph) || u > vertMax || + v < gp_GetFirstVertex(theGraph) || v > vertMax || + e_u > edgeMax || (e_u < gp_EdgeArrayStart(theGraph) && gp_IsEdge(theGraph, e_u)) || + e_v > edgeMax || (e_v < gp_EdgeArrayStart(theGraph) && gp_IsEdge(theGraph, e_v)) || e_ulink < 0 || e_ulink > 1 || e_vlink < 0 || e_vlink > 1) return NOTOK; - if (theGraph->M >= theGraph->arcCapacity / 2) + if (gp_GetM(theGraph) >= theGraph->edgeCapacity) return NONEMBEDDABLE; if (sp_NonEmpty(theGraph->edgeHoles)) @@ -1767,15 +1965,22 @@ 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); - upos = gp_GetTwinArc(theGraph, vpos); + // 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_GetTwin(theGraph, vpos); gp_SetNeighbor(theGraph, upos, v); - gp_AttachArc(theGraph, u, e_u, e_ulink, upos); + _AttachEdgeRecord(theGraph, u, e_u, e_ulink, upos); gp_SetNeighbor(theGraph, vpos, u); - gp_AttachArc(theGraph, v, e_v, e_vlink, vpos); + _AttachEdgeRecord(theGraph, v, e_v, e_vlink, vpos); theGraph->M++; @@ -1787,29 +1992,35 @@ 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 + 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_EdgeArrayStart(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); - gp_DetachArc(theGraph, gp_GetTwinArc(theGraph, e)); + _DetachEdgeRecord(theGraph, e); + _DetachEdgeRecord(theGraph, gp_GetTwin(theGraph, e)); // Clear the two edge records - // (the bit twiddle (e & ~1) chooses the lesser of e and its twin arc) + // (the bit twiddle (e & ~1) chooses the lesser of e and its twin) #ifdef USE_FASTER_1BASEDARRAYS memset(theGraph->E + (e & ~1), NIL_CHAR, sizeof(edgeRec) << 1); #else _InitEdgeRec(theGraph, e); - _InitEdgeRec(theGraph, gp_GetTwinArc(theGraph, e)); + _InitEdgeRec(theGraph, gp_GetTwin(theGraph, e)); #endif // Now we reduce the number of edges in the data structure @@ -1817,72 +2028,86 @@ 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; } /******************************************************************** - _RestoreArc() - This routine reinserts an arc into the edge list from which it - was previously removed by gp_DetachArc(). - - The assumed processing model is that arcs will be restored in reverse - of the order in which they were hidden, i.e. it is assumed that the - hidden arcs will be pushed on a stack and the arcs will be popped - from the stack for restoration. - ********************************************************************/ + _RestoreEdgeRecord() -void _RestoreArc(graphP theGraph, int arc) + This routine reinserts an edge record e into the adjacency list from + which it was previously removed by _DetachEdgeRecord(). + + The assumed processing model is that edge records will be restored in + reverse of the order in which they were hidden, i.e. it is assumed + that the hidden edges will be pushed on a stack from which they will + be popped during restoration. + ********************************************************************/ +void _RestoreEdgeRecord(graphP theGraph, int e) { - int nextArc = gp_GetNextArc(theGraph, arc), - prevArc = gp_GetPrevArc(theGraph, arc); + int nextEdge = gp_GetNextEdge(theGraph, e), + prevEdge = gp_GetPrevEdge(theGraph, e); - if (gp_IsArc(nextArc)) - gp_SetPrevArc(theGraph, nextArc, arc); + if (gp_IsEdge(theGraph, nextEdge)) + gp_SetPrevEdge(theGraph, nextEdge, e); else - gp_SetLastArc(theGraph, gp_GetNeighbor(theGraph, gp_GetTwinArc(theGraph, arc)), arc); + gp_SetLastEdge(theGraph, gp_GetNeighbor(theGraph, gp_GetTwin(theGraph, e)), e); - if (gp_IsArc(prevArc)) - gp_SetNextArc(theGraph, prevArc, arc); + if (gp_IsEdge(theGraph, prevEdge)) + gp_SetNextEdge(theGraph, prevEdge, e); else - gp_SetFirstArc(theGraph, gp_GetNeighbor(theGraph, gp_GetTwinArc(theGraph, arc)), arc); + gp_SetFirstEdge(theGraph, gp_GetNeighbor(theGraph, gp_GetTwin(theGraph, e)), e); } /******************************************************************** gp_HideEdge() - This routine removes the two arcs of an edge from the adjacency lists - of its endpoint vertices, but does not delete them from the storage - data structure. + This routine removes the two edge records of an edge from the + adjacency lists of its endpoint vertices, but it does not delete them + from the storage data structure. Many algorithms must temporarily remove an edge, perform some calculation, and eventually put the edge back. This routine supports that operation. - For each arc, the neighboring adjacency list nodes are cross-linked, - but the links in the arc are retained because they indicate the - neighbor arcs to which the arc can be reattached by gp_RestoreEdge(). + For each edge record of e, the neighboring adjacency list nodes are + cross-linked, but the links in the edge record are retained because + they indicate the neighbor edge records to which the edge record can + be reattached by gp_RestoreEdge(). ********************************************************************/ void gp_HideEdge(graphP theGraph, int e) { + if (theGraph == NULL || + e < gp_EdgeArrayStart(theGraph) || e >= gp_EdgeInUseArraySize(theGraph) || + gp_EdgeNotInUse(theGraph, e)) + { +#ifdef DEBUG + NOTOK; +#endif + return; + } + theGraph->functions.fpHideEdge(theGraph, e); } void _HideEdge(graphP theGraph, int e) { - gp_DetachArc(theGraph, e); - gp_DetachArc(theGraph, gp_GetTwinArc(theGraph, e)); + _DetachEdgeRecord(theGraph, e); + _DetachEdgeRecord(theGraph, gp_GetTwin(theGraph, e)); } /******************************************************************** gp_RestoreEdge() - This routine reinserts two two arcs of an edge into the adjacency - lists of the edge's endpoints, the arcs having been previously + This routine reinserts two edge records of an edge into the adjacency + lists of the edge's endpoints, the edge records having been previously removed by gp_HideEdge(). The assumed processing model is that edges will be restored in @@ -1890,31 +2115,42 @@ void _HideEdge(graphP theGraph, int e) that the hidden edges will be pushed on a stack and the edges will be popped from the stack for restoration. - Note: Since both arcs of an edge are restored, only one arc need - be pushed on the stack for restoration. This routine - restores the two arcs in the opposite order from the order - in which they are hidden by gp_HideEdge(). + NOTE: Since both edge records of an edge are restored, only one + edge record needs to be pushed on the stack for restoration. + This routine restores the two edge records in the opposite order + from the order in which they were hidden by gp_HideEdge(). ********************************************************************/ void gp_RestoreEdge(graphP theGraph, int e) { + if (theGraph == NULL || + e < gp_EdgeArrayStart(theGraph) || e >= gp_EdgeInUseArraySize(theGraph) || + gp_EdgeNotInUse(theGraph, e)) + { +#ifdef DEBUG + NOTOK; +#endif + return; + } + theGraph->functions.fpRestoreEdge(theGraph, e); } void _RestoreEdge(graphP theGraph, int e) { - _RestoreArc(theGraph, gp_GetTwinArc(theGraph, e)); - _RestoreArc(theGraph, e); + _RestoreEdgeRecord(theGraph, gp_GetTwin(theGraph, e)); + _RestoreEdgeRecord(theGraph, e); } /******************************************************************** _HideInternalEdges() - Pushes onto the graph's stack and hides all arc nodes of the vertex - except the first and last arcs in the adjacency list of the vertex. + Pushes onto the graph's stack and hides all edge records of the given + vertex's adjacency list except the first and last. + This method is typically called on a vertex that is on the external - face of a biconnected component, because the first and last arcs are - the ones that attach the vertex to the external face cycle, and any - other arcs in the adjacency list are inside that cycle. + face of a bicomp, where the first and last edge records are the ones + that attach the vertex to the external face cycle, and any other + edge records in the adjacency list are inside of that cycle. This method uses the stack. The caller is expected to clear the stack or save the stack size before invocation, since the stack size is @@ -1923,23 +2159,23 @@ void _RestoreEdge(graphP theGraph, int e) int _HideInternalEdges(graphP theGraph, int vertex) { - int e = gp_GetFirstArc(theGraph, vertex); + int e = gp_GetFirstEdge(theGraph, vertex); // If the vertex adjacency list is empty or if it contains // only one edge, then there are no *internal* edges to hide - if (e == gp_GetLastArc(theGraph, vertex)) + if (e == gp_GetLastEdge(theGraph, vertex)) return OK; // Start with the first internal edge - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); // Cycle through all the edges, pushing each except stop // before pushing the last edge, which is not internal - while (e != gp_GetLastArc(theGraph, vertex)) + while (e != gp_GetLastEdge(theGraph, vertex)) { sp_Push(theGraph->theStack, e); gp_HideEdge(theGraph, e); - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } return OK; @@ -1947,6 +2183,7 @@ int _HideInternalEdges(graphP theGraph, int vertex) /******************************************************************** _RestoreInternalEdges() + Reverses the effects of _HideInternalEdges() ********************************************************************/ @@ -1959,9 +2196,9 @@ int _RestoreInternalEdges(graphP theGraph, int stackBottom) _RestoreHiddenEdges() Each entry on the stack, down to stackBottom, is assumed to be an - edge record (arc) pushed in concert with invoking gp_HideEdge(). + edge record pushed in concert with invoking gp_HideEdge(). Each edge is restored using gp_RestoreEdge() in exact reverse of the - hiding order. The stack is reduced in size to stackBottom. + hiding order. The stack is reduced in content size to stackBottom. Returns OK on success, NOTOK on internal failure. ********************************************************************/ @@ -1973,7 +2210,7 @@ int _RestoreHiddenEdges(graphP theGraph, int stackBottom) while (sp_GetCurrentSize(theGraph->theStack) > stackBottom) { sp_Pop(theGraph->theStack, e); - if (gp_IsNotArc(e)) + if (gp_IsNotEdge(theGraph, e)) return NOTOK; gp_RestoreEdge(theGraph, e); } @@ -1984,18 +2221,21 @@ int _RestoreHiddenEdges(graphP theGraph, int stackBottom) /******************************************************************** gp_HideVertex() - Pushes onto the graph's stack and hides all arc nodes of the vertex. - Additional integers are then pushed so that the result is reversible - by gp_RestoreVertex(). See that method for details on the expected - stack segment. + Pushes onto the graph's stack and hides all edge records of the + vertex's adjacency list. Additional integers are then pushed so that + the result is reversible by gp_RestoreVertex(). See that method for d + etails on the expected stack segment. Returns OK for success, NOTOK for internal failure. ********************************************************************/ 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); } @@ -2003,14 +2243,14 @@ int gp_HideVertex(graphP theGraph, int vertex) int _HideVertex(graphP theGraph, int vertex) { int hiddenEdgeStackBottom = sp_GetCurrentSize(theGraph->theStack); - int e = gp_GetFirstArc(theGraph, vertex); + int e = gp_GetFirstEdge(theGraph, vertex); // Cycle through all the edges, pushing and hiding each - while (gp_IsArc(e)) + while (gp_IsEdge(theGraph, e)) { sp_Push(theGraph->theStack, e); gp_HideEdge(theGraph, e); - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } // Push the additional integers needed by gp_RestoreVertex() @@ -2029,7 +2269,7 @@ int _HideVertex(graphP theGraph, int vertex) gp_ContractEdge() Contracts the edge e=(u,v). This hides the edge (both e and its - twin arc), and it also identifies vertex v with u. + twin edge record), and it also identifies vertex v with u. See gp_IdentifyVertices() for further details. Returns OK for success, NOTOK for internal failure. @@ -2037,8 +2277,12 @@ int _HideVertex(graphP theGraph, int vertex) int gp_ContractEdge(graphP theGraph, int e) { - if (gp_IsNotArc(e)) + if (theGraph == NULL || + e < gp_EdgeArrayStart(theGraph) || e >= gp_EdgeInUseArraySize(theGraph) || + gp_EdgeNotInUse(theGraph, e)) + { return NOTOK; + } return theGraph->functions.fpContractEdge(theGraph, e); } @@ -2047,13 +2291,13 @@ int _ContractEdge(graphP theGraph, int e) { int eBefore, u, v; - if (gp_IsNotArc(e)) + if (gp_IsNotEdge(theGraph, e)) return NOTOK; - u = gp_GetNeighbor(theGraph, gp_GetTwinArc(theGraph, e)); + u = gp_GetNeighbor(theGraph, gp_GetTwin(theGraph, e)); v = gp_GetNeighbor(theGraph, e); - eBefore = gp_GetNextArc(theGraph, e); + eBefore = gp_GetNextEdge(theGraph, e); sp_Push(theGraph->theStack, e); gp_HideEdge(theGraph, e); @@ -2076,8 +2320,8 @@ int _ContractEdge(graphP theGraph, int e) u's neighbors, then traversing the adjacency list of v. For each visited neighbor of v, the edge is hidden because it would duplicate an adjacency already expressed in u's list. Finally, the remaining - edges of v are moved to u's list, and each twin arc is adjusted - to indicate u as a neighbor rather than v. + edges of v are moved to u's list, and each twin edge record is + adjusted to indicate u as a neighbor rather than v. This routine assumes that the visited flags are clear beforehand, and visited flag settings made herein are cleared before returning. @@ -2097,17 +2341,27 @@ 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_EdgeArrayStart(theGraph)) || + eBefore >= gp_EdgeInUseArraySize(theGraph) || + (eBefore != NIL && gp_EdgeNotInUse(theGraph, eBefore))) + { + return NOTOK; + } + return theGraph->functions.fpIdentifyVertices(theGraph, u, v, eBefore); } int _IdentifyVertices(graphP theGraph, int u, int v, int eBefore) { - int e = gp_GetNeighborEdgeRecord(theGraph, u, v); + int e = _gp_FindEdge(theGraph, u, v); int hiddenEdgeStackBottom, eBeforePred; // If the vertices are adjacent, then the identification is // essentially an edge contraction with a bit of fixup. - if (gp_IsArc(e)) + if (gp_IsEdge(theGraph, e)) { int result = gp_ContractEdge(theGraph, e); @@ -2136,35 +2390,35 @@ int _IdentifyVertices(graphP theGraph, int u, int v, int eBefore) hiddenEdgeStackBottom = sp_GetCurrentSize(theGraph->theStack); // Mark as visited all neighbors of u - e = gp_GetFirstArc(theGraph, u); - while (gp_IsArc(e)) + e = gp_GetFirstEdge(theGraph, u); + while (gp_IsEdge(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)); - e = gp_GetNextArc(theGraph, e); + gp_SetVisited(theGraph, gp_GetNeighbor(theGraph, e)); + e = gp_GetNextEdge(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)) + e = gp_GetFirstEdge(theGraph, v); + while (gp_IsEdge(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); } - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } // Mark as unvisited all neighbors of u - e = gp_GetFirstArc(theGraph, u); - while (gp_IsArc(e)) + e = gp_GetFirstEdge(theGraph, u); + while (gp_IsEdge(theGraph, e)) { - gp_ClearVertexVisited(theGraph, gp_GetNeighbor(theGraph, e)); - e = gp_GetNextArc(theGraph, e); + gp_ClearVisited(theGraph, gp_GetNeighbor(theGraph, e)); + e = gp_GetNextEdge(theGraph, e); } // Push the hiddenEdgeStackBottom as a record of how many hidden @@ -2174,60 +2428,60 @@ 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) - ? gp_GetPrevArc(theGraph, eBefore) - : gp_GetLastArc(theGraph, u); + eBeforePred = gp_IsEdge(theGraph, eBefore) + ? gp_GetPrevEdge(theGraph, eBefore) + : gp_GetLastEdge(theGraph, u); // Turns out we only need to record six integers related to the edges // being moved in order to easily restore them later. sp_Push(theGraph->theStack, eBefore); - sp_Push(theGraph->theStack, gp_GetLastArc(theGraph, v)); - sp_Push(theGraph->theStack, gp_GetFirstArc(theGraph, v)); + sp_Push(theGraph->theStack, gp_GetLastEdge(theGraph, v)); + sp_Push(theGraph->theStack, gp_GetFirstEdge(theGraph, v)); sp_Push(theGraph->theStack, eBeforePred); sp_Push(theGraph->theStack, u); sp_Push(theGraph->theStack, v); // 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)) + // of each twin edge record to indicate u rather than v. + e = gp_GetFirstEdge(theGraph, v); + while (gp_IsEdge(theGraph, e)) { - gp_SetNeighbor(theGraph, gp_GetTwinArc(theGraph, e), u); - e = gp_GetNextArc(theGraph, e); + gp_SetNeighbor(theGraph, gp_GetTwin(theGraph, e), u); + e = gp_GetNextEdge(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_IsEdge(theGraph, gp_GetFirstEdge(theGraph, v))) { // Then perform the list union of v into u between eBeforePred and eBefore - if (gp_IsArc(eBeforePred)) + if (gp_IsEdge(theGraph, eBeforePred)) { - if (gp_IsArc(gp_GetFirstArc(theGraph, v))) + if (gp_IsEdge(theGraph, gp_GetFirstEdge(theGraph, v))) { - gp_SetNextArc(theGraph, eBeforePred, gp_GetFirstArc(theGraph, v)); - gp_SetPrevArc(theGraph, gp_GetFirstArc(theGraph, v), eBeforePred); + gp_SetNextEdge(theGraph, eBeforePred, gp_GetFirstEdge(theGraph, v)); + gp_SetPrevEdge(theGraph, gp_GetFirstEdge(theGraph, v), eBeforePred); } } else { - gp_SetFirstArc(theGraph, u, gp_GetFirstArc(theGraph, v)); + gp_SetFirstEdge(theGraph, u, gp_GetFirstEdge(theGraph, v)); } - if (gp_IsArc(eBefore)) + if (gp_IsEdge(theGraph, eBefore)) { - if (gp_IsArc(gp_GetLastArc(theGraph, v))) + if (gp_IsEdge(theGraph, gp_GetLastEdge(theGraph, v))) { - gp_SetNextArc(theGraph, gp_GetLastArc(theGraph, v), eBefore); - gp_SetPrevArc(theGraph, eBefore, gp_GetLastArc(theGraph, v)); + gp_SetNextEdge(theGraph, gp_GetLastEdge(theGraph, v), eBefore); + gp_SetPrevEdge(theGraph, eBefore, gp_GetLastEdge(theGraph, v)); } } else { - gp_SetLastArc(theGraph, u, gp_GetLastArc(theGraph, v)); + gp_SetLastEdge(theGraph, u, gp_GetLastEdge(theGraph, v)); } - gp_SetFirstArc(theGraph, v, NIL); - gp_SetLastArc(theGraph, v, NIL); + gp_SetFirstEdge(theGraph, v, NIL); + gp_SetLastEdge(theGraph, v, NIL); } return OK; @@ -2277,6 +2531,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,48 +2553,48 @@ 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_IsEdge(theGraph, e_u_pred)) { - gp_SetNextArc(theGraph, e_u_pred, e_u_succ); + gp_SetNextEdge(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)) - gp_SetPrevArc(theGraph, e_u_succ, e_u_pred); + // otherwise the predecessor is the new last edge + if (gp_IsEdge(theGraph, e_u_succ)) + gp_SetPrevEdge(theGraph, e_u_succ, e_u_pred); else - gp_SetLastArc(theGraph, u, e_u_pred); + gp_SetLastEdge(theGraph, u, e_u_pred); } - else if (gp_IsArc(e_u_succ)) + else if (gp_IsEdge(theGraph, e_u_succ)) { - // The successor arc exists, but not the predecessor, - // so the successor is the new first arc - gp_SetPrevArc(theGraph, e_u_succ, NIL); - gp_SetFirstArc(theGraph, u, e_u_succ); + // The successor edge exists, but not the predecessor, + // so the successor is the new first edge + gp_SetPrevEdge(theGraph, e_u_succ, NIL); + gp_SetFirstEdge(theGraph, u, e_u_succ); } else { // Just in case u was degree zero - gp_SetFirstArc(theGraph, u, NIL); - gp_SetLastArc(theGraph, u, NIL); + gp_SetFirstEdge(theGraph, u, NIL); + gp_SetLastEdge(theGraph, u, NIL); } // 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)) - gp_SetPrevArc(theGraph, e_v_first, NIL); - if (gp_IsArc(e_v_last)) - gp_SetPrevArc(theGraph, e_v_last, NIL); + gp_SetFirstEdge(theGraph, v, e_v_first); + gp_SetLastEdge(theGraph, v, e_v_last); + if (gp_IsEdge(theGraph, e_v_first)) + gp_SetPrevEdge(theGraph, e_v_first, NIL); + if (gp_IsEdge(theGraph, e_v_last)) + gp_SetPrevEdge(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. + // of each twin edge record to indicate v rather than u. e = e_v_first; - while (gp_IsArc(e)) + while (gp_IsEdge(theGraph, e)) { - gp_SetNeighbor(theGraph, gp_GetTwinArc(theGraph, e), v); - e = (e == e_v_last ? NIL : gp_GetNextArc(theGraph, e)); + gp_SetNeighbor(theGraph, gp_GetTwin(theGraph, e), v); + e = (e == e_v_last ? NIL : gp_GetNextEdge(theGraph, e)); } } @@ -2362,6 +2619,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) @@ -2372,7 +2632,8 @@ int gp_RestoreVertices(graphP theGraph) } /**************************************************************************** - _ComputeArcType() + _ComputeEdgeRecordType() + This is just a little helper function that automates a sequence of decisions that has to be made a number of times. An edge record is being added to the adjacency list of a; it indicates that @@ -2386,10 +2647,10 @@ int gp_RestoreVertices(graphP theGraph) Symmetric conditions define the types for a > b. ****************************************************************************/ -int _ComputeArcType(graphP theGraph, int a, int b, int edgeType) +int _ComputeEdgeRecordType(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; @@ -2399,11 +2660,12 @@ int _ComputeArcType(graphP theGraph, int a, int b, int edgeType) /**************************************************************************** _SetEdgeType() + When we are restoring an edge, we must restore its type (tree edge or cycle edge). - We can deduce what the type was based on other information in the graph. Each - arc of the edge gets the appropriate type setting (parent/child or back/forward). - This method runs in constant time plus the degree of vertex u, or constant - time if u is known to have a degree bound by a constant. + We can deduce what the type was based on other information in the graph. + Each edge record of the edge gets the appropriate type setting (parent/child or + back/forward). This method runs in constant time plus the degree of vertex u, or + constant time if u is known to have a degree bound by a constant. ****************************************************************************/ int _SetEdgeType(graphP theGraph, int u, int v) @@ -2411,13 +2673,13 @@ 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 - e = gp_GetNeighborEdgeRecord(theGraph, u, v); - eTwin = gp_GetTwinArc(theGraph, e); + e = _gp_FindEdge(theGraph, u, v); + eTwin = gp_GetTwin(theGraph, e); // If u_orig is the parent of v_orig, or vice versa, then the edge is a tree edge @@ -2470,7 +2732,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); @@ -2478,13 +2740,16 @@ int _DeleteUnmarkedEdgesInBicomp(graphP theGraph, int BicompRoot) { sp_Pop(theGraph->theStack, V); - e = gp_GetFirstArc(theGraph, V); - while (gp_IsArc(e)) + e = gp_GetFirstEdge(theGraph, V); + while (gp_IsEdge(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_GetNextEdge(theGraph, e); + if (!gp_GetEdgeVisited(theGraph, e)) + gp_DeleteEdge(theGraph, e); + e = eNext; } } return OK; @@ -2513,8 +2778,8 @@ int _ClearInvertedFlagsInBicomp(graphP theGraph, int BicompRoot) { sp_Pop(theGraph->theStack, V); - e = gp_GetFirstArc(theGraph, V); - while (gp_IsArc(e)) + e = gp_GetFirstEdge(theGraph, V); + while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) { @@ -2522,7 +2787,7 @@ int _ClearInvertedFlagsInBicomp(graphP theGraph, int BicompRoot) gp_ClearEdgeFlagInverted(theGraph, e); } - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } } return OK; @@ -2551,13 +2816,13 @@ int _GetBicompSize(graphP theGraph, int BicompRoot) { sp_Pop(theGraph->theStack, V); theSize++; - e = gp_GetFirstArc(theGraph, V); - while (gp_IsArc(e)) + e = gp_GetFirstEdge(theGraph, V); + while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) sp_Push(theGraph->theStack, gp_GetNeighbor(theGraph, e)); - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } } return theSize; @@ -2565,11 +2830,19 @@ int _GetBicompSize(graphP theGraph, int BicompRoot) /******************************************************************** debugNOTOK() - This function provides a non-void wrapper for exit(). - This is useful for debugging as it allows compilation of an exit - command in places where NOTOK is returned. - In exhaustive testing, we want to bail on the first NOTOK that occurs. - Comment out the exit() call to get a stack trace. + + This function returns the literal value of NOTOK. In debug mode, + NOTOK is redefined to first use printf() to emit information about + where in the code a NOTOK has occurred. Then, this method is invoked + so that the debug version of NOTOK still returns the NOTOK value. + + Rather than just returning 0 in the debug-mode NOTOK macro, we + invoke this method because it gives the option (with recompilation) + of having the program exit on the first NOTOK occurrence. That + option is off by default, so we normally get a stack trace of the + NOTOK occcurences, but on an exhaustive, long-run test, it can be + handy to stop on the first error since otherwise the error message + might not be seen. ********************************************************************/ int debugNOTOK(void) 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..0f32744 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. */ @@ -16,8 +16,8 @@ extern "C" #define K23SEARCH_NAME "K23Search" - int gp_AttachK23Search(graphP theGraph); - int gp_DetachK23Search(graphP theGraph); + int gp_ExtendWith_K23Search(graphP theGraph); + int gp_Detach_K23Search(graphP theGraph); #ifdef __cplusplus } diff --git a/planarity/c/graphLib/homeomorphSearch/graphK23Search.private.h b/planarity/c/graphLib/homeomorphSearch/graphK23Search.private.h index 3aee68c..c79a9b8 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. */ @@ -21,6 +21,8 @@ extern "C" } K23SearchContext; +extern int K23SEARCH_ID; + #ifdef __cplusplus } #endif diff --git a/planarity/c/graphLib/homeomorphSearch/graphK23Search_Extensions.c b/planarity/c/graphLib/homeomorphSearch/graphK23Search_Extensions.c index 00bf153..d1aae6c 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. */ @@ -37,13 +37,13 @@ void _K23Search_FreeContext(void *); int K23SEARCH_ID = 0; /**************************************************************************** - gp_AttachK23Search() + gp_ExtendWith_K23Search() This function adjusts the graph data structure to attach the K2,3 search feature. ****************************************************************************/ -int gp_AttachK23Search(graphP theGraph) +int gp_ExtendWith_K23Search(graphP theGraph) { K23SearchContext *context = NULL; @@ -79,6 +79,8 @@ int gp_AttachK23Search(graphP theGraph) &context->functions) != OK) { _K23Search_FreeContext(context); + context = NULL; + return NOTOK; } @@ -86,10 +88,10 @@ int gp_AttachK23Search(graphP theGraph) } /******************************************************************** - gp_DetachK23Search() + gp_Detach_K23Search() ********************************************************************/ -int gp_DetachK23Search(graphP theGraph) +int gp_Detach_K23Search(graphP theGraph) { return gp_RemoveExtension(theGraph, K23SEARCH_ID); } @@ -125,7 +127,7 @@ void _K23Search_FreeContext(void *pContext) int _K23Search_HandleBlockedBicomp(graphP theGraph, int v, int RootVertex, int R) { - if (theGraph->embedFlags == EMBEDFLAGS_SEARCHFORK23) + if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK23) { // If R is the root of a descendant bicomp of v, we push it, but then we know the search for K2,3 // will be successful and return NONEMBEDDABLE because this condition corresponds to minor A, which @@ -164,18 +166,18 @@ int _K23Search_EmbedPostprocess(graphP theGraph, int v, int edgeEmbeddingResult) // For K2,3 search, we just return the edge embedding result because the // search result has been obtained already. - if (theGraph->embedFlags == EMBEDFLAGS_SEARCHFORK23) + if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK23) { if (edgeEmbeddingResult == OK) { // When a graph does not contain a K2,3 homeomorph, the embedding // is meaningless, so we empty it out. We preserve the embedFlags // to ensure post-processing continues as expected. - savedEmbedFlags = theGraph->embedFlags; - savedZEROBASEDIO = theGraph->internalFlags & FLAGS_ZEROBASEDIO; + savedEmbedFlags = gp_GetEmbedFlags(theGraph); + savedZEROBASEDIO = gp_GetGraphFlags(theGraph) & FLAGS_ZEROBASEDIO; gp_ReinitializeGraph(theGraph); theGraph->embedFlags = savedEmbedFlags; - theGraph->internalFlags &= savedZEROBASEDIO; + theGraph->graphFlags &= savedZEROBASEDIO; } return edgeEmbeddingResult; @@ -201,7 +203,7 @@ int _K23Search_EmbedPostprocess(graphP theGraph, int v, int edgeEmbeddingResult) int _K23Search_CheckEmbeddingIntegrity(graphP theGraph, graphP origGraph) { - if (theGraph->embedFlags == EMBEDFLAGS_SEARCHFORK23) + if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK23) { return OK; } @@ -228,7 +230,7 @@ int _K23Search_CheckObstructionIntegrity(graphP theGraph, graphP origGraph) { // When searching for K2,3, we ensure that theGraph is a subgraph of // the original graph and that it contains a K2,3 homeomorph - if (theGraph->embedFlags == EMBEDFLAGS_SEARCHFORK23) + if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK23) { int degrees[4], imageVerts[5]; diff --git a/planarity/c/graphLib/homeomorphSearch/graphK33Search.c b/planarity/c/graphLib/homeomorphSearch/graphK33Search.c index b49b408..f215d15 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. */ @@ -7,23 +7,21 @@ See the LICENSE.TXT file for licensing information. #include "graphK33Search.h" #include "graphK33Search.private.h" -// extern int K33SEARCH_ID; - #include "../graph.h" /* 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); extern int _HideInternalEdges(graphP theGraph, int vertex); extern int _RestoreInternalEdges(graphP theGraph, int stackBottom); extern int _ClearInvertedFlagsInBicomp(graphP theGraph, int BicompRoot); -extern int _ComputeArcType(graphP theGraph, int a, int b, int edgeType); +extern int _ComputeEdgeRecordType(graphP theGraph, int a, int b, int edgeType); extern int _SetEdgeType(graphP theGraph, int u, int v); extern int _GetNeighborOnExtFace(graphP theGraph, int curVertex, int *pPrevLink); @@ -31,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 _ChooseTypeOfNonplanarityMinor(graphP theGraph, int v, int R); @@ -82,7 +80,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); @@ -212,7 +210,7 @@ int _SearchForK33InBicomp(graphP theGraph, K33SearchContext *context, int v, int /* Set visitedInfo values in the bicomp to the initialized state so the planarity algorithm can properly do the Walkup procedure in future steps */ - if (_FillVertexVisitedInfoInBicomp(theGraph, IC->r, theGraph->N) != OK) + if (_FillVertexVisitedInfoInBicomp(theGraph, IC->r, gp_GetN(theGraph)) != OK) return NOTOK; /* We now intend to ignore the pertinence of W (conceptually eliminating @@ -360,7 +358,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 +394,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 +412,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 +431,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 +483,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 +535,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 +580,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; @@ -599,16 +597,16 @@ int _Fast_GetLeastAncestorConnection(graphP theGraph, K33SearchContext *context, int _GetAdjacentAncestorInRange(graphP theGraph, K33SearchContext *context, int theVertex, int closerAncestor, int fartherAncestor) { - int e = context->VI[theVertex].backArcList; + int e = context->VI[theVertex].backEdgeList; - while (gp_IsArc(e)) + while (gp_IsEdge(theGraph, e)) { if (gp_GetNeighbor(theGraph, e) < closerAncestor && gp_GetNeighbor(theGraph, e) > fartherAncestor) return gp_GetNeighbor(theGraph, e); - e = gp_GetNextArc(theGraph, e); - if (e == context->VI[theVertex].backArcList) + e = gp_GetNextEdge(theGraph, e); + if (e == context->VI[theVertex].backEdgeList) e = NIL; } return NIL; @@ -630,7 +628,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 +641,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 +659,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); @@ -706,8 +704,8 @@ int _FindExternalConnectionDescendantEndpoint(graphP theGraph, int ancestor, // Check whether the cutVertex is directly adjacent to the ancestor // by an unembedded back edge. - e = gp_GetVertexFwdArcList(theGraph, ancestor); - while (gp_IsArc(e)) + e = gp_GetVertexFwdEdgeList(theGraph, ancestor); + while (gp_IsEdge(theGraph, e)) { if (gp_GetNeighbor(theGraph, e) == cutVertex) { @@ -715,15 +713,15 @@ int _FindExternalConnectionDescendantEndpoint(graphP theGraph, int ancestor, return OK; } - e = gp_GetNextArc(theGraph, e); - if (e == gp_GetVertexFwdArcList(theGraph, ancestor)) + e = gp_GetNextEdge(theGraph, e); + if (e == gp_GetVertexFwdEdgeList(theGraph, ancestor)) e = NIL; } // 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 +776,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,13 +826,13 @@ 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_SetVertexVisitedInfo(theGraph, v, gp_GetN(theGraph)); gp_SetVertexPertinentEdge(theGraph, v, NIL); gp_SetVertexPertinentRootsList(theGraph, v, NIL); @@ -846,13 +844,13 @@ int _FindK33WithMergeBlocker(graphP theGraph, K33SearchContext *context, int v, /* Restore the pertinence settings of step v by doing the Walkup for each back edge that was not embedded when step v was originally performed. */ - e = gp_GetVertexFwdArcList(theGraph, IC->v); - while (gp_IsArc(e)) + e = gp_GetVertexFwdEdgeList(theGraph, IC->v); + while (gp_IsEdge(theGraph, e)) { theGraph->functions.fpWalkUp(theGraph, IC->v, e); - e = gp_GetNextArc(theGraph, e); - if (e == gp_GetVertexFwdArcList(theGraph, IC->v)) + e = gp_GetNextEdge(theGraph, e); + if (e == gp_GetVertexFwdEdgeList(theGraph, IC->v)) e = NIL; } @@ -996,29 +994,29 @@ int _TestForZtoWPath(graphP theGraph) { sp_Pop2(theGraph->theStack, v, e); - if (gp_IsNotArc(e)) + if (gp_IsNotEdge(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 // to have processing started on it again) gp_SetVertexVisitedInfo(theGraph, v, -1); - e = gp_GetFirstArc(theGraph, v); + e = gp_GetFirstEdge(theGraph, v); } else - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); // This while loop breaks on the first edge it finds that is eligible to be // 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_IsEdge(theGraph, e)) { w = gp_GetNeighbor(theGraph, e); @@ -1026,7 +1024,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); @@ -1034,16 +1032,16 @@ int _TestForZtoWPath(graphP theGraph) break; } - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } } 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)); + gp_SetEdgeVisited(theGraph, gp_GetTwin(theGraph, e)); } return OK; @@ -1100,7 +1098,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,14 +1134,14 @@ 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; } // Check for noStraddle of u_max, break if found - e = gp_GetFirstArc(theGraph, p); + e = gp_GetFirstEdge(theGraph, p); if (context->E[e].noStraddle == u_max) break; @@ -1153,13 +1151,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)) + e = gp_GetFirstEdge(theGraph, c); + if (gp_IsVertex(theGraph, context->E[e].noStraddle)) break; context->E[e].noStraddle = u_max; @@ -1189,7 +1187,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: @@ -1247,7 +1245,7 @@ int _ReduceBicomp(graphP theGraph, K33SearchContext *context, int R) cycle edge to form the path that will be reduced to the external face cycle edge (V, max). */ - A_edge = gp_GetLastArc(theGraph, IC->r); + A_edge = gp_GetLastEdge(theGraph, IC->r); A = gp_GetNeighbor(theGraph, A_edge); yrType = EDGE_TYPE_BACK; @@ -1259,12 +1257,12 @@ int _ReduceBicomp(graphP theGraph, K33SearchContext *context, int R) if (max == IC->y) { - B_edge = gp_GetLastArc(theGraph, IC->x); - while (B_edge != gp_GetFirstArc(theGraph, IC->x)) + B_edge = gp_GetLastEdge(theGraph, IC->x); + while (B_edge != gp_GetFirstEdge(theGraph, IC->x)) { if (gp_GetEdgeVisited(theGraph, B_edge)) break; - B_edge = gp_GetPrevArc(theGraph, B_edge); + B_edge = gp_GetPrevEdge(theGraph, B_edge); } if (!gp_GetEdgeVisited(theGraph, B_edge)) @@ -1281,7 +1279,7 @@ int _ReduceBicomp(graphP theGraph, K33SearchContext *context, int R) else if (max == IC->w) { - B_edge = gp_GetFirstArc(theGraph, IC->x); + B_edge = gp_GetFirstEdge(theGraph, IC->x); B = gp_GetNeighbor(theGraph, B_edge); xwType = EDGE_TYPE_BACK; } @@ -1295,18 +1293,18 @@ int _ReduceBicomp(graphP theGraph, K33SearchContext *context, int R) else { - A_edge = gp_GetFirstArc(theGraph, IC->r); + A_edge = gp_GetFirstEdge(theGraph, IC->r); A = gp_GetNeighbor(theGraph, A_edge); rxType = EDGE_TYPE_BACK; if (max == IC->x) { - B_edge = gp_GetFirstArc(theGraph, IC->y); - while (B_edge != gp_GetLastArc(theGraph, IC->y)) + B_edge = gp_GetFirstEdge(theGraph, IC->y); + while (B_edge != gp_GetLastEdge(theGraph, IC->y)) { if (gp_GetEdgeVisited(theGraph, B_edge)) break; - B_edge = gp_GetNextArc(theGraph, B_edge); + B_edge = gp_GetNextEdge(theGraph, B_edge); } if (!gp_GetEdgeVisited(theGraph, B_edge)) @@ -1318,7 +1316,7 @@ int _ReduceBicomp(graphP theGraph, K33SearchContext *context, int R) else if (max == IC->w) { - B_edge = gp_GetLastArc(theGraph, IC->y); + B_edge = gp_GetLastEdge(theGraph, IC->y); B = gp_GetNeighbor(theGraph, B_edge); wyType = EDGE_TYPE_BACK; } @@ -1332,7 +1330,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 @@ -1355,7 +1353,7 @@ int _ReduceBicomp(graphP theGraph, K33SearchContext *context, int R) return NOTOK; gp_SetEdgeVisited(theGraph, A_edge); - gp_SetEdgeVisited(theGraph, gp_GetTwinArc(theGraph, A_edge)); + gp_SetEdgeVisited(theGraph, gp_GetTwin(theGraph, A_edge)); /* Now we use B to mark either an X-Y path or a path of the external face corresponding to: @@ -1368,7 +1366,7 @@ int _ReduceBicomp(graphP theGraph, K33SearchContext *context, int R) return NOTOK; gp_SetEdgeVisited(theGraph, B_edge); - gp_SetEdgeVisited(theGraph, gp_GetTwinArc(theGraph, B_edge)); + gp_SetEdgeVisited(theGraph, gp_GetTwin(theGraph, B_edge)); /* Delete the unmarked edges in the bicomp. Note that if an unmarked edge * represents a reduced path, then only the reduction edge is deleted here. @@ -1380,7 +1378,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 +1418,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)); + _K33Search_InitEdgeRec(context, gp_GetTwin(theGraph, e)); - return gp_DeleteEdge(theGraph, e, nextLink); + return gp_DeleteEdge(theGraph, e); } /******************************************************************** @@ -1446,7 +1444,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); @@ -1454,15 +1452,16 @@ int _K33Search_DeleteUnmarkedEdgesInBicomp(graphP theGraph, K33SearchContext *co { sp_Pop(theGraph->theStack, V); - e = gp_GetFirstArc(theGraph, V); - while (gp_IsArc(e)) + e = gp_GetFirstEdge(theGraph, V); + while (gp_IsEdge(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_GetNextEdge(theGraph, e); + if (!gp_GetEdgeVisited(theGraph, e)) + _K33Search_DeleteEdge(theGraph, context, e); + e = eNext; } } return OK; @@ -1502,25 +1501,25 @@ int _ReduceExternalFacePathToEdge(graphP theGraph, K33SearchContext *context, in endpoint of the original path is a newly added edge, not a reduction edge. */ - e = gp_GetFirstArc(theGraph, u); - if (gp_IsVertex(context->E[e].pathConnector)) + e = gp_GetFirstEdge(theGraph, u); + if (gp_IsAnyTypeVertex(theGraph, context->E[e].pathConnector)) { if (_RestoreReducedPath(theGraph, context, e) != OK) return NOTOK; - e = gp_GetFirstArc(theGraph, u); + e = gp_GetFirstEdge(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)) + e = gp_GetLastEdge(theGraph, x); + if (gp_IsAnyTypeVertex(theGraph, context->E[e].pathConnector)) { if (_RestoreReducedPath(theGraph, context, e) != OK) return NOTOK; - e = gp_GetLastArc(theGraph, x); + e = gp_GetLastEdge(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 @@ -1529,13 +1528,13 @@ int _ReduceExternalFacePathToEdge(graphP theGraph, K33SearchContext *context, in gp_AddEdge(theGraph, u, 0, x, 1); - e = gp_GetFirstArc(theGraph, u); + e = gp_GetFirstEdge(theGraph, u); context->E[e].pathConnector = v; - gp_SetEdgeType(theGraph, e, _ComputeArcType(theGraph, u, x, edgeType)); + gp_SetEdgeType(theGraph, e, _ComputeEdgeRecordType(theGraph, u, x, edgeType)); - e = gp_GetLastArc(theGraph, x); + e = gp_GetLastEdge(theGraph, x); context->E[e].pathConnector = w; - gp_SetEdgeType(theGraph, e, _ComputeArcType(theGraph, x, u, edgeType)); + gp_SetEdgeType(theGraph, e, _ComputeEdgeRecordType(theGraph, x, u, edgeType)); /* Set the external face info */ @@ -1553,8 +1552,8 @@ int _ReduceXYPathToEdge(graphP theGraph, K33SearchContext *context, int u, int x { int e, v, w; - e = gp_GetFirstArc(theGraph, u); - e = gp_GetNextArc(theGraph, e); + e = gp_GetFirstEdge(theGraph, u); + e = gp_GetNextEdge(theGraph, e); v = gp_GetNeighbor(theGraph, e); /* If the XY-path is a single edge, then no reduction is needed */ @@ -1564,45 +1563,45 @@ 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; - e = gp_GetFirstArc(theGraph, u); - e = gp_GetNextArc(theGraph, e); + e = gp_GetFirstEdge(theGraph, u); + e = gp_GetNextEdge(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); + e = gp_GetFirstEdge(theGraph, x); + e = gp_GetNextEdge(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; - e = gp_GetFirstArc(theGraph, x); - e = gp_GetNextArc(theGraph, e); + e = gp_GetFirstEdge(theGraph, x); + e = gp_GetNextEdge(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, - x, gp_GetFirstArc(theGraph, x), 0); + gp_InsertEdge(theGraph, u, gp_GetFirstEdge(theGraph, u), 0, + x, gp_GetFirstEdge(theGraph, x), 0); /* Now set up the path connectors so the original XY-path can be recovered if needed. Also, set the reduction edge's type to preserve the DFS tree structure */ - e = gp_GetFirstArc(theGraph, u); - e = gp_GetNextArc(theGraph, e); + e = gp_GetFirstEdge(theGraph, u); + e = gp_GetNextEdge(theGraph, e); context->E[e].pathConnector = v; - gp_SetEdgeType(theGraph, e, _ComputeArcType(theGraph, u, x, edgeType)); + gp_SetEdgeType(theGraph, e, _ComputeEdgeRecordType(theGraph, u, x, edgeType)); - e = gp_GetFirstArc(theGraph, x); - e = gp_GetNextArc(theGraph, e); + e = gp_GetFirstEdge(theGraph, x); + e = gp_GetNextEdge(theGraph, e); context->E[e].pathConnector = w; - gp_SetEdgeType(theGraph, e, _ComputeArcType(theGraph, x, u, edgeType)); + gp_SetEdgeType(theGraph, e, _ComputeEdgeRecordType(theGraph, x, u, edgeType)); return OK; } @@ -1622,10 +1621,10 @@ 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); + eTwin = gp_GetTwin(theGraph, e); u = gp_GetNeighbor(theGraph, eTwin); v = context->E[e].pathConnector; @@ -1636,21 +1635,21 @@ int _RestoreReducedPath(graphP theGraph, K33SearchContext *context, int e) edge records must be added in order to reconnect the path parallel to the edge. */ - e0 = gp_GetNextArc(theGraph, e); - e1 = gp_GetPrevArc(theGraph, e); - eTwin0 = gp_GetNextArc(theGraph, eTwin); - eTwin1 = gp_GetPrevArc(theGraph, eTwin); + e0 = gp_GetNextEdge(theGraph, e); + e1 = gp_GetPrevEdge(theGraph, e); + eTwin0 = gp_GetNextEdge(theGraph, eTwin); + eTwin1 = gp_GetPrevEdge(theGraph, eTwin); /* 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. */ + restoring the path to ensure we do not exceed the maximum edge 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_IsEdge(theGraph, e0)) { if (gp_InsertEdge(theGraph, u, e0, 1, v, NIL, 0) != OK) return NOTOK; @@ -1661,7 +1660,7 @@ int _RestoreReducedPath(graphP theGraph, K33SearchContext *context, int e) return NOTOK; } - if (gp_IsArc(eTwin0)) + if (gp_IsEdge(theGraph, eTwin0)) { if (gp_InsertEdge(theGraph, x, eTwin0, 1, w, NIL, 0) != OK) return NOTOK; @@ -1690,7 +1689,7 @@ int _RestoreReducedPath(graphP theGraph, K33SearchContext *context, int e) Note that the new path may contain more reduction edges, and these will be iteratively expanded by the outer for loop. - If the edge records of an edge being expanded are the first or last arcs + If the edge records of an edge being expanded are the first or last edges of the edge's vertex endpoints, then the edge may be along the external face. If so, then the vertices along the path being restored must be given a consistent orientation with the endpoints. It is expected that the embedding @@ -1702,14 +1701,14 @@ int _RestoreAndOrientReducedPaths(graphP theGraph, K33SearchContext *context) int EsizeOccupied, e, eTwin, u, v, w, x, visited; int e0, eTwin0, e1, eTwin1; - EsizeOccupied = gp_EdgeInUseIndexBound(theGraph); - for (e = gp_GetFirstEdge(theGraph); e < EsizeOccupied;) + EsizeOccupied = gp_EdgeInUseArraySize(theGraph); + for (e = gp_EdgeArrayStart(theGraph); e < EsizeOccupied;) { - if (gp_IsVertex(context->E[e].pathConnector)) + if (gp_IsAnyTypeVertex(theGraph, context->E[e].pathConnector)) { visited = gp_GetEdgeVisited(theGraph, e); - eTwin = gp_GetTwinArc(theGraph, e); + eTwin = gp_GetTwin(theGraph, e); u = gp_GetNeighbor(theGraph, eTwin); v = context->E[e].pathConnector; w = context->E[eTwin].pathConnector; @@ -1721,21 +1720,21 @@ int _RestoreAndOrientReducedPaths(graphP theGraph, K33SearchContext *context) will be between e0 and e1. Likewise, the edge record (x -> w) will be placed between eTwin0 and eTwin1. */ - e0 = gp_GetNextArc(theGraph, e); - e1 = gp_GetPrevArc(theGraph, e); - eTwin0 = gp_GetNextArc(theGraph, eTwin); - eTwin1 = gp_GetPrevArc(theGraph, eTwin); + e0 = gp_GetNextEdge(theGraph, e); + e1 = gp_GetPrevEdge(theGraph, e); + eTwin0 = gp_GetNextEdge(theGraph, eTwin); + eTwin1 = gp_GetPrevEdge(theGraph, eTwin); /* 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. */ + restoring the path to ensure we do not exceed the maximum edge 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_IsEdge(theGraph, e0)) { if (gp_InsertEdge(theGraph, u, e0, 1, v, NIL, 0) != OK) return NOTOK; @@ -1746,7 +1745,7 @@ int _RestoreAndOrientReducedPaths(graphP theGraph, K33SearchContext *context) return NOTOK; } - if (gp_IsArc(eTwin0)) + if (gp_IsEdge(theGraph, eTwin0)) { if (gp_InsertEdge(theGraph, x, eTwin0, 1, w, NIL, 0) != OK) return NOTOK; @@ -1774,7 +1773,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_IsNotEdge(theGraph, e0) && gp_IsNotEdge(theGraph, eTwin1)) || (gp_IsNotEdge(theGraph, e1) && gp_IsNotEdge(theGraph, eTwin0))) { if (_OrientExternalFacePath(theGraph, u, v, w, x) != OK) return NOTOK; @@ -1789,12 +1788,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,29 +1820,29 @@ 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)) + e = gp_GetFirstEdge(theGraph, p); + while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_PARENT) break; - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } gp_SetEdgeVisited(theGraph, e); - gp_SetEdgeVisited(theGraph, gp_GetTwinArc(theGraph, e)); + gp_SetEdgeVisited(theGraph, gp_GetTwin(theGraph, e)); p = gp_GetNeighbor(theGraph, e); /* 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); } } @@ -1855,28 +1854,28 @@ 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)) + e = gp_GetFirstEdge(theGraph, p); + while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_PARENT) break; - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } gp_ClearEdgeVisited(theGraph, e); - gp_ClearEdgeVisited(theGraph, gp_GetTwinArc(theGraph, e)); + gp_ClearEdgeVisited(theGraph, gp_GetTwin(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 +1926,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..16f7fe6 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. */ @@ -16,8 +16,8 @@ extern "C" #define K33SEARCH_NAME "K33Search" - int gp_AttachK33Search(graphP theGraph); - int gp_DetachK33Search(graphP theGraph); + int gp_ExtendWith_K33Search(graphP theGraph); + int gp_Detach_K33Search(graphP theGraph); #ifdef __cplusplus } diff --git a/planarity/c/graphLib/homeomorphSearch/graphK33Search.private.h b/planarity/c/graphLib/homeomorphSearch/graphK33Search.private.h index 36c36ff..e489532 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,10 +22,10 @@ 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; + int separatedDFSChildList, backEdgeList, mergeBlocker; } K33Search_VertexInfo; typedef K33Search_VertexInfo *K33Search_VertexInfoP; @@ -55,6 +55,8 @@ extern "C" } K33SearchContext; + extern int K33SEARCH_ID; + #ifdef __cplusplus } #endif diff --git a/planarity/c/graphLib/homeomorphSearch/graphK33Search_Extensions.c b/planarity/c/graphLib/homeomorphSearch/graphK33Search_Extensions.c index d449dd8..db480e9 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. */ @@ -30,7 +30,7 @@ void _K33Search_InitVertexInfo(K33SearchContext *context, int v); /* Forward declarations of overloading functions */ int _K33Search_EmbeddingInitialize(graphP theGraph); -void _CreateBackArcLists(graphP theGraph, K33SearchContext *context); +void _CreateBackEdgeLists(graphP theGraph, K33SearchContext *context); void _CreateSeparatedDFSChildLists(graphP theGraph, K33SearchContext *context); void _K33Search_EmbedBackEdgeToDescendant(graphP theGraph, int RootSide, int RootVertex, int W, int WPrevLink); int _K33Search_MergeBicomps(graphP theGraph, int v, int RootVertex, int W, int WPrevLink); @@ -42,7 +42,7 @@ int _K33Search_CheckObstructionIntegrity(graphP theGraph, graphP origGraph); int _K33Search_InitGraph(graphP theGraph, int N); void _K33Search_ReinitializeGraph(graphP theGraph); -int _K33Search_EnsureArcCapacity(graphP theGraph, int requiredArcCapacity); +int _K33Search_EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity); /* Forward declarations of functions used by the extension system */ @@ -58,13 +58,13 @@ void _K33Search_FreeContext(void *); int K33SEARCH_ID = 0; /**************************************************************************** - gp_AttachK33Search() + gp_ExtendWith_K33Search() This function adjusts the graph data structure to attach the K3,3 search feature. ****************************************************************************/ -int gp_AttachK33Search(graphP theGraph) +int gp_ExtendWith_K33Search(graphP theGraph) { K33SearchContext *context = NULL; @@ -105,7 +105,7 @@ int gp_AttachK33Search(graphP theGraph) context->functions.fpInitGraph = _K33Search_InitGraph; context->functions.fpReinitializeGraph = _K33Search_ReinitializeGraph; - context->functions.fpEnsureArcCapacity = _K33Search_EnsureArcCapacity; + context->functions.fpEnsureEdgeCapacity = _K33Search_EnsureEdgeCapacity; _K33Search_ClearStructures(context); @@ -116,6 +116,8 @@ int gp_AttachK33Search(graphP theGraph) &context->functions) != OK) { _K33Search_FreeContext(context); + context = NULL; + return NOTOK; } @@ -125,12 +127,14 @@ int gp_AttachK33Search(graphP theGraph) // also happens before gp_InitGraph(), which means N==0. // However, sometimes a feature is attached after gp_InitGraph(), in // which case N > 0 - if (theGraph->N > 0) + if (gp_GetN(theGraph) > 0) { if (_K33Search_CreateStructures(context) != OK || _K33Search_InitStructures(context) != OK) { _K33Search_FreeContext(context); + context = NULL; + return NOTOK; } } @@ -139,10 +143,10 @@ int gp_AttachK33Search(graphP theGraph) } /******************************************************************** - gp_DetachK33Search() + gp_Detach_K33Search() ********************************************************************/ -int gp_DetachK33Search(graphP theGraph) +int gp_Detach_K33Search(graphP theGraph) { return gp_RemoveExtension(theGraph, K33SEARCH_ID); } @@ -196,10 +200,10 @@ 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) + if (gp_GetN(context->theGraph) <= 0) return NOTOK; if ((context->E = (K33Search_EdgeRecP)malloc(Esize * sizeof(K33Search_EdgeRec))) == NULL || @@ -219,21 +223,21 @@ 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; // int v, e, Esize; - // if (theGraph->N <= 0) + // if (gp_GetN(theGraph) <= 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); - // for (e = gp_GetFirstEdge(theGraph); e < Esize; e++) + // Esize = gp_EdgeArraySize(theGraph); + // for (e = gp_EdgeArrayStart(theGraph); e < Esize; e++) // _K33Search_InitEdgeRec(context, e); return OK; @@ -254,8 +258,8 @@ int _K33Search_InitGraph(graphP theGraph, int N) theGraph->N = N; theGraph->NV = N; - if (theGraph->arcCapacity == 0) - theGraph->arcCapacity = 2 * DEFAULT_EDGE_LIMIT * N; + if (theGraph->edgeCapacity == 0) + theGraph->edgeCapacity = DEFAULT_EDGE_LIMIT * N; if (_K33Search_CreateStructures(context) != OK || _K33Search_InitStructures(context) != OK) @@ -287,15 +291,16 @@ void _K33Search_ReinitializeGraph(graphP theGraph) } /******************************************************************** - The current implementation does not support an increase of arc - (edge record) capacity once the extension is attached to the graph - data structure. This is only due to not being necessary to support. + The current implementation does not support an increase of edge + capacity once the extension is attached to the graph data structure. + This is only due to not being necessary to support. + For now, it is easy to ensure the correct capacity before attaching the extension, but support could be added later if there is some reason to do so. ********************************************************************/ -int _K33Search_EnsureArcCapacity(graphP theGraph, int requiredArcCapacity) +int _K33Search_EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity) { return NOTOK; } @@ -311,8 +316,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 +330,8 @@ void *_K33Search_DupContext(void *pContext, void *theGraph) if (_K33Search_CreateStructures(newContext) != OK) { _K33Search_FreeContext(newContext); + newContext = NULL; + return NULL; } @@ -354,7 +361,7 @@ void _K33Search_FreeContext(void *pContext) This method overloads the embedding initialization phase of the core planarity algorithm to provide post-processing that creates - the back arcs list and separated DFS child list (sorted by + the back edges list and separated DFS child list (sorted by lowpoint) for each vertex. ********************************************************************/ @@ -368,9 +375,9 @@ int _K33Search_EmbeddingInitialize(graphP theGraph) if (context->functions.fpEmbeddingInitialize(theGraph) != OK) return NOTOK; - if (theGraph->embedFlags == EMBEDFLAGS_SEARCHFORK33) + if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK33) { - _CreateBackArcLists(theGraph, context); + _CreateBackEdgeLists(theGraph, context); _CreateSeparatedDFSChildLists(theGraph, context); } @@ -381,41 +388,41 @@ int _K33Search_EmbeddingInitialize(graphP theGraph) } /******************************************************************** - _CreateBackArcLists() + _CreateBackEdgeLists() ********************************************************************/ -void _CreateBackArcLists(graphP theGraph, K33SearchContext *context) +void _CreateBackEdgeLists(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)) + e = gp_GetVertexFwdEdgeList(theGraph, v); + while (gp_IsEdge(theGraph, e)) { - // Get the ancestor endpoint and the associated back arc + // Get the ancestor endpoint and the associated back edge record ancestor = gp_GetNeighbor(theGraph, e); - eTwin = gp_GetTwinArc(theGraph, e); + eTwin = gp_GetTwin(theGraph, e); - // Put it into the back arc list of the ancestor - if (gp_IsNotArc(context->VI[ancestor].backArcList)) + // Put it into the back edge list of the ancestor + if (gp_IsNotEdge(theGraph, context->VI[ancestor].backEdgeList)) { - context->VI[ancestor].backArcList = eTwin; - gp_SetPrevArc(theGraph, eTwin, eTwin); - gp_SetNextArc(theGraph, eTwin, eTwin); + context->VI[ancestor].backEdgeList = eTwin; + gp_SetPrevEdge(theGraph, eTwin, eTwin); + gp_SetNextEdge(theGraph, eTwin, eTwin); } else { - int eHead = context->VI[ancestor].backArcList; - int eTail = gp_GetPrevArc(theGraph, eHead); - gp_SetPrevArc(theGraph, eTwin, eTail); - gp_SetNextArc(theGraph, eTwin, eHead); - gp_SetPrevArc(theGraph, eHead, eTwin); - gp_SetNextArc(theGraph, eTail, eTwin); + int eHead = context->VI[ancestor].backEdgeList; + int eTail = gp_GetPrevEdge(theGraph, eHead); + gp_SetPrevEdge(theGraph, eTwin, eTail); + gp_SetNextEdge(theGraph, eTwin, eHead); + gp_SetPrevEdge(theGraph, eHead, eTwin); + gp_SetNextEdge(theGraph, eTail, eTwin); } - // Advance to the next forward edge - e = gp_GetNextArc(theGraph, e); - if (e == gp_GetVertexFwdArcList(theGraph, v)) + // Advance to the next forward edge record of v (or NIL if done) + e = gp_GetNextEdge(theGraph, e); + if (e == gp_GetVertexFwdEdgeList(theGraph, v)) e = NIL; } } @@ -438,12 +445,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 +460,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); @@ -477,10 +484,10 @@ void _CreateSeparatedDFSChildLists(graphP theGraph, K33SearchContext *context) /******************************************************************** _K33Search_EmbedBackEdgeToDescendant() - The forward and back arcs of the cycle edge are embedded by the planarity - version of this function. - However, for K_{3,3} subgraph homeomorphism, we also maintain the - list of unembedded back arcs, so we need to remove the back arc from + The forward and back edge records of a back edge (cycle edge, co-tree + edge, etc.) are embedded by the planarity version of this function. + For K_{3,3} subgraph homeomorphism, we also maintain the list of + unembedded back edges, so we need to remove the back edge from that list since it is now being put back into the adjacency list. ********************************************************************/ @@ -492,22 +499,23 @@ void _K33Search_EmbedBackEdgeToDescendant(graphP theGraph, int RootSide, int Roo if (context != NULL) { // K33 search may have been attached, but not enabled - if (theGraph->embedFlags == EMBEDFLAGS_SEARCHFORK33) + if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK33) { - // Get the fwdArc from the adjacentTo field, and use it to get the backArc - int backArc = gp_GetTwinArc(theGraph, gp_GetVertexPertinentEdge(theGraph, W)); + // Get the forward edge record from the adjacentTo field, and + // use it to get the back edge record + int backEdgeRec = gp_GetTwin(theGraph, gp_GetVertexPertinentEdge(theGraph, W)); - // Remove the backArc from the backArcList - if (context->VI[W].backArcList == backArc) + // Remove the backEdgeRecfrom the backEdgeList + if (context->VI[W].backEdgeList == backEdgeRec) { - if (gp_GetNextArc(theGraph, backArc) == backArc) - context->VI[W].backArcList = NIL; + if (gp_GetNextEdge(theGraph, backEdgeRec) == backEdgeRec) + context->VI[W].backEdgeList = NIL; else - context->VI[W].backArcList = gp_GetNextArc(theGraph, backArc); + context->VI[W].backEdgeList = gp_GetNextEdge(theGraph, backEdgeRec); } - gp_SetNextArc(theGraph, gp_GetPrevArc(theGraph, backArc), gp_GetNextArc(theGraph, backArc)); - gp_SetPrevArc(theGraph, gp_GetNextArc(theGraph, backArc), gp_GetPrevArc(theGraph, backArc)); + gp_SetNextEdge(theGraph, gp_GetPrevEdge(theGraph, backEdgeRec), gp_GetNextEdge(theGraph, backEdgeRec)); + gp_SetPrevEdge(theGraph, gp_GetNextEdge(theGraph, backEdgeRec), gp_GetPrevEdge(theGraph, backEdgeRec)); } // Invoke the superclass version of the function @@ -538,7 +546,7 @@ int _K33Search_MergeBicomps(graphP theGraph, int v, int RootVertex, int W, int W /* If the merge is blocked, then a K_{3,3} homeomorph is isolated, and NONEMBEDDABLE is returned so that the Walkdown terminates */ - if (theGraph->embedFlags == EMBEDFLAGS_SEARCHFORK33) + if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK33) { int mergeBlocker; @@ -551,7 +559,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; @@ -590,10 +598,10 @@ void _K33Search_MergeVertex(graphP theGraph, int W, int WPrevLink, int R) if (context != NULL) { - if (theGraph->embedFlags == EMBEDFLAGS_SEARCHFORK33) + if (gp_GetEmbedFlags(theGraph) == 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; } @@ -616,7 +624,7 @@ void _K33Search_InitEdgeRec(K33SearchContext *context, int e) void _K33Search_InitVertexInfo(K33SearchContext *context, int v) { context->VI[v].separatedDFSChildList = NIL; - context->VI[v].backArcList = NIL; + context->VI[v].backEdgeList = NIL; context->VI[v].mergeBlocker = NIL; } @@ -631,7 +639,7 @@ int _K33Search_HandleBlockedBicomp(graphP theGraph, int v, int RootVertex, int R if (context == NULL) return NOTOK; - if (theGraph->embedFlags == EMBEDFLAGS_SEARCHFORK33) + if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK33) { // If R is the root of a descendant bicomp of v, we push it, but then we know the search for K3,3 // will be successful and return NONEMBEDDABLE because this condition corresponds to minor A, which @@ -664,18 +672,18 @@ int _K33Search_EmbedPostprocess(graphP theGraph, int v, int edgeEmbeddingResult) // For K3,3 search, we just return the edge embedding result because the // search result has been obtained already. - if (theGraph->embedFlags == EMBEDFLAGS_SEARCHFORK33) + if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK33) { if (edgeEmbeddingResult == OK) { // When a graph does not contain a K3,3 homeomorph, the embedding // is meaningless, so we empty it out. We preserve the embedFlags // to ensure post-processing continues as expected. - savedEmbedFlags = theGraph->embedFlags; - savedZEROBASEDIO = theGraph->internalFlags & FLAGS_ZEROBASEDIO; + savedEmbedFlags = gp_GetEmbedFlags(theGraph); + savedZEROBASEDIO = gp_GetGraphFlags(theGraph) & FLAGS_ZEROBASEDIO; gp_ReinitializeGraph(theGraph); theGraph->embedFlags = savedEmbedFlags; - theGraph->internalFlags &= savedZEROBASEDIO; + theGraph->graphFlags &= savedZEROBASEDIO; } return edgeEmbeddingResult; @@ -701,7 +709,7 @@ int _K33Search_EmbedPostprocess(graphP theGraph, int v, int edgeEmbeddingResult) int _K33Search_CheckEmbeddingIntegrity(graphP theGraph, graphP origGraph) { - if (theGraph->embedFlags == EMBEDFLAGS_SEARCHFORK33) + if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK33) { return OK; } @@ -728,7 +736,7 @@ int _K33Search_CheckObstructionIntegrity(graphP theGraph, graphP origGraph) { // When searching for K3,3, we ensure that theGraph is a subgraph of // the original graph and that it contains a K3,3 homeomorph - if (theGraph->embedFlags == EMBEDFLAGS_SEARCHFORK33) + if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK33) { int degrees[5], imageVerts[6]; diff --git a/planarity/c/graphLib/homeomorphSearch/graphK4Search.c b/planarity/c/graphLib/homeomorphSearch/graphK4Search.c index 9364fcf..291ef32 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. */ @@ -7,20 +7,18 @@ See the LICENSE.TXT file for licensing information. #include "graphK4Search.h" #include "graphK4Search.private.h" -extern int K4SEARCH_ID; - #include "../graph.h" /* 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 _ClearObstructionMarksInBicomp(graphP theGraph, int BicompRoot); // extern int _DeleteUnmarkedEdgesInBicomp(graphP theGraph, int BicompRoot); -extern int _ComputeArcType(graphP theGraph, int a, int b, int edgeType); +extern int _ComputeEdgeRecordType(graphP theGraph, int a, int b, int edgeType); extern int _SetEdgeType(graphP theGraph, int u, int v); extern int _GetNeighborOnExtFace(graphP theGraph, int curVertex, int *pPrevLink); @@ -29,8 +27,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 +58,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 +75,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); @@ -119,7 +117,7 @@ int _SearchForK4InBicomp(graphP theGraph, K4SearchContext *context, int v, int R // merge point, and this operation will push at most two // integers per tree edge in the bicomp, so the stack // will not overflow. - if (sp_GetCapacity(theGraph->theStack) < 6 * theGraph->N) + if (sp_GetCapacity(theGraph->theStack) < 6 * gp_GetN(theGraph)) return NOTOK; if (_OrientVerticesInBicomp(theGraph, R, 1) != OK) @@ -141,7 +139,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 +173,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 +199,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 +221,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 (_ClearObstructionMarksInBicomp(theGraph, R) != OK) return NOTOK; // Since neither A1 nor A2 is found, then we reduce the bicomp to the @@ -270,7 +268,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 +302,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 +368,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 +457,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 +621,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; @@ -634,22 +632,22 @@ int _K4_FindSeparatingInternalEdge(graphP theGraph, int R, int prevLink, int A, // Search for a separator among the edges of Z // 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)) + e = gp_GetFirstEdge(theGraph, Z); + while (gp_IsEdge(theGraph, e)) { neighbor = gp_GetNeighbor(theGraph, e); - if (gp_GetVertexObstructionType(theGraph, neighbor) == VERTEX_OBSTRUCTIONTYPE_UNMARKED) + if (!gp_GetMarked(theGraph, neighbor)) { *pW = A; *pX = Z; *pY = neighbor; break; } - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } // 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 +657,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. + with R's link[1^prevLink] edge record. ****************************************************************************/ -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. + with R's link[1^prevLink] edge record. ****************************************************************************/ -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 +757,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 +829,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 +866,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; @@ -877,13 +875,13 @@ 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)) + R, gp_GetFirstEdge(theGraph, R), W, gp_GetFirstEdge(theGraph, W)); + if (gp_IsNotEdge(theGraph, newEdge)) return NOTOK; // Finally, set the visited info state of W to unvisited so that // the core embedder (esp. Walkup) will not have any problems. - gp_SetVertexVisitedInfo(theGraph, W, theGraph->N); + gp_SetVertexVisitedInfo(theGraph, W, gp_GetN(theGraph)); return OK; } @@ -947,7 +945,7 @@ int _K4_ReducePathComponent(graphP theGraph, K4SearchContext *context, int R, in int e_R, e_A, Z, ZPrevLink, edgeType, invertedFlag = 0; // Check whether the external face path (R, ..., A) is just an edge - e_R = gp_GetArc(theGraph, R, 1 ^ prevLink); + e_R = gp_GetEdgeByLink(theGraph, R, 1 ^ prevLink); if (gp_GetNeighbor(theGraph, e_R) == A) return OK; @@ -968,7 +966,7 @@ int _K4_ReducePathComponent(graphP theGraph, K4SearchContext *context, int R, in _K4_ClearVisitedInPathComponent(theGraph, R, prevLink, A); Z = gp_GetNeighbor(theGraph, e_R); gp_SetEdgeVisited(theGraph, e_R); - gp_SetEdgeVisited(theGraph, gp_GetTwinArc(theGraph, e_R)); + gp_SetEdgeVisited(theGraph, gp_GetTwin(theGraph, e_R)); if (theGraph->functions.fpMarkDFSPath(theGraph, A, Z) != OK) { return NOTOK; @@ -984,7 +982,7 @@ int _K4_ReducePathComponent(graphP theGraph, K4SearchContext *context, int R, in // will remain in the embedding, and the core embedder (Walkup) uses a // value greater than the current vertex to indicate an unvisited vertex _K4_ClearVisitedInPathComponent(theGraph, R, prevLink, A); - gp_SetVertexVisitedInfo(theGraph, A, theGraph->N); + gp_SetVertexVisitedInfo(theGraph, A, gp_GetN(theGraph)); // Find the component's remaining edges e_A and e_R incident to A and R ZPrevLink = prevLink; @@ -993,12 +991,12 @@ int _K4_ReducePathComponent(graphP theGraph, K4SearchContext *context, int R, in { Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); } - e_A = gp_GetArc(theGraph, A, ZPrevLink); - e_R = gp_GetArc(theGraph, R, 1 ^ prevLink); + e_A = gp_GetEdgeByLink(theGraph, A, ZPrevLink); + e_R = gp_GetEdgeByLink(theGraph, R, 1 ^ prevLink); // 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_IsNotEdge(theGraph, e_R)) return NOTOK; // Preserve the net orientation along the DFS path in the case of a tree edge @@ -1029,7 +1027,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); @@ -1037,15 +1035,16 @@ int _K4_DeleteUnmarkedEdgesInBicomp(graphP theGraph, K4SearchContext *context, i { sp_Pop(theGraph->theStack, V); - e = gp_GetFirstArc(theGraph, V); - while (gp_IsArc(e)) + e = gp_GetFirstEdge(theGraph, V); + while (gp_IsEdge(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_GetNextEdge(theGraph, e); + if (!gp_GetEdgeVisited(theGraph, e)) + _K4_DeleteEdge(theGraph, context, e); + e = eNext; } } return OK; @@ -1059,12 +1058,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)); + _K4Search_InitEdgeRec(context, gp_GetTwin(theGraph, e)); - return gp_DeleteEdge(theGraph, e, nextLink); + return gp_DeleteEdge(theGraph, e); } /**************************************************************************** @@ -1079,17 +1078,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 @@ -1097,23 +1096,23 @@ 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)) + e = gp_GetFirstEdge(theGraph, descendant); + while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_PARENT) { parent = gp_GetNeighbor(theGraph, e); break; } - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } // 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 - e = gp_GetTwinArc(theGraph, e); + // Add the inversion flag on the child edge record to the cumulative result + e = gp_GetTwin(theGraph, e); if (gp_GetEdgeType(theGraph, e) != EDGE_TYPE_CHILD || gp_GetNeighbor(theGraph, e) != descendant) return NOTOK; invertedFlag ^= gp_GetEdgeFlagInverted(theGraph, e); @@ -1152,10 +1151,12 @@ int _K4_TestPathComponentForAncestor(graphP theGraph, int R, int prevLink, int A There is a subcomponent of the bicomp rooted by R that is separable by the 2-cut (R, A). The component contains the external face path from R to A. - The 1^prevLink arc of R is contained in that path (i.e. the first arc if - prevLink indicates the last, or the last arc if prevLink indicates the first). - The prevLink is passed because _GetNeighborOnExtFace() uses the - opposing link to traverse to the "next" vertex. + The 1^prevLink edge record of R is contained in that path (i.e. the first + edge record if prevLink indicates the last, or the last edge record if + prevLink indicates the first). + + The prevLink is passed because _GetNeighborOnExtFace() uses the opposing + link to traverse to the "next" vertex. All vertices in this desired component are along the external face, so we traverse along the external face vertices strictly between R and A and @@ -1174,15 +1175,15 @@ void _K4_ClearVisitedInPathComponent(graphP theGraph, int R, int prevLink, int A Z = _GetNeighborOnExtFace(theGraph, R, &ZPrevLink); while (Z != A) { - gp_ClearVertexVisited(theGraph, Z); - e = gp_GetFirstArc(theGraph, Z); - while (gp_IsArc(e)) + gp_ClearVisited(theGraph, Z); + e = gp_GetFirstEdge(theGraph, Z); + while (gp_IsEdge(theGraph, e)) { gp_ClearEdgeVisited(theGraph, e); - gp_ClearEdgeVisited(theGraph, gp_GetTwinArc(theGraph, e)); - gp_ClearVertexVisited(theGraph, gp_GetNeighbor(theGraph, e)); + gp_ClearEdgeVisited(theGraph, gp_GetTwin(theGraph, e)); + gp_ClearVisited(theGraph, gp_GetNeighbor(theGraph, e)); - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); @@ -1194,8 +1195,8 @@ void _K4_ClearVisitedInPathComponent(graphP theGraph, int R, int prevLink, int A There is a subcomponent of the bicomp rooted by R that is separable by the 2-cut (R, A) and contains the external face path from R to A that includes - the arc gp_GetArc(theGraph, R, 1^prevLink), which is the first arc traversed - by _GetNeighborOnExtFace(..., &prevLink). + the gp_GetEdgeByLink(theGraph, R, 1^prevLink) edge record, which is the + first edge record traversed by _GetNeighborOnExtFace(..., &prevLink). The edges in the component have been marked unvisited except for a path we intend to preserve. This routine deletes the unvisited edges. @@ -1232,21 +1233,21 @@ int _K4_DeleteUnmarkedEdgesInPathComponent(graphP theGraph, int R, int prevLink, Z = _GetNeighborOnExtFace(theGraph, R, &ZPrevLink); while (Z != A) { - e = gp_GetFirstArc(theGraph, Z); - while (gp_IsArc(e)) + e = gp_GetFirstEdge(theGraph, Z); + while (gp_IsEdge(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 // when processing an edge whose endpoints are both internal to // the path (R ... A) if (!gp_GetEdgeVisited(theGraph, e) && - (e < gp_GetTwinArc(theGraph, e) || + (e < gp_GetTwin(theGraph, e) || gp_GetNeighbor(theGraph, e) == R || gp_GetNeighbor(theGraph, e) == A)) { sp_Push(theGraph->theStack, e); } - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); @@ -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; @@ -1265,16 +1266,17 @@ int _K4_DeleteUnmarkedEdgesInPathComponent(graphP theGraph, int R, int prevLink, /**************************************************************************** _K4_ReducePathToEdge() - Returns an arc of the edge created on success, a non-arc (NOTOK) on failure - On success, the arc is in the adjacency list of R. The result can be tested - for success or failure using comparison with NIL (non-NIL being success) + Returns an edge record of the edge created on success, or NIL on failure + + On success, the edge record returned is in the adjacency list of R. The result + can be tested for success or failure using gp_IsEdge() or gp_IsNotEdge() ****************************************************************************/ int _K4_ReducePathToEdge(graphP theGraph, K4SearchContext *context, int edgeType, int R, int e_R, int A, int e_A) { // Find out the links used in vertex R for edge e_R and in vertex A for edge e_A - int Rlink = gp_GetFirstArc(theGraph, R) == e_R ? 0 : 1; - int Alink = gp_GetFirstArc(theGraph, A) == e_A ? 0 : 1; + int Rlink = gp_GetFirstEdge(theGraph, R) == e_R ? 0 : 1; + int Alink = gp_GetFirstEdge(theGraph, A) == e_A ? 0 : 1; // If the path is more than a single edge, then it must be reduced to an edge. // Note that even if the path is a single edge, the external face data structure @@ -1286,19 +1288,29 @@ 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; + { +#ifdef DEBUG + NOTOK; +#endif + return NIL; + } - e_R = gp_GetArc(theGraph, R, Rlink); + e_R = gp_GetEdgeByLink(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; - e_A = gp_GetArc(theGraph, A, Alink); + { +#ifdef DEBUG + NOTOK; +#endif + return NIL; + } + e_A = gp_GetEdgeByLink(theGraph, A, Alink); } // Save the vertex neighbors of R and A indicated by e_R and e_A for @@ -1307,26 +1319,27 @@ 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, - // so 1^Rlink is the link that indicated e_R in the other arc that was adjacent to e_R. - // We want gp_InsertEdge to place the new arc where e_R was in R's adjacency list - gp_InsertEdge(theGraph, R, gp_GetArc(theGraph, R, Rlink), 1 ^ Rlink, - A, gp_GetArc(theGraph, A, Alink), 1 ^ Alink); + // so 1^Rlink is the link that indicated e_R in the other edge record that was + // adjacent to e_R. We want gp_InsertEdge to place the new edge record where e_R was + // in R's adjacency list + gp_InsertEdge(theGraph, R, gp_GetEdgeByLink(theGraph, R, Rlink), 1 ^ Rlink, + A, gp_GetEdgeByLink(theGraph, A, Alink), 1 ^ Alink); // Now set up the path connectors so the original path can be recovered if needed. - e_R = gp_GetArc(theGraph, R, Rlink); + e_R = gp_GetEdgeByLink(theGraph, R, Rlink); context->E[e_R].pathConnector = v_R; - e_A = gp_GetArc(theGraph, A, Alink); + e_A = gp_GetEdgeByLink(theGraph, A, Alink); context->E[e_A].pathConnector = v_A; // Also, set the reduction edge's type to preserve the DFS tree structure - gp_SetEdgeType(theGraph, e_R, _ComputeArcType(theGraph, R, A, edgeType)); - gp_SetEdgeType(theGraph, e_A, _ComputeArcType(theGraph, A, R, edgeType)); + gp_SetEdgeType(theGraph, e_R, _ComputeEdgeRecordType(theGraph, R, A, edgeType)); + gp_SetEdgeType(theGraph, e_A, _ComputeEdgeRecordType(theGraph, A, R, edgeType)); } // Set the external face data structure @@ -1335,7 +1348,7 @@ int _K4_ReducePathToEdge(graphP theGraph, K4SearchContext *context, int edgeType // If the edge represents an entire bicomp, then more external face // settings are needed. - if (gp_GetFirstArc(theGraph, R) == gp_GetLastArc(theGraph, R)) + if (gp_GetFirstEdge(theGraph, R) == gp_GetLastEdge(theGraph, R)) { gp_SetExtFaceVertex(theGraph, R, 1 ^ Rlink, A); gp_SetExtFaceVertex(theGraph, A, 1 ^ Alink, R); @@ -1365,10 +1378,10 @@ 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); + eTwin = gp_GetTwin(theGraph, e); u = gp_GetNeighbor(theGraph, eTwin); v = context->E[e].pathConnector; @@ -1377,19 +1390,19 @@ int _K4_RestoreReducedPath(graphP theGraph, K4SearchContext *context, int e) // Get the locations of the EdgeRecs between which the new EdgeRecs // must be added in order to reconnect the path parallel to the edge. - e0 = gp_GetNextArc(theGraph, e); - e1 = gp_GetPrevArc(theGraph, e); - eTwin0 = gp_GetNextArc(theGraph, eTwin); - eTwin1 = gp_GetPrevArc(theGraph, eTwin); + e0 = gp_GetNextEdge(theGraph, e); + e1 = gp_GetPrevEdge(theGraph, e); + eTwin0 = gp_GetNextEdge(theGraph, eTwin); + eTwin1 = gp_GetPrevEdge(theGraph, eTwin); // 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); + // restoring the path to ensure we do not exceed the maximum edge capacity. + _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_IsEdge(theGraph, e0)) { if (gp_InsertEdge(theGraph, u, e0, 1, v, NIL, 0) != OK) return NOTOK; @@ -1400,7 +1413,7 @@ int _K4_RestoreReducedPath(graphP theGraph, K4SearchContext *context, int e) return NOTOK; } - if (gp_IsArc(eTwin0)) + if (gp_IsEdge(theGraph, eTwin0)) { if (gp_InsertEdge(theGraph, x, eTwin0, 1, w, NIL, 0) != OK) return NOTOK; @@ -1442,14 +1455,14 @@ int _K4_RestoreAndOrientReducedPaths(graphP theGraph, K4SearchContext *context) { int EsizeOccupied, e, eTwin, u, v, w, x, visited; - EsizeOccupied = gp_EdgeInUseIndexBound(theGraph); - for (e = gp_GetFirstEdge(theGraph); e < EsizeOccupied;) + EsizeOccupied = gp_EdgeInUseArraySize(theGraph); + for (e = gp_EdgeArrayStart(theGraph); e < EsizeOccupied;) { - if (gp_IsVertex(context->E[e].pathConnector)) + if (gp_IsAnyTypeVertex(theGraph, context->E[e].pathConnector)) { visited = gp_GetEdgeVisited(theGraph, e); - eTwin = gp_GetTwinArc(theGraph, e); + eTwin = gp_GetTwin(theGraph, e); u = gp_GetNeighbor(theGraph, eTwin); v = context->E[e].pathConnector; w = context->E[eTwin].pathConnector; @@ -1459,13 +1472,13 @@ int _K4_RestoreAndOrientReducedPaths(graphP theGraph, K4SearchContext *context) return NOTOK; // If the path is on the external face, orient it - if (gp_GetNeighbor(theGraph, gp_GetFirstArc(theGraph, u)) == v || - gp_GetNeighbor(theGraph, gp_GetLastArc(theGraph, u)) == v) + if (gp_GetNeighbor(theGraph, gp_GetFirstEdge(theGraph, u)) == v || + gp_GetNeighbor(theGraph, gp_GetLastEdge(theGraph, u)) == v) { // Reality check: ensure the path is connected to the // external face at both vertices. - if (gp_GetNeighbor(theGraph, gp_GetFirstArc(theGraph, x)) != w && - gp_GetNeighbor(theGraph, gp_GetLastArc(theGraph, x)) != w) + if (gp_GetNeighbor(theGraph, gp_GetFirstEdge(theGraph, x)) != w && + gp_GetNeighbor(theGraph, gp_GetLastEdge(theGraph, x)) != w) return NOTOK; if (_OrientExternalFacePath(theGraph, u, v, w, x) != OK) @@ -1474,12 +1487,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..ddc4427 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. */ @@ -16,8 +16,8 @@ extern "C" #define K4SEARCH_NAME "K4Search" - int gp_AttachK4Search(graphP theGraph); - int gp_DetachK4Search(graphP theGraph); + int gp_ExtendWith_K4Search(graphP theGraph); + int gp_Detach_K4Search(graphP theGraph); #ifdef __cplusplus } diff --git a/planarity/c/graphLib/homeomorphSearch/graphK4Search.private.h b/planarity/c/graphLib/homeomorphSearch/graphK4Search.private.h index 73c1de8..9f170bb 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. */ @@ -17,7 +17,7 @@ extern "C" /* Additional equipment for each EdgeRec pathConnector: - Used in the edge records (arcs) of a reduction edge to indicate the + Used in the edge records of a reduction edge to indicate the endpoints of a path that has been reduced from (removed from) the embedding so that the search for a K4 can continue. We only need a pathConnector because we reduce subgraphs that are @@ -54,6 +54,8 @@ extern "C" } K4SearchContext; + extern int K4SEARCH_ID; + #ifdef __cplusplus } #endif diff --git a/planarity/c/graphLib/homeomorphSearch/graphK4Search_Extensions.c b/planarity/c/graphLib/homeomorphSearch/graphK4Search_Extensions.c index 4f10a1a..a89584b 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. */ @@ -35,7 +35,7 @@ int _K4Search_CheckObstructionIntegrity(graphP theGraph, graphP origGraph); int _K4Search_InitGraph(graphP theGraph, int N); void _K4Search_ReinitializeGraph(graphP theGraph); -int _K4Search_EnsureArcCapacity(graphP theGraph, int requiredArcCapacity); +int _K4Search_EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity); /* Forward declarations of functions used by the extension system */ @@ -51,13 +51,13 @@ void _K4Search_FreeContext(void *); int K4SEARCH_ID = 0; /**************************************************************************** - gp_AttachK4Search() + gp_ExtendWith_K4Search() This function adjusts the graph data structure to attach the K4 search feature. ****************************************************************************/ -int gp_AttachK4Search(graphP theGraph) +int gp_ExtendWith_K4Search(graphP theGraph) { K4SearchContext *context = NULL; @@ -93,7 +93,7 @@ int gp_AttachK4Search(graphP theGraph) context->functions.fpInitGraph = _K4Search_InitGraph; context->functions.fpReinitializeGraph = _K4Search_ReinitializeGraph; - context->functions.fpEnsureArcCapacity = _K4Search_EnsureArcCapacity; + context->functions.fpEnsureEdgeCapacity = _K4Search_EnsureEdgeCapacity; _K4Search_ClearStructures(context); @@ -104,6 +104,8 @@ int gp_AttachK4Search(graphP theGraph) &context->functions) != OK) { _K4Search_FreeContext(context); + context = NULL; + return NOTOK; } @@ -113,12 +115,14 @@ int gp_AttachK4Search(graphP theGraph) // also happens before gp_InitGraph(), which means N==0. // However, sometimes a feature is attached after gp_InitGraph(), in // which case N > 0 - if (theGraph->N > 0) + if (gp_GetN(theGraph) > 0) { if (_K4Search_CreateStructures(context) != OK || _K4Search_InitStructures(context) != OK) { _K4Search_FreeContext(context); + context = NULL; + return NOTOK; } } @@ -127,10 +131,10 @@ int gp_AttachK4Search(graphP theGraph) } /******************************************************************** - gp_DetachK4Search() + gp_Detach_K4Search() ********************************************************************/ -int gp_DetachK4Search(graphP theGraph) +int gp_Detach_K4Search(graphP theGraph) { return gp_RemoveExtension(theGraph, K4SEARCH_ID); } @@ -169,9 +173,9 @@ 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) + if (gp_GetN(context->theGraph) <= 0) return NOTOK; if ((context->E = (K4Search_EdgeRecP)malloc(Esize * sizeof(K4Search_EdgeRec))) == NULL || @@ -188,13 +192,13 @@ 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); - // for (e = gp_GetFirstEdge(context->theGraph); e < Esize; e++) + // Esize = gp_EdgeArraySize(context->theGraph); + // for (e = gp_EdgeArrayStart(context->theGraph); e < Esize; e++) // _K4Search_InitEdgeRec(context, e); return OK; @@ -213,8 +217,8 @@ int _K4Search_InitGraph(graphP theGraph, int N) theGraph->N = N; theGraph->NV = N; - if (theGraph->arcCapacity == 0) - theGraph->arcCapacity = 2 * DEFAULT_EDGE_LIMIT * N; + if (theGraph->edgeCapacity == 0) + theGraph->edgeCapacity = DEFAULT_EDGE_LIMIT * N; if (_K4Search_CreateStructures(context) != OK || _K4Search_InitStructures(context) != OK) @@ -244,15 +248,16 @@ void _K4Search_ReinitializeGraph(graphP theGraph) } /******************************************************************** - The current implementation does not support an increase of arc - (edge record) capacity once the extension is attached to the graph - data structure. This is only due to not being necessary to support. + The current implementation does not support an increase of edge + capacity once the extension is attached to the graph data structure. + This is only due to not being necessary to support. + For now, it is easy to ensure the correct capacity before attaching the extension, but support could be added later if there is some reason to do so. ********************************************************************/ -int _K4Search_EnsureArcCapacity(graphP theGraph, int requiredArcCapacity) +int _K4Search_EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity) { return NOTOK; } @@ -268,7 +273,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 +286,8 @@ void *_K4Search_DupContext(void *pContext, void *theGraph) if (_K4Search_CreateStructures(newContext) != OK) { _K4Search_FreeContext(newContext); + newContext = NULL; + return NULL; } @@ -328,7 +335,7 @@ int _K4Search_HandleBlockedBicomp(graphP theGraph, int v, int RootVertex, int R) if (context == NULL) return NOTOK; - if (theGraph->embedFlags == EMBEDFLAGS_SEARCHFORK4) + if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK4) { int RetVal = OK; @@ -355,8 +362,8 @@ int _K4Search_HandleBlockedBicomp(graphP theGraph, int v, int RootVertex, int R) // then we search for a K4 homeomorph, and if OK is returned, then that indicates // the blockage has been cleared and it is OK to Walkdown the bicomp. // But the Walkdown finished, already, so we launch it again. - // If the Walkdown returns OK then all forward arcs were embedded. If NONEMBEDDABLE - // is returned, then the bicomp got blocked again, so we have to reiterate the K4 search + // If the Walkdown returns OK then all forward edge records of "back" edges were embedded. + // If NONEMBEDDABLE is returned, then the bicomp got blocked again, so we have to reiterate the K4 search else { // If Walkdown has recursively called this handler on the bicomp rooted by RootVertex, @@ -412,18 +419,18 @@ int _K4Search_EmbedPostprocess(graphP theGraph, int v, int edgeEmbeddingResult) // For K4 search, we just return the edge embedding result because the // search result has been obtained already. - if (theGraph->embedFlags == EMBEDFLAGS_SEARCHFORK4) + if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK4) { if (edgeEmbeddingResult == OK) { // When a graph does not contain a K4 homeomorph, the embedding // is meaningless, so we empty it out. We preserve the embedFlags // to ensure post-processing continues as expected. - savedEmbedFlags = theGraph->embedFlags; - savedZEROBASEDIO = theGraph->internalFlags & FLAGS_ZEROBASEDIO; + savedEmbedFlags = gp_GetEmbedFlags(theGraph); + savedZEROBASEDIO = gp_GetGraphFlags(theGraph) & FLAGS_ZEROBASEDIO; gp_ReinitializeGraph(theGraph); theGraph->embedFlags = savedEmbedFlags; - theGraph->internalFlags &= savedZEROBASEDIO; + theGraph->graphFlags &= savedZEROBASEDIO; } return edgeEmbeddingResult; @@ -449,7 +456,7 @@ int _K4Search_EmbedPostprocess(graphP theGraph, int v, int edgeEmbeddingResult) int _K4Search_CheckEmbeddingIntegrity(graphP theGraph, graphP origGraph) { - if (theGraph->embedFlags == EMBEDFLAGS_SEARCHFORK4) + if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK4) { return OK; } @@ -476,7 +483,7 @@ int _K4Search_CheckObstructionIntegrity(graphP theGraph, graphP origGraph) { // When searching for K4, we ensure that theGraph is a subgraph of // the original graph and that it contains a K4 homeomorph - if (theGraph->embedFlags == EMBEDFLAGS_SEARCHFORK4) + if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK4) { int degrees[4], imageVerts[4]; 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..5fd6bf4 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,278 +8,428 @@ 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 *pInputContainer); + +/* Private functions */ +int _g6_InitReaderWithStrOrFile(G6ReadIteratorP theG6ReadIterator, strOrFileP *pInputContainer); +int _g6_InitReader(G6ReadIteratorP theG6ReadIterator); +bool _g6_IsReaderInitialized(G6ReadIteratorP theG6ReadIterator, bool reportUninitializedParts); +int _g6_ValidateHeader(strOrFileP inputContainer); +int _g6_ValidateFirstChar(char c, const int lineNum); +int _g6_DetermineOrderFromInput(strOrFileP inputContainer, 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 *pG6ReadIterator, graphP theGraph) { int exitCode = OK; - if (ppG6ReadIterator != NULL && (*ppG6ReadIterator) != NULL) + if (pG6ReadIterator == NULL) { - ErrorMessage("G6ReadIterator is not NULL and therefore can't be allocated.\n"); + ErrorMessage( + "Unable to allocate G6ReadIterator, as pointer to which to assign " + "address of memory allocated for G6ReadIterator is NULL.\n"); return NOTOK; } - // numGraphsRead, graphOrder, numCharsForGraphOrder, + if (pG6ReadIterator != NULL && (*pG6ReadIterator) != NULL) + { + ErrorMessage( + "G6ReadIterator is not NULL and therefore can't be allocated.\n"); + return NOTOK; + } + + // numGraphsRead, order, numCharsForOrder, // numCharsForGraphEncoding, and currGraphBuffSize all set to 0 - (*ppG6ReadIterator) = (G6ReadIteratorP)calloc(1, sizeof(G6ReadIterator)); + (*pG6ReadIterator) = (G6ReadIteratorP)calloc(1, sizeof(G6ReadIterator)); - if ((*ppG6ReadIterator) == NULL) + if ((*pG6ReadIterator) == NULL) { ErrorMessage("Unable to allocate memory for G6ReadIterator.\n"); return NOTOK; } - (*ppG6ReadIterator)->g6Input = NULL; + (*pG6ReadIterator)->inputContainer = 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(pG6ReadIterator); } else { - (*ppG6ReadIterator)->currGraph = pGraph; + (*pG6ReadIterator)->currGraph = theGraph; } return exitCode; } -bool _isG6ReadIteratorAllocated(G6ReadIteratorP pG6ReadIterator) +bool _g6_IsReaderInitialized(G6ReadIteratorP theG6ReadIterator, bool reportUninitializedParts) { - bool g6ReadIteratorIsAllocated = true; + bool readerInitialized = true; - if (pG6ReadIterator == NULL) + if (theG6ReadIterator == 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(theG6ReadIterator->inputContainer)) { - ErrorMessage("G6ReadIterator's g6Input string-or-file container " - "is not valid.\n"); - g6ReadIteratorIsAllocated = false; + if (reportUninitializedParts) + ErrorMessage("G6ReadIterator's inputContainer string-or-file container " + "is not valid.\n"); + readerInitialized = false; } - if (pG6ReadIterator->currGraphBuff == NULL) + if (theG6ReadIterator->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) + if (theG6ReadIterator->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 theG6ReadIterator) { - if (pG6ReadIterator == NULL || - pG6ReadIterator->currGraph == NULL || - pG6ReadIterator->contentsExhausted) - { + if (theG6ReadIterator == NULL) return true; - } - return false; + + return theG6ReadIterator->endReached; } -int getNumGraphsRead(G6ReadIteratorP pG6ReadIterator, int *pNumGraphsRead) +int g6_GetNumGraphsRead(G6ReadIteratorP theG6ReadIterator, int *pNumGraphsRead) { - if (_isG6ReadIteratorAllocated(pG6ReadIterator) == false) + if (theG6ReadIterator == NULL) + { + ErrorMessage("Invalid parameter: theG6ReadIterator must be non-NULL.\n"); + return NOTOK; + } + + if (pNumGraphsRead == NULL) + { + ErrorMessage( + "Unable to get numGraphsRead from G6ReadIterator, as output " + "parameter pNumGraphsRead is NULL.\n"); + return NOTOK; + } + + if (!_g6_IsReaderInitialized(theG6ReadIterator, true)) { ErrorMessage("Unable to get numGraphsRead, as G6ReadIterator is not " - "allocated.\n"); + "initialized.\n"); + (*pNumGraphsRead) = 0; + return NOTOK; } - (*pNumGraphsRead) = pG6ReadIterator->numGraphsRead; + (*pNumGraphsRead) = theG6ReadIterator->numGraphsRead; return OK; } -int getOrderOfGraphToRead(G6ReadIteratorP pG6ReadIterator, int *pGraphOrder) +int g6_GetOrderFromReader(G6ReadIteratorP theG6ReadIterator, int *pOrder) { - if (pG6ReadIterator == NULL) + if (theG6ReadIterator == NULL) { - ErrorMessage("G6ReadIterator is not allocated.\n"); + ErrorMessage("Invalid parameter: theG6ReadIterator must be non-NULL.\n"); return NOTOK; } - (*pGraphOrder) = pG6ReadIterator->graphOrder; + if (pOrder == NULL) + { + ErrorMessage( + "Unable to get order from G6ReadIterator, as output parameter " + "pOrder is NULL.\n"); + return NOTOK; + } + + if (!_g6_IsReaderInitialized(theG6ReadIterator, true)) + { + ErrorMessage("Unable to get order, as G6ReadIterator is not " + "initialized.\n"); + + (*pOrder) = 0; + + return NOTOK; + } + + (*pOrder) = theG6ReadIterator->order; return OK; } -int getPointerToGraphReadIn(G6ReadIteratorP pG6ReadIterator, graphP *ppGraph) +int g6_GetGraphFromReader(G6ReadIteratorP theG6ReadIterator, graphP *pGraph) { - if (pG6ReadIterator == NULL) + if (theG6ReadIterator == NULL) + { + ErrorMessage("Invalid parameter: theG6ReadIterator must be non-NULL.\n"); + return NOTOK; + } + + if (pGraph == NULL) { - ErrorMessage("G6ReadIterator is not allocated.\n"); + ErrorMessage( + "Unable to get graph from G6ReadIterator, as output parameter " + "pGraph is NULL.\n"); return NOTOK; } - (*ppGraph) = pG6ReadIterator->currGraph; + if (!_g6_IsReaderInitialized(theG6ReadIterator, true)) + { + ErrorMessage( + "Unable to get graph from reader, as G6ReadIterator is not " + "initialized.\n"); + + (*pGraph) = NULL; + + return NOTOK; + } + + (*pGraph) = theG6ReadIterator->currGraph; return OK; } -int beginG6ReadIterationFromG6String(G6ReadIteratorP pG6ReadIterator, char *inputString) +int g6_InitReaderWithString(G6ReadIteratorP theG6ReadIterator, char *inputString) { - return beginG6ReadIterationFromG6StrOrFile( - pG6ReadIterator, - sf_New(inputString, NULL, READTEXT)); + strOrFileP inputContainer = NULL; + + if (theG6ReadIterator == NULL) + { + ErrorMessage("Invalid parameter: theG6ReadIterator must be non-NULL.\n"); + return NOTOK; + } + + if (_g6_IsReaderInitialized(theG6ReadIterator, 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; + } + + if ((inputContainer = sf_NewInputContainer(inputString, NULL)) == NULL) + { + ErrorMessage( + "Unable to initialize reader with string, as we failed to allocate " + "the inputContainer.\n"); + return NOTOK; + } + + return _g6_InitReaderWithStrOrFile( + theG6ReadIterator, + (&inputContainer)); } -int beginG6ReadIterationFromG6FilePath(G6ReadIteratorP pG6ReadIterator, char *infileName) +int g6_InitReaderWithFileName(G6ReadIteratorP theG6ReadIterator, char const *const infileName) { - return beginG6ReadIterationFromG6StrOrFile( - pG6ReadIterator, - sf_New(NULL, infileName, READTEXT)); + strOrFileP inputContainer = NULL; + + if (theG6ReadIterator == NULL) + { + ErrorMessage("Invalid parameter: theG6ReadIterator must be non-NULL.\n"); + return NOTOK; + } + + if (_g6_IsReaderInitialized(theG6ReadIterator, 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; + } + + if ((inputContainer = sf_NewInputContainer(NULL, infileName)) == NULL) + { + ErrorMessage( + "Unable to initialize reader with filename, as we failed to " + "allocate the inputContainer.\n"); + return NOTOK; + } + + return _g6_InitReaderWithStrOrFile( + theG6ReadIterator, + (&inputContainer)); } -int beginG6ReadIterationFromG6StrOrFile(G6ReadIteratorP pG6ReadIterator, strOrFileP g6InputContainer) +int _g6_InitReaderWithStrOrFile(G6ReadIteratorP theG6ReadIterator, strOrFileP *pInputContainer) { - if ( - sf_ValidateStrOrFile(g6InputContainer) != OK || - (g6InputContainer->theStr != NULL && sb_GetSize(g6InputContainer->theStr) == 0)) + if (theG6ReadIterator == NULL) { - ErrorMessage("Invalid g6InputContainer; must contain either valid input stream or non-empty string.\n"); + ErrorMessage("Invalid parameter: theG6ReadIterator must be non-NULL.\n"); return NOTOK; } - pG6ReadIterator->g6Input = g6InputContainer; + if (pInputContainer == NULL || !sf_IsValidStrOrFile((*pInputContainer))) + { + ErrorMessage("Unable to initialize reader with invalid strOrFile " + "input container.\n"); + return NOTOK; + } - return _beginG6ReadIteration(pG6ReadIterator); + theG6ReadIterator->inputContainer = (*pInputContainer); + // We have taken ownership of the inputContainer, and so we have set the + // caller's pointer to NULL. The reader is responsible for freeing this + // input container. + (*pInputContainer) = NULL; + + return _g6_InitReader(theG6ReadIterator); } -int _beginG6ReadIteration(G6ReadIteratorP pG6ReadIterator) +int _g6_InitReader(G6ReadIteratorP theG6ReadIterator) { - int exitCode = OK; char charConfirmation = EOF; int firstChar = '\0'; int lineNum = 1; - int graphOrder = -1; - strOrFileP g6Input = pG6ReadIterator->g6Input; + int order = NIL; + strOrFileP inputContainer = theG6ReadIterator->inputContainer; char messageContents[MAXLINE + 1]; messageContents[0] = '\0'; - if ((firstChar = sf_getc(g6Input)) == EOF) + if ((firstChar = sf_getc(inputContainer)) == EOF) { - ErrorMessage(".g6 infile is empty.\n"); + ErrorMessage("Unable to initialize reader: .g6 infile is empty.\n"); return NOTOK; } else { - charConfirmation = sf_ungetc((char)firstChar, g6Input); + charConfirmation = sf_ungetc((char)firstChar, inputContainer); 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(inputContainer) != 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; } } } - firstChar = sf_getc(g6Input); - charConfirmation = sf_ungetc((char)firstChar, g6Input); + firstChar = sf_getc(inputContainer); + charConfirmation = sf_ungetc((char)firstChar, inputContainer); 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(inputContainer, &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(theG6ReadIterator->currGraph) == 0) { - exitCode = gp_InitGraph(pG6ReadIterator->currGraph, graphOrder); - - if (exitCode != OK) + if (gp_InitGraph(theG6ReadIterator->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; + theG6ReadIterator->order = order; } else { - if (gp_getN(pG6ReadIterator->currGraph) != graphOrder) + if (gp_GetN(theG6ReadIterator->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(theG6ReadIterator->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; + gp_ReinitializeGraph(theG6ReadIterator->currGraph); + theG6ReadIterator->order = order; } } // Ensures zero-based flag is set regardless of whether the graph was initialized or reinitialized. - pG6ReadIterator->currGraph->internalFlags |= FLAGS_ZEROBASEDIO; + theG6ReadIterator->currGraph->graphFlags |= FLAGS_ZEROBASEDIO; - pG6ReadIterator->numCharsForGraphOrder = _getNumCharsForGraphOrder(graphOrder); - pG6ReadIterator->numCharsForGraphEncoding = _getNumCharsForGraphEncoding(graphOrder); + theG6ReadIterator->numCharsForOrder = _g6_GetNumCharsForOrder(order); + theG6ReadIterator->numCharsForGraphEncoding = _g6_GetNumCharsForEncoding(order); // Must add 3 bytes for newline, possible carriage return, and null terminator - pG6ReadIterator->currGraphBuffSize = pG6ReadIterator->numCharsForGraphOrder + pG6ReadIterator->numCharsForGraphEncoding + 3; - pG6ReadIterator->currGraphBuff = (char *)calloc(pG6ReadIterator->currGraphBuffSize, sizeof(char)); + theG6ReadIterator->currGraphBuffSize = theG6ReadIterator->numCharsForOrder + theG6ReadIterator->numCharsForGraphEncoding + 3; + theG6ReadIterator->currGraphBuff = (char *)calloc(theG6ReadIterator->currGraphBuffSize, sizeof(char)); - if (pG6ReadIterator->currGraphBuff == NULL) + if (theG6ReadIterator->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 inputContainer) { - 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'; - if (g6Input == NULL) + if (inputContainer == NULL) { ErrorMessage("Invalid .g6 string-or-file container.\n"); return NOTOK; @@ -287,12 +437,12 @@ int _processAndCheckHeader(strOrFileP g6Input) for (int i = 0; i < 10; i++) { - headerCandidateChars[i] = sf_getc(g6Input); + headerCandidateChars[i] = sf_getc(inputContainer); } 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,35 +451,32 @@ 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 inputContainer, int *order) { - int exitCode = OK; int n = 0; int graphChar = '\0'; - if (g6Input == NULL) + if (inputContainer == NULL) { ErrorMessage("Invalid string-or-file container for .g6 input.\n"); return NOTOK; @@ -338,19 +485,21 @@ int _getGraphOrder(strOrFileP g6Input, int *graphOrder) // Since geng: n must be in the range 1..32, and since edge-addition-planarity-suite // processing of random graphs may only handle up to n = 100,000, we will only check // if 1 or 4 bytes are necessary - if ((graphChar = sf_getc(g6Input)) == 126) + if ((graphChar = sf_getc(inputContainer)) == 126) { - if ((graphChar = sf_getc(g6Input)) == 126) + if ((graphChar = sf_getc(inputContainer)) == 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; } - sf_ungetc((char)graphChar, g6Input); + sf_ungetc((char)graphChar, inputContainer); for (int i = 2; i >= 0; i--) { - graphChar = sf_getc(g6Input) - 63; + graphChar = sf_getc(inputContainer) - 63; n |= graphChar << (6 * i); } @@ -364,59 +513,48 @@ 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 theG6ReadIterator) { - int exitCode = OK; - strOrFileP g6Input = NULL; + strOrFileP inputContainer = 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 numCharsForGraphEncoding = pG6ReadIterator == NULL ? 0 : pG6ReadIterator->numCharsForGraphEncoding; - const int currGraphBuffSize = pG6ReadIterator == NULL ? 0 : pG6ReadIterator->currGraphBuffSize; + const int order = theG6ReadIterator == NULL ? 0 : theG6ReadIterator->order; + const int numCharsForOrder = theG6ReadIterator == NULL ? 0 : theG6ReadIterator->numCharsForOrder; + const int numCharsForGraphEncoding = theG6ReadIterator == NULL ? 0 : theG6ReadIterator->numCharsForGraphEncoding; + const int currGraphBuffSize = theG6ReadIterator == NULL ? 0 : theG6ReadIterator->currGraphBuffSize; char messageContents[MAXLINE + 1]; messageContents[0] = '\0'; - if (!_isG6ReadIteratorAllocated(pG6ReadIterator)) + if (!_g6_IsReaderInitialized(theG6ReadIterator, true)) { - ErrorMessage("G6ReadIterator is not allocated.\n"); + ErrorMessage("G6ReadIterator is not initialized.\n"); return NOTOK; } - if ((g6Input = pG6ReadIterator->g6Input) == NULL) - { - ErrorMessage("Pointer to .g6 string-or-file container is NULL.\n"); - return NOTOK; - } - - numGraphsRead = pG6ReadIterator->numGraphsRead; + inputContainer = theG6ReadIterator->inputContainer; + numGraphsRead = theG6ReadIterator->numGraphsRead; + currGraphBuff = theG6ReadIterator->currGraphBuff; + currGraph = theG6ReadIterator->currGraph; - if ((currGraphBuff = pG6ReadIterator->currGraphBuff) == NULL) - { - ErrorMessage("currGraphBuff string is null.\n"); - return NOTOK; - } - - currGraph = pG6ReadIterator->currGraph; - - if (sf_fgets(currGraphBuff, currGraphBuffSize, g6Input) != NULL) + if (sf_fgets(currGraphBuff, currGraphBuffSize, inputContainer) != NULL) { 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 +564,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 +573,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,166 +585,59 @@ 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) { gp_ReinitializeGraph(currGraph); // Ensures zero-based flag is set after reinitializing graph. - currGraph->internalFlags |= FLAGS_ZEROBASEDIO; + currGraph->graphFlags |= 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; - } - - pG6ReadIterator->numGraphsRead = numGraphsRead; - } - else - { - pG6ReadIterator->currGraph = NULL; - pG6ReadIterator->contentsExhausted = 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; + theG6ReadIterator->numGraphsRead = numGraphsRead; } - - // 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) + else { - char messageContents[MAXLINE + 1]; - messageContents[0] = '\0'; - sprintf(messageContents, "Expected %d padding zeroes, but got %d.\n", expectedNumPaddingZeroes, numPaddingZeroes); - ErrorMessage(messageContents); - exitCode = NOTOK; + theG6ReadIterator->currGraph = NULL; + theG6ReadIterator->endReached = true; } - 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,72 +662,57 @@ 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 *pG6ReadIterator) { - int exitCode = OK; - - if (ppG6ReadIterator != NULL && (*ppG6ReadIterator) != NULL) + if (pG6ReadIterator != NULL && (*pG6ReadIterator) != NULL) { - if ((*ppG6ReadIterator)->g6Input != NULL) - sf_Free(&((*ppG6ReadIterator)->g6Input)); + if ((*pG6ReadIterator)->inputContainer != NULL) + sf_Free(&((*pG6ReadIterator)->inputContainer)); - (*ppG6ReadIterator)->numGraphsRead = 0; - (*ppG6ReadIterator)->graphOrder = 0; + (*pG6ReadIterator)->numGraphsRead = 0; + (*pG6ReadIterator)->order = 0; - if ((*ppG6ReadIterator)->currGraphBuff != NULL) + if ((*pG6ReadIterator)->currGraphBuff != NULL) { - free((*ppG6ReadIterator)->currGraphBuff); - (*ppG6ReadIterator)->currGraphBuff = NULL; + free((*pG6ReadIterator)->currGraphBuff); + (*pG6ReadIterator)->currGraphBuff = NULL; } - (*ppG6ReadIterator)->currGraph = NULL; + (*pG6ReadIterator)->currGraph = NULL; - free((*ppG6ReadIterator)); - (*ppG6ReadIterator) = NULL; + free((*pG6ReadIterator)); + (*pG6ReadIterator) = NULL; } - - return exitCode; } -int _ReadGraphFromG6FilePath(graphP pGraphToRead, char *pathToG6File) +int _g6_ReadGraphFromFile(graphP theGraph, char *pathToG6File) { char const *messageFormat = NULL; int charsAvailForStr = 0; - strOrFileP inputContainer = sf_New(NULL, pathToG6File, READTEXT); - if (inputContainer == NULL) + strOrFileP inputContainer = NULL; + + if (pathToG6File == NULL || strlen(pathToG6File) == 0) + { + ErrorMessage( + "Unable to read graph from file, as pathToG6File is NULL " + "or empty string.\n"); + return NOTOK; + } + + if ((inputContainer = sf_NewInputContainer(NULL, pathToG6File)) == NULL) { char messageContents[MAXLINE + 1]; messageContents[0] = '\0'; @@ -713,10 +727,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; @@ -726,58 +740,47 @@ int _ReadGraphFromG6String(graphP pGraphToRead, char *g6EncodedString) return NOTOK; } - if ((inputContainer = sf_New(g6EncodedString, NULL, READTEXT)) == NULL) + if ((inputContainer = sf_NewInputContainer(g6EncodedString, NULL)) == NULL) { - ErrorMessage("Unable to allocate strOrFile container for .g6 input string.\n"); + ErrorMessage( + "Unable to allocate strOrFile container for .g6 input string.\n"); return NOTOK; } - return _ReadGraphFromG6StrOrFile(pGraphToRead, inputContainer); + return _g6_ReadGraphFromStrOrFile(theGraph, (&inputContainer)); } -int _ReadGraphFromG6StrOrFile(graphP pGraphToRead, strOrFileP g6InputContainer) +int _g6_ReadGraphFromStrOrFile(graphP theGraph, strOrFileP *pInputContainer) { - int exitCode = OK; - - G6ReadIteratorP pG6ReadIterator = NULL; + G6ReadIteratorP theG6ReadIterator = NULL; - if (sf_ValidateStrOrFile(g6InputContainer) != OK) + if (!sf_IsValidStrOrFile((*pInputContainer))) { ErrorMessage("Invalid G6 output container.\n"); return NOTOK; } - if (allocateG6ReadIterator(&pG6ReadIterator, pGraphToRead) != OK) + if (g6_NewReader((&theG6ReadIterator), theGraph) != OK) { ErrorMessage("Unable to allocate G6ReadIterator.\n"); return NOTOK; } - if (beginG6ReadIterationFromG6StrOrFile(pG6ReadIterator, g6InputContainer) != OK) + // NOTE: (*pInputContainer) will be NULL after we return from this call, + // since the read iterator will take ownership of the input container. + if (_g6_InitReaderWithStrOrFile(theG6ReadIterator, pInputContainer) != 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((&theG6ReadIterator)); return NOTOK; } - exitCode = readGraphUsingG6ReadIterator(pG6ReadIterator); - if (exitCode != OK) + if (g6_ReadGraph(theG6ReadIterator) != OK) ErrorMessage("Unable to read graph from .g6 read iterator.\n"); - if (endG6ReadIteration(pG6ReadIterator) != OK) - { - ErrorMessage("Unable to end G6ReadIterator.\n"); - exitCode = NOTOK; - } + g6_FreeReader((&theG6ReadIterator)); - if (freeG6ReadIterator(&pG6ReadIterator) != OK) - { - ErrorMessage("Unable to free G6ReadIterator.\n"); - exitCode = NOTOK; - } - - 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..991cdf1 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. */ @@ -20,49 +20,34 @@ extern "C" typedef struct { - strOrFileP g6Input; + strOrFileP inputContainer; 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 *pG6ReadIterator, graphP theGraph); + bool g6_EndReached(G6ReadIteratorP theG6ReadIterator); - int getNumGraphsRead(G6ReadIteratorP, int *); - int getOrderOfGraphToRead(G6ReadIteratorP, int *); - int getPointerToGraphReadIn(G6ReadIteratorP, graphP *); + int g6_GetNumGraphsRead(G6ReadIteratorP theG6ReadIterator, int *pNumGraphsRead); + int g6_GetOrderFromReader(G6ReadIteratorP theG6ReadIterator, int *pOrder); + int g6_GetGraphFromReader(G6ReadIteratorP theG6ReadIterator, graphP *pGraph); - 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 theG6ReadIterator, char *inputString); + int g6_InitReaderWithFileName(G6ReadIteratorP theG6ReadIterator, 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 theG6ReadIterator); - int endG6ReadIteration(G6ReadIteratorP); - - int freeG6ReadIterator(G6ReadIteratorP *); - - int _ReadGraphFromG6FilePath(graphP, char *); - int _ReadGraphFromG6String(graphP, char *); - int _ReadGraphFromG6StrOrFile(graphP, strOrFileP); + void g6_FreeReader(G6ReadIteratorP *pG6ReadIterator); #ifdef __cplusplus } diff --git a/planarity/c/graphLib/io/g6-write-iterator.c b/planarity/c/graphLib/io/g6-write-iterator.c index 6aea9d8..42c9d5b 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,207 +8,377 @@ 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 *pOutputContainer); + +/* Private functions */ +int _g6_InitWriterWithStrOrFile(G6WriteIteratorP theG6WriteIterator, strOrFileP *pOutputContainer); +int _g6_InitWriter(G6WriteIteratorP theG6WriteIterator); +bool _g6_IsWriterInitialized(G6WriteIteratorP theG6WriteIterator, bool reportUninitializedParts); +void _g6_PrecomputeColumnOffsets(int *columnOffsets, int order); +void _g6_EncodeAdjMatAsG6(G6WriteIteratorP theG6WriteIterator); +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 theG6WriteIterator); + +int _g6_WriteGraphToFile(graphP theGraph, char *g6OutputFileName); +int _g6_WriteGraphToString(graphP theGraph, char **pOutputStr); + +int g6_NewWriter(G6WriteIteratorP *pG6WriteIterator, graphP theGraph) { - int exitCode = OK; + if (pG6WriteIterator == NULL) + { + ErrorMessage( + "Unable to allocate G6WriteIterator, as pointer to which to assign " + "address of memory allocated for G6WriteIterator is NULL.\n"); + return NOTOK; + } - if (ppG6WriteIterator != NULL && (*ppG6WriteIterator) != NULL) + if (pG6WriteIterator != NULL && (*pG6WriteIterator) != NULL) { ErrorMessage("G6WriteIterator is not NULL and therefore can't be allocated.\n"); return NOTOK; } - // numGraphsWritten, graphOrder, numCharsForGraphOrder, - // numCharsForGraphEncoding, and currGraphBuffSize all set to 0 - (*ppG6WriteIterator) = (G6WriteIteratorP)calloc(1, sizeof(G6WriteIterator)); - - if ((*ppG6WriteIterator) == NULL) + if (theGraph == NULL || gp_GetN(theGraph) <= 0) { - ErrorMessage("Unable to allocate memory for G6WriteIterator.\n"); + ErrorMessage("Must allocate and initialize graph with an order greater " + "than 0 to use the G6WriteIterator.\n"); + return NOTOK; } - (*ppG6WriteIterator)->g6Output = NULL; - (*ppG6WriteIterator)->currGraphBuff = NULL; - (*ppG6WriteIterator)->columnOffsets = NULL; + // numGraphsWritten, order, numCharsForOrder, + // numCharsForGraphEncoding, and currGraphBuffSize all set to 0 + (*pG6WriteIterator) = (G6WriteIteratorP)calloc(1, sizeof(G6WriteIterator)); - if (pGraph == NULL || gp_getN(pGraph) <= 0) + if ((*pG6WriteIterator) == NULL) { - 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"); + ErrorMessage("Unable to allocate memory for G6WriteIterator.\n"); + return NOTOK; } - else - (*ppG6WriteIterator)->currGraph = pGraph; - return exitCode; + (*pG6WriteIterator)->outputContainer = NULL; + (*pG6WriteIterator)->currGraphBuff = NULL; + (*pG6WriteIterator)->columnOffsets = NULL; + (*pG6WriteIterator)->currGraph = theGraph; + + return OK; } -bool _isG6WriteIteratorAllocated(G6WriteIteratorP pG6WriteIterator) +bool _g6_IsWriterInitialized(G6WriteIteratorP theG6WriteIterator, bool reportUninitializedParts) { - bool G6WriteIteratorIsAllocated = true; + bool writerIsInitialized = true; - if (pG6WriteIterator == NULL) + if (theG6WriteIterator == 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(theG6WriteIterator->outputContainer)) { - ErrorMessage("G6WriteIterator's g6Output is not valid.\n"); - G6WriteIteratorIsAllocated = false; + if (reportUninitializedParts) + ErrorMessage("G6WriteIterator's outputContainer is not valid.\n"); + writerIsInitialized = false; } - if (pG6WriteIterator->currGraphBuff == NULL) + if (theG6WriteIterator->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) + if (theG6WriteIterator->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) + if (theG6WriteIterator->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) + else { - ErrorMessage("G6WriteIterator's currGraph does not contain a valid " - "graph.\n"); - G6WriteIteratorIsAllocated = false; + if (gp_GetN(theG6WriteIterator->currGraph) == 0) + { + 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 theG6WriteIterator, int *pNumGraphsWritten) { - if (pG6WriteIterator == NULL) + if (theG6WriteIterator == NULL) + { + ErrorMessage("Invalid parameter: theG6WriteIterator must be non-NULL.\n"); + return NOTOK; + } + + if (pNumGraphsWritten == NULL) + { + ErrorMessage( + "Unable to get numGraphsWritten from G6WriteIterator, as output " + "parameter pNumGraphsWritten is NULL.\n"); + return NOTOK; + } + + if (!_g6_IsWriterInitialized(theG6WriteIterator, 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) = theG6WriteIterator->numGraphsWritten; return OK; } -int getOrderOfGraphToWrite(G6WriteIteratorP pG6WriteIterator, int *pGraphOrder) +int g6_GetOrderFromWriter(G6WriteIteratorP theG6WriteIterator, int *pOrder) { - if (pG6WriteIterator == NULL) + if (theG6WriteIterator == NULL) { - ErrorMessage("G6WriteIterator is not allocated.\n"); + ErrorMessage("Invalid parameter: theG6WriteIterator must be non-NULL.\n"); return NOTOK; } - (*pGraphOrder) = pG6WriteIterator->graphOrder; + if (pOrder == NULL) + { + ErrorMessage( + "Unable to get order from G6WriteIterator, as output parameter " + "pOrder is NULL.\n"); + return NOTOK; + } + + if (!_g6_IsWriterInitialized(theG6WriteIterator, true)) + { + ErrorMessage("Unable to get order, as G6WriteIterator is not " + "initialized.\n"); + + (*pOrder) = 0; + + return NOTOK; + } + + (*pOrder) = theG6WriteIterator->order; return OK; } -int getPointerToGraphToWrite(G6WriteIteratorP pG6WriteIterator, graphP *ppGraph) +int g6_GetGraphFromWriter(G6WriteIteratorP theG6WriteIterator, graphP *pGraph) { - if (pG6WriteIterator == NULL) + if (theG6WriteIterator == NULL) + { + ErrorMessage("Invalid parameter: theG6WriteIterator must be non-NULL.\n"); + return NOTOK; + } + + if (pGraph == NULL) { - ErrorMessage("[ERROR] G6WriteIterator is not allocated.\n"); + ErrorMessage( + "Unable to get graph from G6WriteIterator, as output parameter " + "pGraph is NULL.\n"); + return NOTOK; + } + + if (!_g6_IsWriterInitialized(theG6WriteIterator, true)) + { + ErrorMessage("Unable to get numGraphsWritten, as G6WriteIterator is " + "not initialized.\n"); + + (*pGraph) = NULL; + return NOTOK; } - (*ppGraph) = pG6WriteIterator->currGraph; + (*pGraph) = theG6WriteIterator->currGraph; return OK; } -int beginG6WriteIterationToG6String(G6WriteIteratorP pG6WriteIterator) +int g6_InitWriterWithString(G6WriteIteratorP theG6WriteIterator, char **pOutputString) { - return beginG6WriteIterationToG6StrOrFile( - pG6WriteIterator, - sf_New(NULL, NULL, WRITETEXT)); -} + strOrFileP outputContainer = NULL; -int beginG6WriteIterationToG6FilePath(G6WriteIteratorP pG6WriteIterator, char *outputFilename) -{ - return beginG6WriteIterationToG6StrOrFile( - pG6WriteIterator, - sf_New(NULL, outputFilename, WRITETEXT)); + if (theG6WriteIterator == NULL) + { + ErrorMessage("Invalid parameter: theG6WriteIterator must be non-NULL.\n"); + return NOTOK; + } + + if (_g6_IsWriterInitialized(theG6WriteIterator, false)) + { + ErrorMessage( + "Unable to initialize writer, as it was already previously " + "initialized.\n"); + return NOTOK; + } + + if (pOutputString == NULL) + { + ErrorMessage( + "Unable to initialize writer with string, as pointer to which to " + "assign address of output string is NULL.\n"); + return NOTOK; + } + + if ((*pOutputString) != NULL) + { + ErrorMessage( + "Unable to initialize writer with string, as pointer to which to " + "assign address of output string points to allocated memory.\n"); + return NOTOK; + } + + if ((outputContainer = sf_NewOutputContainer(pOutputString, NULL)) == NULL) + { + ErrorMessage( + "Unable to initialize writer with string, as we failed to allocate " + "the outputContainer.\n"); + return NOTOK; + } + + return _g6_InitWriterWithStrOrFile( + theG6WriteIterator, + (&outputContainer)); } -int beginG6WriteIterationToG6StrOrFile(G6WriteIteratorP pG6WriteIterator, strOrFileP outputContainer) +int g6_InitWriterWithFileName(G6WriteIteratorP theG6WriteIterator, char *outputFileName) { - int exitCode = OK; + strOrFileP outputContainer = NULL; - if (pG6WriteIterator == NULL) + if (theG6WriteIterator == NULL) { - ErrorMessage("Invalid parameter pG6WriteIterator.\n"); + ErrorMessage("Invalid parameter: theG6WriteIterator must be non-NULL.\n"); return NOTOK; } - if (sf_ValidateStrOrFile(outputContainer) != OK) + if (_g6_IsWriterInitialized(theG6WriteIterator, 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; - - exitCode = _beginG6WriteIteration(pG6WriteIterator); + if (outputFileName == NULL || strlen(outputFileName) == 0) + { + ErrorMessage( + "Unable to initialize writer with NULL or empty output file " + "name.\n"); + return NOTOK; + } - if (exitCode != OK) - ErrorMessage("Unable to begin .g6 write iteration to given strOrFile output container.\n"); + if ((outputContainer = sf_NewOutputContainer(NULL, outputFileName)) == NULL) + { + ErrorMessage( + "Unable to initialize writer with filename, as we failed to " + "allocate the outputContainer.\n"); + return NOTOK; + } - return exitCode; + return _g6_InitWriterWithStrOrFile( + theG6WriteIterator, + (&outputContainer)); } -int _beginG6WriteIteration(G6WriteIteratorP pG6WriteIterator) +int _g6_InitWriterWithStrOrFile(G6WriteIteratorP theG6WriteIterator, strOrFileP *pOutputContainer) { - int exitCode = OK; + if (theG6WriteIterator == NULL) + { + ErrorMessage("Invalid parameter: theG6WriteIterator must be non-NULL.\n"); + return NOTOK; + } + + if (_g6_IsWriterInitialized(theG6WriteIterator, false)) + { + ErrorMessage( + "Unable to initialize writer, as it was already previously " + "initialized.\n"); + return NOTOK; + } + if (!sf_IsValidStrOrFile((*pOutputContainer))) + { + ErrorMessage("Unable to initialize writer with invalid strOrFile " + "output container.\n"); + return NOTOK; + } + + theG6WriteIterator->outputContainer = (*pOutputContainer); + // We have taken ownership of the outputContainer, and so we have set the + // caller's pointer to NULL. The writer is responsible for freeing this + // output container. + (*pOutputContainer) = NULL; + + return _g6_InitWriter(theG6WriteIterator); +} + +int _g6_InitWriter(G6WriteIteratorP theG6WriteIterator) +{ char const *g6Header = ">>graph6<<"; - if (sf_fputs(g6Header, pG6WriteIterator->g6Output) < 0) + + if (sf_fputs(g6Header, theG6WriteIterator->outputContainer) < 0) { - ErrorMessage("Unable to fputs header to g6Output.\n"); + ErrorMessage( + "Unable to initialize writer due to failure to fputs header to " + "outputContainer.\n"); return NOTOK; } - pG6WriteIterator->graphOrder = gp_getN(pG6WriteIterator->currGraph); + theG6WriteIterator->order = gp_GetN(theG6WriteIterator->currGraph); - pG6WriteIterator->columnOffsets = (int *)calloc(pG6WriteIterator->graphOrder + 1, sizeof(int)); + theG6WriteIterator->columnOffsets = (int *)calloc(theG6WriteIterator->order + 1, sizeof(int)); - if (pG6WriteIterator->columnOffsets == NULL) + if (theG6WriteIterator->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(theG6WriteIterator->columnOffsets, theG6WriteIterator->order); - pG6WriteIterator->numCharsForGraphOrder = _getNumCharsForGraphOrder(pG6WriteIterator->graphOrder); - pG6WriteIterator->numCharsForGraphEncoding = _getNumCharsForGraphEncoding(pG6WriteIterator->graphOrder); + theG6WriteIterator->numCharsForOrder = _g6_GetNumCharsForOrder(theG6WriteIterator->order); + theG6WriteIterator->numCharsForGraphEncoding = _g6_GetNumCharsForEncoding(theG6WriteIterator->order); // Must add 3 bytes for newline, possible carriage return, and null terminator - pG6WriteIterator->currGraphBuffSize = pG6WriteIterator->numCharsForGraphOrder + pG6WriteIterator->numCharsForGraphEncoding + 3; - pG6WriteIterator->currGraphBuff = (char *)calloc(pG6WriteIterator->currGraphBuffSize, sizeof(char)); + theG6WriteIterator->currGraphBuffSize = theG6WriteIterator->numCharsForOrder + theG6WriteIterator->numCharsForGraphEncoding + 3; + + theG6WriteIterator->currGraphBuff = (char *)calloc(theG6WriteIterator->currGraphBuffSize, sizeof(char)); - if (pG6WriteIterator->currGraphBuff == NULL) + if (theG6WriteIterator->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 +388,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 theG6WriteIterator) { - int exitCode = OK; + char *graphEncodingChars = NULL; + if (!_g6_IsWriterInitialized(theG6WriteIterator, true)) + { + ErrorMessage("Unable to write graph because G6WriteIterator is not initialized.\n"); + return NOTOK; + } - exitCode = _encodeAdjMatAsG6(pG6WriteIterator); - if (exitCode != OK) + _g6_EncodeAdjMatAsG6(theG6WriteIterator); + + if (_g6_ValidateOrderOfEncodedGraph(theG6WriteIterator->currGraphBuff, theG6WriteIterator->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 = theG6WriteIterator->currGraphBuff + theG6WriteIterator->numCharsForOrder; + if (_g6_ValidateGraphEncoding(graphEncodingChars, theG6WriteIterator->order, theG6WriteIterator->numCharsForGraphEncoding) != OK) + { + ErrorMessage("Unable to write graph, as constructed encoding is invalid.\n"); + return NOTOK; + } - return exitCode; + if (_g6_WriteEncodedGraph(theG6WriteIterator) != OK) + { + ErrorMessage("Unable to write g6 encoded graph to output container.\n"); + return NOTOK; + } + + return OK; } -int _encodeAdjMatAsG6(G6WriteIteratorP pG6WriteIterator) +void _g6_EncodeAdjMatAsG6(G6WriteIteratorP theG6WriteIterator) { - 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 +440,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; + g6Encoding = theG6WriteIterator->currGraphBuff; + columnOffsets = theG6WriteIterator->columnOffsets; + theGraph = theG6WriteIterator->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)); + memset(theG6WriteIterator->currGraphBuff, 0, (theG6WriteIterator->currGraphBuffSize) * sizeof(char)); - graphOrder = pG6WriteIterator->graphOrder; - numCharsForGraphOrder = pG6WriteIterator->numCharsForGraphOrder; - numCharsForGraphEncoding = pG6WriteIterator->numCharsForGraphEncoding; - totalNumCharsForOrderAndGraph = numCharsForGraphOrder + numCharsForGraphEncoding; + order = theG6WriteIterator->order; + numCharsForOrder = theG6WriteIterator->numCharsForOrder; + numCharsForGraphEncoding = theG6WriteIterator->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 +500,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) +void _g6_GetFirstEdgeInUse(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) = NIL; - (*e) = gp_GetFirstEdge(theGraph); - - return _getNextInUseEdge(theGraph, e, u, v); + _g6_GetNextEdgeInUse(theGraph, e, u, v); } -int _getNextEdge(graphP theGraph, int *e, int *u, int *v) +void _g6_GetNextEdgeInUse(graphP theGraph, int *e, int *u, int *v) { - if (theGraph == NULL) - return NOTOK; - - (*e) += 2; - - return _getNextInUseEdge(theGraph, e, u, v); -} - -int _getNextInUseEdge(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_EdgeArrayStart(theGraph); + else + (*e) += 2; + if ((*e) < EsizeOccupied) { while (!gp_EdgeInUse(theGraph, (*e))) @@ -400,195 +546,147 @@ int _getNextInUseEdge(graphP theGraph, int *e, int *u, int *v) if ((*e) < EsizeOccupied && gp_EdgeInUse(theGraph, (*e))) { (*u) = gp_GetNeighbor(theGraph, (*e)); - (*v) = gp_GetNeighbor(theGraph, gp_GetTwinArc(theGraph, (*e))); + (*v) = gp_GetNeighbor(theGraph, gp_GetTwin(theGraph, (*e))); } } - - return exitCode; } -int _printEncodedGraph(G6WriteIteratorP pG6WriteIterator) +int _g6_WriteEncodedGraph(G6WriteIteratorP theG6WriteIterator) { - 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) + if (sf_fputs(theG6WriteIterator->currGraphBuff, theG6WriteIterator->outputContainer) < 0) { ErrorMessage("Failed to output all characters of g6 encoding.\n"); - exitCode = NOTOK; + return NOTOK; } - if (sf_fputs("\n", pG6WriteIterator->g6Output) < 0) + if (sf_fputs("\n", theG6WriteIterator->outputContainer) < 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) +// If the writer is initialized with string, then when we free the writer this +// method will give the allocated string back to the user. +// NOTE: This setting will occur if any writer operations returned NOTOK, so the +// caller is responsible for checking if the string is NULL and freeing it in +// all cases. +void g6_FreeWriter(G6WriteIteratorP *pG6WriteIterator) { - int exitCode = OK; - - if (ppG6WriteIterator != NULL && (*ppG6WriteIterator) != NULL) + if (pG6WriteIterator != NULL && (*pG6WriteIterator) != NULL) { - if ((*ppG6WriteIterator)->g6Output != NULL) - sf_Free(&((*ppG6WriteIterator)->g6Output)); + if ((*pG6WriteIterator)->outputContainer != NULL) + sf_Free((&((*pG6WriteIterator)->outputContainer))); - (*ppG6WriteIterator)->numGraphsWritten = 0; - (*ppG6WriteIterator)->graphOrder = 0; + (*pG6WriteIterator)->numGraphsWritten = 0; + (*pG6WriteIterator)->order = 0; - if ((*ppG6WriteIterator)->currGraphBuff != NULL) + if ((*pG6WriteIterator)->currGraphBuff != NULL) { - free((*ppG6WriteIterator)->currGraphBuff); - (*ppG6WriteIterator)->currGraphBuff = NULL; + free((*pG6WriteIterator)->currGraphBuff); + (*pG6WriteIterator)->currGraphBuff = NULL; } - if ((*ppG6WriteIterator)->columnOffsets != NULL) + if ((*pG6WriteIterator)->columnOffsets != NULL) { - free(((*ppG6WriteIterator)->columnOffsets)); - (*ppG6WriteIterator)->columnOffsets = NULL; + free(((*pG6WriteIterator)->columnOffsets)); + (*pG6WriteIterator)->columnOffsets = NULL; } // N.B. The G6WriteIterator doesn't "own" the graph, so we don't free it. - (*ppG6WriteIterator)->currGraph = NULL; + (*pG6WriteIterator)->currGraph = NULL; - free((*ppG6WriteIterator)); - (*ppG6WriteIterator) = NULL; + free((*pG6WriteIterator)); + (*pG6WriteIterator) = NULL; } - - return exitCode; } -int _WriteGraphToG6FilePath(graphP pGraph, char *g6OutputFilename) +int _g6_WriteGraphToFile(graphP theGraph, char *g6OutputFileName) { - strOrFileP outputContainer = sf_New(NULL, g6OutputFilename, WRITETEXT); - if (outputContainer == NULL) + strOrFileP outputContainer = NULL; + + if (g6OutputFileName == NULL || strlen(g6OutputFileName) == 0) { - ErrorMessage("Unable to allocate outputContainer to which to write.\n"); + ErrorMessage( + "Unable to write graph to file, as output filename supplied is " + "NULL or empty.\n"); return NOTOK; } - - return _WriteGraphToG6StrOrFile(pGraph, outputContainer, NULL); -} - -int _WriteGraphToG6String(graphP pGraph, char **g6OutputStr) -{ - strOrFileP outputContainer = sf_New(NULL, NULL, WRITETEXT); - if (outputContainer == NULL) + if ((outputContainer = sf_NewOutputContainer(NULL, g6OutputFileName)) == NULL) { ErrorMessage("Unable to allocate outputContainer to which to write.\n"); return NOTOK; } - // 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(). - // 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); + return _g6_WriteGraphToStrOrFile(theGraph, (&outputContainer)); } -int _WriteGraphToG6StrOrFile(graphP pGraph, strOrFileP outputContainer, char **outputStr) +int _g6_WriteGraphToString(graphP theGraph, char **pOutputStr) { - int exitCode = OK; - - G6WriteIteratorP pG6WriteIterator = NULL; + strOrFileP outputContainer = NULL; - if (sf_ValidateStrOrFile(outputContainer) != OK) + if (pOutputStr == NULL) { - ErrorMessage("Invalid G6 output container.\n"); + ErrorMessage("If writing G6 to string, must provide pointer-pointer " + "to allow _g6_WriteGraphToString() to assign the " + "address of the output string.\n"); return NOTOK; } - if (outputContainer->theStr != NULL && (outputStr == NULL)) + if ((*pOutputStr) != NULL) { - ErrorMessage("If writing G6 to string, must provide pointer-pointer " - "to allow _WriteGraphToG6StrOrFile() to assign the address " - "of the output string.\n"); + ErrorMessage("(*pOutputStr) should not point to allocated memory."); return NOTOK; } - if (outputStr != NULL && (*outputStr) != NULL) + if ((outputContainer = sf_NewOutputContainer(pOutputStr, NULL)) == NULL) { - ErrorMessage("(*outputStr) should not point to allocated memory."); + ErrorMessage("Unable to allocate outputContainer to which to write.\n"); return NOTOK; } - exitCode = allocateG6WriteIterator(&pG6WriteIterator, pGraph); - if (exitCode != OK) - { - ErrorMessage("Unable to allocate G6WriteIterator.\n"); - freeG6WriteIterator(&pG6WriteIterator); - return exitCode; - } + // N.B. Once the graph is successfully written, the string is taken from + // the G6WriteIterator's outputContainer and assigned to (*pOutputStr) + // before freeing the G6 write iterator. + return _g6_WriteGraphToStrOrFile(theGraph, (&outputContainer)); +} + +int _g6_WriteGraphToStrOrFile(graphP theGraph, strOrFileP *pOutputContainer) +{ + G6WriteIteratorP theG6WriteIterator = NULL; - exitCode = beginG6WriteIterationToG6StrOrFile(pG6WriteIterator, outputContainer); - if (exitCode != OK) + if (!sf_IsValidStrOrFile((*pOutputContainer))) { - ErrorMessage("Unable to begin G6 write iteration.\n"); - freeG6WriteIterator(&pG6WriteIterator); - return exitCode; + ErrorMessage("Invalid G6 output container.\n"); + return NOTOK; } - exitCode = writeGraphUsingG6WriteIterator(pG6WriteIterator); - if (exitCode != OK) - ErrorMessage("Unable to write graph using G6WriteIterator.\n"); - else + if (g6_NewWriter((&theG6WriteIterator), theGraph) != OK) { - if (outputStr != NULL && pG6WriteIterator->g6Output->theStr != NULL) - (*outputStr) = sf_takeTheStr(pG6WriteIterator->g6Output); + ErrorMessage("Unable to allocate G6WriteIterator.\n"); + g6_FreeWriter((&theG6WriteIterator)); + return NOTOK; } - if (endG6WriteIteration(pG6WriteIterator) != OK) + // NOTE: (*pOutputContainer) will be NULL after we return from this call, + // since the write iterator will take ownership of the output container. + if (_g6_InitWriterWithStrOrFile(theG6WriteIterator, pOutputContainer) != OK) { - ErrorMessage("Unable to end G6 write iteration.\n"); - exitCode = NOTOK; + ErrorMessage("Unable to initialize G6WriteIterator.\n"); + g6_FreeWriter((&theG6WriteIterator)); + return NOTOK; } - if (freeG6WriteIterator(&pG6WriteIterator) != OK) + if (g6_WriteGraph(theG6WriteIterator) != OK) { - ErrorMessage("Unable to free G6Writer.\n"); - exitCode = NOTOK; + ErrorMessage("Unable to write graph using G6WriteIterator.\n"); + g6_FreeWriter((&theG6WriteIterator)); + return NOTOK; } - return exitCode; + g6_FreeWriter((&theG6WriteIterator)); + + return OK; } diff --git a/planarity/c/graphLib/io/g6-write-iterator.h b/planarity/c/graphLib/io/g6-write-iterator.h index c855d8f..69703d6 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. */ @@ -20,11 +20,11 @@ extern "C" typedef struct { - strOrFileP g6Output; + strOrFileP outputContainer; 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 *pG6WriteIterator, graphP theGraph); - int getNumGraphsWritten(G6WriteIteratorP, int *); - int getOrderOfGraphToWrite(G6WriteIteratorP, int *); - int getPointerToGraphToWrite(G6WriteIteratorP, graphP *); + int g6_GetNumGraphsWritten(G6WriteIteratorP theG6WriteIterator, int *pNumGraphsWritten); + int g6_GetOrderFromWriter(G6WriteIteratorP theG6WriteIterator, int *pOrder); + int g6_GetGraphFromWriter(G6WriteIteratorP theG6WriteIterator, graphP *pGraph); - int beginG6WriteIterationToG6String(G6WriteIteratorP); - int beginG6WriteIterationToG6FilePath(G6WriteIteratorP, char *); - int beginG6WriteIterationToG6StrOrFile(G6WriteIteratorP, strOrFileP); - int _beginG6WriteIteration(G6WriteIteratorP); - void _precomputeColumnOffsets(int *, int); + int g6_InitWriterWithString(G6WriteIteratorP theG6WriteIterator, char **pOutputString); + int g6_InitWriterWithFileName(G6WriteIteratorP theG6WriteIterator, char *outputFileName); - int writeGraphUsingG6WriteIterator(G6WriteIteratorP); + int g6_WriteGraph(G6WriteIteratorP theG6WriteIterator); - 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 *pG6WriteIterator); #ifdef __cplusplus } diff --git a/planarity/c/graphLib/io/graphIO.c b/planarity/c/graphLib/io/graphIO.c index 41d24f2..5c6d6b3 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,15 +10,19 @@ See the LICENSE.TXT file for licensing information. #include "../graph.h" +/* Imported functions */ +extern int _g6_ReadGraphFromStrOrFile(graphP theGraph, strOrFileP *pG6InputContainer); +extern int _g6_WriteGraphToStrOrFile(graphP theGraph, strOrFileP *pOutputContainer); + /* Private functions (exported to system) */ -int _ReadGraph(graphP theGraph, strOrFileP inputContainer); +int _ReadGraph(graphP theGraph, strOrFileP *pInputContainer); int _ReadAdjMatrix(graphP theGraph, strOrFileP inputContainer); int _ReadAdjList(graphP theGraph, strOrFileP inputContainer); int _ReadLEDAGraph(graphP theGraph, strOrFileP inputContainer); int _ReadPostprocess(graphP theGraph, char *extraData); -int _WriteGraph(graphP theGraph, strOrFileP *outputContainer, char **pOutputStr, int Mode); +int _WriteGraph(graphP theGraph, strOrFileP *outputContainer, int Mode); int _WriteAdjList(graphP theGraph, strOrFileP outputContainer); int _WriteAdjMatrix(graphP theGraph, strOrFileP outputContainer); int _WriteDebugInfo(graphP theGraph, strOrFileP outputContainer); @@ -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) @@ -116,7 +120,7 @@ int _ReadAdjMatrix(graphP theGraph, strOrFileP inputContainer) NOTE: If a loop edge is found, it is ignored without error. - NOTE: This routine supports digraphs. For a directed arc (v -> W), + NOTE: This routine supports digraphs. For a directed edge (v -> W), an edge record is created in both vertices, v and W, and the edge record in v's adjacency list is marked OUTONLY while the edge record in W's list is marked INONLY. @@ -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 @@ -196,27 +207,27 @@ int _ReadAdjList(graphP theGraph, strOrFileP inputContainer) // have the matching adjacency using the following mechanism. After the // 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)) + adjList = gp_GetFirstEdge(theGraph, v); + if (gp_IsEdge(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)) + e = gp_GetFirstEdge(theGraph, v); + while (gp_IsEdge(theGraph, e)) { gp_SetVertexVisitedInfo(theGraph, gp_GetNeighbor(theGraph, e), e); - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } // Make the adjacency list circular, for later ease of processing - gp_SetPrevArc(theGraph, adjList, gp_GetLastArc(theGraph, v)); - gp_SetNextArc(theGraph, gp_GetLastArc(theGraph, v), adjList); + gp_SetPrevEdge(theGraph, adjList, gp_GetLastEdge(theGraph, v)); + gp_SetNextEdge(theGraph, gp_GetLastEdge(theGraph, v), adjList); // Remove the list from the vertex - gp_SetFirstArc(theGraph, v, NIL); - gp_SetLastArc(theGraph, v, NIL); + gp_SetFirstEdge(theGraph, v, NIL); + gp_SetLastEdge(theGraph, v, NIL); } // Read the adjacency list. @@ -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; @@ -257,36 +274,36 @@ int _ReadAdjList(graphP theGraph, strOrFileP inputContainer) // if it is there, and if not then we have to add a directed edge. else { - // 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 the directed edge already exists, then we add it + // as the new first edge of the vertex and delete it from adjList + if (gp_IsEdge(theGraph, gp_GetVertexVisitedInfo(theGraph, W))) { e = gp_GetVertexVisitedInfo(theGraph, W); - // Remove the arc e from the adjList construct + // Remove the directed edge e from the adjList construct gp_SetVertexVisitedInfo(theGraph, W, NIL); if (adjList == e) { - if ((adjList = gp_GetNextArc(theGraph, e)) == e) + if ((adjList = gp_GetNextEdge(theGraph, e)) == e) adjList = NIL; } - gp_SetPrevArc(theGraph, gp_GetNextArc(theGraph, e), gp_GetPrevArc(theGraph, e)); - gp_SetNextArc(theGraph, gp_GetPrevArc(theGraph, e), gp_GetNextArc(theGraph, e)); + gp_SetPrevEdge(theGraph, gp_GetNextEdge(theGraph, e), gp_GetPrevEdge(theGraph, e)); + gp_SetNextEdge(theGraph, gp_GetPrevEdge(theGraph, e), gp_GetNextEdge(theGraph, e)); - gp_AttachFirstArc(theGraph, v, e); + gp_AttachFirstEdge(theGraph, v, e); } // If an adjacency node to the lower numbered vertex W does not - // already exist, then we make a new directed arc from the current + // already exist, then we make a new directed edge from the current // vertex v to W. else { - // It is added as the new first arc in both vertices + // It is added as the new first edge in both vertices if ((ErrorCode = gp_DynamicAddEdge(theGraph, v, 0, W, 0)) != OK) return ErrorCode; - // Note that this call also sets OUTONLY on the twin arc - gp_SetDirection(theGraph, gp_GetFirstArc(theGraph, W), EDGEFLAG_DIRECTION_INONLY); + // Note that this call also sets OUTONLY on the twin edge record + gp_SetDirection(theGraph, gp_GetFirstEdge(theGraph, W), EDGEFLAG_DIRECTION_INONLY); // This macro expands to constant conditional expression, but it's the proper use of the API } } @@ -294,29 +311,29 @@ int _ReadAdjList(graphP theGraph, strOrFileP inputContainer) // If there are still adjList entries after the read operation // then those entries are not representative of full undirected edges. - // Rather, they represent incoming directed arcs from other vertices + // Rather, they represent incoming directed edge 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_IsEdge(theGraph, adjList)) { e = adjList; gp_SetVertexVisitedInfo(theGraph, gp_GetNeighbor(theGraph, e), NIL); - if ((adjList = gp_GetNextArc(theGraph, e)) == e) + if ((adjList = gp_GetNextEdge(theGraph, e)) == e) adjList = NIL; - gp_SetPrevArc(theGraph, gp_GetNextArc(theGraph, e), gp_GetPrevArc(theGraph, e)); - gp_SetNextArc(theGraph, gp_GetPrevArc(theGraph, e), gp_GetNextArc(theGraph, e)); + gp_SetPrevEdge(theGraph, gp_GetNextEdge(theGraph, e), gp_GetPrevEdge(theGraph, e)); + gp_SetNextEdge(theGraph, gp_GetPrevEdge(theGraph, e), gp_GetNextEdge(theGraph, e)); - gp_AttachFirstArc(theGraph, v, e); + gp_AttachFirstEdge(theGraph, v, e); gp_SetDirection(theGraph, e, EDGEFLAG_DIRECTION_INONLY); // This macro expands to constant conditional expression, but it's the proper use of the API } } if (zeroBased) - theGraph->internalFlags |= FLAGS_ZEROBASEDIO; + theGraph->graphFlags |= FLAGS_ZEROBASEDIO; return OK; } @@ -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]; + + memset(Line, '\0', (MAXLINE + 1)); - if (sf_ValidateStrOrFile(inputContainer) != OK) + 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; @@ -405,7 +426,7 @@ int _ReadLEDAGraph(graphP theGraph, strOrFileP inputContainer) } if (zeroBasedOffset) - theGraph->internalFlags |= FLAGS_ZEROBASEDIO; + theGraph->graphFlags |= FLAGS_ZEROBASEDIO; return OK; } @@ -423,11 +444,15 @@ int _ReadLEDAGraph(graphP theGraph, strOrFileP inputContainer) int gp_Read(graphP theGraph, char const *FileName) { - strOrFileP inputContainer = sf_New(NULL, FileName, READTEXT); - if (inputContainer == NULL) + strOrFileP inputContainer = NULL; + + if (theGraph == NULL || FileName == NULL || strlen(FileName) == 0) + return NOTOK; + + if ((inputContainer = sf_NewInputContainer(NULL, FileName)) == NULL) return NOTOK; - return _ReadGraph(theGraph, inputContainer); + return _ReadGraph(theGraph, (&inputContainer)); } /******************************************************************** @@ -435,26 +460,24 @@ 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); - if (inputContainer == NULL) - { - if (inputStr != NULL) - free(inputStr); - inputStr = NULL; + strOrFileP inputContainer = NULL; + + if (theGraph == NULL || inputStr == NULL || strlen(inputStr) == 0) return NOTOK; - } - return _ReadGraph(theGraph, inputContainer); + if ((inputContainer = sf_NewInputContainer(inputStr, NULL)) == NULL) + return NOTOK; + + return _ReadGraph(theGraph, (&inputContainer)); } /******************************************************************** @@ -472,51 +495,53 @@ int gp_ReadFromString(graphP theGraph, char *inputStr) ignored without producing an error. ********************************************************************/ -int _ReadGraph(graphP theGraph, strOrFileP inputContainer) +int _ReadGraph(graphP theGraph, strOrFileP *pInputContainer) { int RetVal = OK; + bool extraDataAllowed = false; char lineBuff[MAXLINE + 1]; - if (sf_ValidateStrOrFile(inputContainer) != OK) + memset(lineBuff, '\0', (MAXLINE + 1)); + + if (!sf_IsValidStrOrFile((*pInputContainer))) return NOTOK; - if (sf_fgets(lineBuff, MAXLINE, inputContainer) == NULL) + if (sf_fgets(lineBuff, MAXLINE, (*pInputContainer)) == NULL) { - sf_Free(&inputContainer); + sf_Free(pInputContainer); return NOTOK; } - if (sf_ungets(lineBuff, inputContainer) != OK) + if (sf_ungets(lineBuff, (*pInputContainer)) != OK) { - sf_Free(&inputContainer); + sf_Free(pInputContainer); return NOTOK; } if (strncmp(lineBuff, "LEDA.GRAPH", strlen("LEDA.GRAPH")) == 0) { - RetVal = _ReadLEDAGraph(theGraph, inputContainer); + RetVal = _ReadLEDAGraph(theGraph, (*pInputContainer)); } else if (strncmp(lineBuff, "N=", strlen("N=")) == 0) { - RetVal = _ReadAdjList(theGraph, inputContainer); + RetVal = _ReadAdjList(theGraph, (*pInputContainer)); if (RetVal == OK) extraDataAllowed = true; } else if (isdigit(lineBuff[0])) { - RetVal = _ReadAdjMatrix(theGraph, inputContainer); + RetVal = _ReadAdjMatrix(theGraph, (*pInputContainer)); if (RetVal == OK) extraDataAllowed = true; } else { - RetVal = _ReadGraphFromG6StrOrFile(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 - // prevents calling free on alread-freed memory. - inputContainer = NULL; + // calls sf_Free() when ending iteration. This will mean that + // (*pInputContainer) is NULL after we return from this call. + RetVal = _g6_ReadGraphFromStrOrFile(theGraph, pInputContainer); } // The possibility of "extra data" is not allowed for .g6 format: @@ -528,9 +553,9 @@ int _ReadGraph(graphP theGraph, strOrFileP inputContainer) if (extraDataAllowed) { char charAfterGraphRead = EOF; - if ((charAfterGraphRead = sf_getc(inputContainer)) != EOF) + if ((charAfterGraphRead = sf_getc((*pInputContainer))) != EOF) { - if (sf_ungetc(charAfterGraphRead, inputContainer) != charAfterGraphRead) + if (sf_ungetc(charAfterGraphRead, (*pInputContainer)) != charAfterGraphRead) RetVal = NOTOK; else { @@ -539,8 +564,7 @@ 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) + while (sf_fgets(lineBuff, MAXLINE, (*pInputContainer)) != NULL) { if (sb_ConcatString(extraData, lineBuff) != OK) { @@ -559,9 +583,10 @@ int _ReadGraph(graphP theGraph, strOrFileP inputContainer) } } - if (inputContainer != NULL) - sf_Free(&inputContainer); - inputContainer = NULL; + // This is a no-op if pInputContainer or *pInputContainer is already NULL, + // such as in the case of G6 file processing. This cleans up for the other + // file types. + sf_Free(pInputContainer); return RetVal; } @@ -576,51 +601,65 @@ int _ReadPostprocess(graphP theGraph, char *extraData) For each vertex, we write its number, a colon, the list of adjacent vertices, then a NIL. The vertices occupy the first N positions of theGraph. Each vertex is also has indicators of the first and last - adjacency nodes (arcs) in its adjacency list. + adjacency nodes (edge records) in its adjacency list. Returns: NOTOK for parameter errors; OK otherwise. ********************************************************************/ 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 - if (sprintf(numberStr, "N=%d\n", theGraph->N) < 1) + if (sprintf(numberStr, "N=%d\n", gp_GetN(theGraph)) < 1) return NOTOK; 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 (gp_GetGraphFlags(theGraph) & 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)) + e = gp_GetLastEdge(theGraph, v); + while (gp_IsEdge(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; } - e = gp_GetPrevArc(theGraph, e); + e = gp_GetPrevEdge(theGraph, e); } // 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,35 +683,36 @@ 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 - if (sprintf(numberStr, "%d\n", theGraph->N) < 1) + if (sprintf(numberStr, "%d\n", gp_GetN(theGraph)) < 1) return NOTOK; if (sf_fputs(numberStr, outputContainer) == EOF) return NOTOK; // Allocate memory for storing a string expression of one row at a time - Row = (char *)malloc((theGraph->N + 2) * sizeof(char)); + Row = (char *)malloc((gp_GetN(theGraph) + 2) * sizeof(char)); if (Row == NULL) 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)] = ' '; - e = gp_GetFirstArc(theGraph, v); - while (gp_IsArc(e)) + for (int i = v + 1; gp_VertexInRangeAscending(theGraph, i); i++) + Row[i - gp_GetFirstVertex(theGraph)] = '0'; + + e = gp_GetFirstEdge(theGraph, v); + while (gp_IsEdge(theGraph, e)) { if (gp_GetDirection(theGraph, e) == EDGEFLAG_DIRECTION_INONLY) return NOTOK; @@ -680,11 +720,11 @@ int _WriteAdjMatrix(graphP theGraph, strOrFileP outputContainer) if (gp_GetNeighbor(theGraph, e) > v) Row[gp_GetNeighbor(theGraph, e) - gp_GetFirstVertex(theGraph)] = '1'; - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } - Row[theGraph->N] = '\n'; - Row[theGraph->N + 1] = '\0'; + Row[gp_GetN(theGraph)] = '\n'; + Row[gp_GetN(theGraph) + 1] = '\0'; // Write the row to the file or string buffer if (sf_fputs(Row, outputContainer) == EOF) @@ -692,6 +732,8 @@ int _WriteAdjMatrix(graphP theGraph, strOrFileP outputContainer) } free(Row); + Row = NULL; + return OK; } @@ -719,17 +761,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; @@ -737,45 +779,46 @@ char _GetVertexObstructionTypeChar(graphP theGraph, int v) /******************************************************************** _WriteDebugInfo() - Writes adjacency list, but also includes the type value of each - edge (e.g. is it DFS child arc, forward arc or back arc?), and - the L, A and DFSParent of each vertex. + Writes adjacency list, but also includes the type value of each edge, + e.g. is it an edge record to a DFS child, a descendant (forward edge), + or ancestor (back edge), and the L, A and DFSParent of each vertex. ********************************************************************/ 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 */ - if (sprintf(lineBuf, "DEBUG N=%d M=%d\n", theGraph->N, theGraph->M) < 1) + if (sprintf(lineBuf, "DEBUG N=%d M=%d\n", gp_GetN(theGraph), gp_GetM(theGraph)) < 1) return NOTOK; 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)) + e = gp_GetFirstEdge(theGraph, v); + while (gp_IsEdge(theGraph, e)) { if (sprintf(lineBuf, " %d(e=%d)", gp_GetNeighbor(theGraph, e), e) < 1) return NOTOK; if (sf_fputs(lineBuf, outputContainer) == EOF) return NOTOK; - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } if (sprintf(lineBuf, " %d\n", NIL) < 1) @@ -786,27 +829,27 @@ 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)) + e = gp_GetFirstEdge(theGraph, v); + while (gp_IsEdge(theGraph, e)) { if (sprintf(lineBuf, " %d(e=%d)", gp_GetNeighbor(theGraph, e), e) < 1) return NOTOK; if (sf_fputs(lineBuf, outputContainer) == EOF) return NOTOK; - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } if (sprintf(lineBuf, " %d\n", NIL) < 1) @@ -819,29 +862,29 @@ 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", + if (sprintf(lineBuf, "V[%3d] index=%3d, type=%c, first edge=%3d, last edge=%3d\n", v, - gp_GetVertexIndex(theGraph, v), - (gp_IsVirtualVertex(theGraph, v) ? 'X' : _GetVertexObstructionTypeChar(theGraph, v)), - gp_GetFirstArc(theGraph, v), - gp_GetLastArc(theGraph, v)) < 1) + gp_GetIndex(theGraph, v), + (gp_IsVirtualVertex(theGraph, v) ? 'X' : _GetObstructionMarkChar(theGraph, v)), + gp_GetFirstEdge(theGraph, v), + gp_GetLastEdge(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", + if (sprintf(lineBuf, "V[%3d] index=%3d, type=%c, first edge=%3d, last edge=%3d\n", v, - gp_GetVertexIndex(theGraph, v), - (gp_IsVirtualVertex(theGraph, v) ? 'X' : _GetVertexObstructionTypeChar(theGraph, v)), - gp_GetFirstArc(theGraph, v), - gp_GetLastArc(theGraph, v)) < 1) + gp_GetIndex(theGraph, v), + (gp_IsVirtualVertex(theGraph, v) ? 'X' : _GetObstructionMarkChar(theGraph, v)), + gp_GetFirstEdge(theGraph, v), + gp_GetLastEdge(theGraph, v)) < 1) return NOTOK; if (sf_fputs(lineBuf, outputContainer) == EOF) return NOTOK; @@ -852,17 +895,17 @@ int _WriteDebugInfo(graphP theGraph, strOrFileP outputContainer) if (sf_fputs("\nEDGE INFORMATION\n", outputContainer) == EOF) return NOTOK; - EsizeOccupied = gp_EdgeInUseIndexBound(theGraph); - for (e = gp_GetFirstEdge(theGraph); e < EsizeOccupied; e++) + EsizeOccupied = gp_EdgeInUseArraySize(theGraph); + for (e = gp_EdgeArrayStart(theGraph); e < EsizeOccupied; e++) { if (gp_EdgeInUse(theGraph, e)) { - if (sprintf(lineBuf, "E[%3d] neighbor=%3d, type=%c, next arc=%3d, prev arc=%3d\n", + if (sprintf(lineBuf, "E[%3d] neighbor=%3d, type=%c, next edge=%3d, prev edge=%3d\n", e, gp_GetNeighbor(theGraph, e), _GetEdgeTypeChar(theGraph, e), - gp_GetNextArc(theGraph, e), - gp_GetPrevArc(theGraph, e)) < 1) + gp_GetNextEdge(theGraph, e), + gp_GetPrevEdge(theGraph, e)) < 1) return NOTOK; if (sf_fputs(lineBuf, outputContainer) == EOF) return NOTOK; @@ -885,24 +928,21 @@ 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) + if (theGraph == NULL || FileName == NULL || strlen(FileName) == 0) return NOTOK; if (strcmp(FileName, "nullwrite") == 0) return OK; - outputContainer = sf_New(NULL, FileName, WRITETEXT); - if (outputContainer == NULL) + if ((outputContainer = sf_NewOutputContainer(NULL, FileName)) == NULL) return NOTOK; - RetVal = _WriteGraph(theGraph, &outputContainer, NULL, Mode); + RetVal = _WriteGraph(theGraph, &outputContainer, Mode); - if (outputContainer != NULL) - sf_Free(&outputContainer); - outputContainer = NULL; + sf_Free(&outputContainer); return RetVal; } @@ -925,37 +965,44 @@ 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) + if (theGraph == NULL || pOutputStr == NULL || (*pOutputStr) != NULL) return NOTOK; - outputContainer = sf_New(NULL, NULL, WRITETEXT); - if (outputContainer == NULL) + if ((outputContainer = sf_NewOutputContainer(pOutputStr, NULL)) == NULL) return NOTOK; - RetVal = _WriteGraph(theGraph, &outputContainer, pOutputStr, 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 - // 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, - // WRITE_ADJMATRIX, and WRITE_DEBUGINFO do *not* clean up the - // outputContainer. - if (RetVal == OK && outputContainer != NULL) + RetVal = _WriteGraph(theGraph, &outputContainer, Mode); + + sf_Free(&outputContainer); + + // NOTE: (#56) If an error was encountered when we _WriteGraph(), we do not + // want to return garbage to the caller. When we free the output container, + // if writing to string, this means that we will have taken the string from + // the internal theStrBuf and have assigned it to the container's + // pointer-pointer pOutputStr for output; if the RetVal is not OK, we + // must free the string and set the pointer-pointer to NULL. + if (RetVal != OK) { - (*pOutputStr) = sf_takeTheStr(outputContainer); + if (pOutputStr != NULL && (*pOutputStr) != NULL) + { + free((*pOutputStr)); + pOutputStr = NULL; + } } - if ((*pOutputStr) == NULL || strlen(*pOutputStr) == 0) + // NOTE: If the output string is NULL or empty, need to report NOTOK + if (pOutputStr != NULL && (*pOutputStr) == NULL) RetVal = NOTOK; - - if (outputContainer != NULL) - sf_Free(&outputContainer); - outputContainer = NULL; + else if (pOutputStr != NULL && strlen(*pOutputStr) == 0) + { + free((*pOutputStr)); + pOutputStr = NULL; + RetVal = NOTOK; + } return RetVal; } @@ -971,26 +1018,25 @@ int gp_WriteToString(graphP theGraph, char **pOutputStr, int Mode) Returns NOTOK on error, OK on success. ********************************************************************/ -int _WriteGraph(graphP theGraph, strOrFileP *outputContainer, char **pOutputStr, int Mode) +int _WriteGraph(graphP theGraph, strOrFileP *pOutputContainer, int Mode) { int RetVal = OK; switch (Mode) { case WRITE_G6: - RetVal = _WriteGraphToG6StrOrFile(theGraph, (*outputContainer), pOutputStr); - // Since G6WriteIterator owns the outputContainer, it'll - // free it, so don't want to try to double-free - (*outputContainer) = NULL; + // This call takes ownership of the outputContainer, so (*pOutputContainer) + // will be NULL upon return from this function. + RetVal = _g6_WriteGraphToStrOrFile(theGraph, pOutputContainer); break; case WRITE_ADJLIST: - RetVal = _WriteAdjList(theGraph, (*outputContainer)); + RetVal = _WriteAdjList(theGraph, (*pOutputContainer)); break; case WRITE_ADJMATRIX: - RetVal = _WriteAdjMatrix(theGraph, (*outputContainer)); + RetVal = _WriteAdjMatrix(theGraph, (*pOutputContainer)); break; case WRITE_DEBUGINFO: - RetVal = _WriteDebugInfo(theGraph, (*outputContainer)); + RetVal = _WriteDebugInfo(theGraph, (*pOutputContainer)); break; default: RetVal = NOTOK; @@ -1005,9 +1051,11 @@ int _WriteGraph(graphP theGraph, strOrFileP *outputContainer, char **pOutputStr, if (extraData != NULL) { - if (sf_fputs(extraData, (*outputContainer)) == EOF) + if (sf_fputs(extraData, (*pOutputContainer)) == 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..5edc1f8 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,149 +7,164 @@ See the LICENSE.TXT file for licensing information. #include #include #include -#include #include #include "../lowLevelUtils/appconst.h" #include "strOrFile.h" /******************************************************************** - sf_New() + sf_NewInputContainer() - 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_NewInputContainer() should either receive a non-NULL and + nonempty input string (which the container *does not own*, but rather copies + into the internal strBufP) XOR a non-NULL and nonempty fileName (which may + correspond to stdin). 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_NewInputContainer(char const *const inputStr, char const *const fileName) { strOrFileP theStrOrFile; - int containerType = 0; - if ((fileName != NULL) && (theStr != NULL)) + if ( + ((fileName != NULL) && (inputStr != NULL)) || + ((fileName == NULL) && (inputStr == NULL))) return NULL; theStrOrFile = (strOrFileP)calloc(1, sizeof(strOrFile)); if (theStrOrFile != NULL) { + theStrOrFile->containerType = INPUT_CONTAINER; + if (fileName != NULL) { - FILE *pFile = NULL; - - // N.B. If the ioMode is specified but is neither - // READTEXT nor WRITETEXT, error out - if (ioMode != NULL && - strncmp(ioMode, READTEXT, strlen(READTEXT)) != 0 && - strncmp(ioMode, WRITETEXT, strlen(WRITETEXT)) != 0) + // N.B. If the fileName indicates a stream, then input containers + // may only contain stdin. + if (strcmp(fileName, "stdin") == 0) + theStrOrFile->pFile = stdin; + else if ( + (strcmp(fileName, "stdout") == 0) || + (strcmp(fileName, "stderr") == 0)) { sf_Free(&theStrOrFile); + theStrOrFile = NULL; return NULL; } - - // N.B. If the fileName indicates a stream, then make sure - // ioMode is correct. Since we previously made sure that - // non-NULL ioMode must either refer to READTEXT or WRITETEXT, - // we don't have to worry about freeing up the former string - // before re-assigning. - if (strcmp(fileName, "stdin") == 0) + else { - if (ioMode != NULL && strncmp(ioMode, READTEXT, strlen(READTEXT)) != 0) + if ((theStrOrFile->pFile = fopen(fileName, READTEXT)) == NULL) { sf_Free(&theStrOrFile); + theStrOrFile = NULL; return NULL; } - - pFile = stdin; - containerType = INPUT_CONTAINER; } - else if (strcmp(fileName, "stdout") == 0) + } + else + { + if ((theStrOrFile->theStrBuf = sb_New(0)) == NULL) { - if (ioMode != NULL && strncmp(ioMode, WRITETEXT, strlen(WRITETEXT)) != 0) - { - sf_Free(&theStrOrFile); - return NULL; - } - - pFile = stdout; - containerType = OUTPUT_CONTAINER; + sf_Free(&theStrOrFile); + theStrOrFile = NULL; + return NULL; } - else if (strcmp(fileName, "stderr") == 0) + if ( + (inputStr == NULL || (strlen(inputStr) == 0)) || + sb_ConcatString(theStrOrFile->theStrBuf, inputStr) != OK) { - if (ioMode != NULL && strncmp(ioMode, WRITETEXT, strlen(WRITETEXT)) != 0) - { - sf_Free(&theStrOrFile); - return NULL; - } + sf_Free(&theStrOrFile); + theStrOrFile = NULL; + return NULL; + } + } - pFile = stderr; - containerType = OUTPUT_CONTAINER; + theStrOrFile->ungetBuf = sp_New(MAXLINE); + if (theStrOrFile->ungetBuf == NULL) + { + sf_Free(&theStrOrFile); + theStrOrFile = NULL; + return NULL; + } + } + + return theStrOrFile; +} + +/******************************************************************** + sf_NewOutputContainer() + + 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 output mode, sf_NewOutputContainer() should receive either a non-NULL + pointer-pointer that initially points to NULL (to which we will assign the + output string upon freeing the container) XOR a non-NULL and nonempty fileName + (which may correspond to stdout or stderr). If theStr is not NULL, then the + desired output string will be constructed internally in the string-or-file + object, which will only be returned to the caller when freeing the strOrFile + via this pointer-pointer. Note that if the fileName is not NULL, then the + internal + strBufP will not be constructed. + + Returns the allocated string-or-file container, or NULL on error. + ********************************************************************/ + +strOrFileP sf_NewOutputContainer(char **pOutputStr, char const *const fileName) +{ + strOrFileP theStrOrFile; + + if ( + ((fileName != NULL) && (pOutputStr != NULL)) || + ((fileName == NULL) && (pOutputStr == NULL)) || + ((pOutputStr != NULL) && ((*pOutputStr) != NULL))) + return NULL; + + theStrOrFile = (strOrFileP)calloc(1, sizeof(strOrFile)); + if (theStrOrFile != NULL) + { + theStrOrFile->containerType = OUTPUT_CONTAINER; + + if (fileName != NULL) + { + if (strcmp(fileName, "stdin") == 0) + { + sf_Free(&theStrOrFile); + theStrOrFile = NULL; + return NULL; } + else if (strcmp(fileName, "stdout") == 0) + theStrOrFile->pFile = stdout; + else if (strcmp(fileName, "stderr") == 0) + theStrOrFile->pFile = stderr; else { - // N.B. Clean up and return NULL if: - // - fileName is not one of stdin/stdout/stderr, and - // if the ioMode is not given - // - ioMode is given but is neither READTEXT nor - // WRITETEXT - if (ioMode == NULL || - (pFile = fopen(fileName, ioMode)) == NULL) + if ( + (theStrOrFile->pFile = fopen(fileName, WRITETEXT)) == NULL) { sf_Free(&theStrOrFile); + theStrOrFile = NULL; return NULL; } - - if (strncmp(ioMode, READTEXT, strlen(READTEXT)) == 0) - containerType = INPUT_CONTAINER; - else if (strncmp(ioMode, WRITETEXT, strlen(WRITETEXT)) == 0) - containerType = OUTPUT_CONTAINER; } - - theStrOrFile->pFile = pFile; } else { - strBufP strBufToAssign = NULL; - - if (strncmp(ioMode, READTEXT, strlen(READTEXT)) == 0) - containerType = INPUT_CONTAINER; - else if (strncmp(ioMode, WRITETEXT, strlen(WRITETEXT)) == 0) - containerType = OUTPUT_CONTAINER; - - // N.B. If you're writing to string (since fileName == NULL), but - // theStr has already been assigned some pointer, the container is - // invalid. One must sf_New(NULL, NULL, WRITETEXT) before handing - // off ownership of the container; when processing is done, before - // you free the owner of the output container, you must - // sf_takeTheStr(theStrOrFile) and return that pointer to the caller - if (containerType != INPUT_CONTAINER && theStr != NULL) - { - sf_Free(&theStrOrFile); - return NULL; - } - - if ((strBufToAssign = sb_New(0)) == NULL) - { - sf_Free(&theStrOrFile); - return NULL; - } - - if (theStr != NULL && sb_ConcatString(strBufToAssign, theStr) != OK) + if ((theStrOrFile->theStrBuf = sb_New(0)) == NULL) { - sb_Free(&strBufToAssign); sf_Free(&theStrOrFile); + theStrOrFile = NULL; return NULL; } - theStrOrFile->theStr = strBufToAssign; - } - - theStrOrFile->containerType = containerType; - - theStrOrFile->ungetBuf = sp_New(MAXLINE); - if (theStrOrFile->ungetBuf == NULL) - { - sf_Free(&theStrOrFile); - return NULL; + theStrOrFile->pOutputStr = pOutputStr; } } @@ -162,25 +177,42 @@ strOrFileP sf_New(char const *theStr, char const *fileName, char const *ioMode) Ensures that theStrOrFile: 1. Is not NULL 2. Has ungetBuf allocated - 3. Both pFile and theStr are not NULL - 4. Both pFile and theStr are not both assigned (since this container + 3. Both pFile and theStrBuf are not NULL + 4. Both pFile and theStrBuf are not both assigned (since this container 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 || - (theStrOrFile->pFile == NULL && theStrOrFile->theStr == NULL) || - (theStrOrFile->pFile != NULL && theStrOrFile->theStr != NULL) || + (theStrOrFile->pFile == NULL && theStrOrFile->theStrBuf == NULL) || + (theStrOrFile->pFile != NULL && theStrOrFile->theStrBuf != NULL) || (theStrOrFile->containerType != INPUT_CONTAINER && theStrOrFile->containerType != OUTPUT_CONTAINER)) - return NOTOK; + return false; - return OK; + if (theStrOrFile->containerType == INPUT_CONTAINER) + { + if ( + (theStrOrFile->ungetBuf == NULL) || + (theStrOrFile->theStrBuf != NULL && sb_GetSize(theStrOrFile->theStrBuf) == 0)) + + { + return false; + } + } + else // Otherwise, due to the above validation, can only be an output container + { + if (theStrOrFile->ungetBuf != NULL) + { + return false; + } + } + + return true; } /******************************************************************** @@ -188,7 +220,7 @@ int sf_ValidateStrOrFile(strOrFileP theStrOrFile) If strOrFileP has a non-empty ungetBuf, pop and return the character. If the ungetBuf is empty, then we'll read from pFile using getc() OR - from theStr by fetching the character at theStrPos and incrementing + from theStrBuf by fetching the character at theStrPos and incrementing theStrPos. ********************************************************************/ @@ -196,7 +228,7 @@ char sf_getc(strOrFileP theStrOrFile) { char theChar = EOF; - if (sf_ValidateStrOrFile(theStrOrFile) != OK || + if (!sf_IsValidStrOrFile(theStrOrFile) || theStrOrFile->containerType != INPUT_CONTAINER) return EOF; @@ -210,13 +242,13 @@ char sf_getc(strOrFileP theStrOrFile) } else if (theStrOrFile->pFile != NULL) theChar = (char)getc(theStrOrFile->pFile); - else if (theStrOrFile->theStr != NULL && sb_GetUnreadCharCount(theStrOrFile->theStr) > 0) + else if (theStrOrFile->theStrBuf != NULL && sb_GetUnreadCharCount(theStrOrFile->theStrBuf) > 0) { - theChar = sb_GetReadString(theStrOrFile->theStr) != NULL - ? sb_GetReadString(theStrOrFile->theStr)[0] + theChar = sb_GetReadString(theStrOrFile->theStrBuf) != NULL + ? sb_GetReadString(theStrOrFile->theStrBuf)[0] : EOF; if (theChar != EOF) - sb_ReadSkipChar(theStrOrFile->theStr); + sb_ReadSkipChar(theStrOrFile->theStrBuf); } return theChar; @@ -230,7 +262,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 +283,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 +312,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 +346,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 +495,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 +516,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 +550,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; @@ -565,10 +597,10 @@ char *sf_fgets(char *str, int count, strOrFileP theStrOrFile) return NULL; } } - else if (theStrOrFile->theStr != NULL) + else if (theStrOrFile->theStrBuf != NULL) { - char *theStrBuf = sb_GetReadString(theStrOrFile->theStr); - if (theStrBuf != NULL && sb_GetUnreadCharCount(theStrOrFile->theStr) > 0) + char *theStrBuf = sb_GetReadString(theStrOrFile->theStrBuf); + if (theStrBuf != NULL && sb_GetUnreadCharCount(theStrOrFile->theStrBuf) > 0) { if (strncpy( str + charsToReadFromUngetBuf, @@ -576,7 +608,7 @@ char *sf_fgets(char *str, int count, strOrFileP theStrOrFile) charsToReadFromStrOrFile) == NULL) return NULL; - sb_SetReadPos(theStrOrFile->theStr, (sb_GetReadPos(theStrOrFile->theStr) + charsToReadFromStrOrFile)); + sb_SetReadPos(theStrOrFile->theStrBuf, (sb_GetReadPos(theStrOrFile->theStrBuf) + charsToReadFromStrOrFile)); } else if (charsToReadFromUngetBuf == 0) return NULL; @@ -603,7 +635,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; @@ -611,9 +643,9 @@ int sf_fputs(char const *strToWrite, strOrFileP theStrOrFile) // to an output stream if (theStrOrFile->pFile != NULL) outputLen = fputs(strToWrite, theStrOrFile->pFile); - else if (theStrOrFile->theStr != NULL) + else if (theStrOrFile->theStrBuf != NULL) { - if (sb_ConcatString(theStrOrFile->theStr, strToWrite) == OK) + if (sb_ConcatString(theStrOrFile->theStrBuf, strToWrite) == OK) outputLen = strlen(strToWrite); else outputLen = EOF; @@ -622,29 +654,6 @@ int sf_fputs(char const *strToWrite, strOrFileP theStrOrFile) return outputLen; } -/******************************************************************** - sf_takeTheStr() - - Returns the char * stored in the string-or-file container and NULLs - out the internal reference so ownership of the memory is transferred - to the caller. - - The pointer returned will be NULL if the strOrFile contains a FILE *. - ********************************************************************/ - -char *sf_takeTheStr(strOrFileP theStrOrFile) -{ - char *theStr = NULL; - if (theStrOrFile->theStr != NULL) - { - theStr = sb_TakeString(theStrOrFile->theStr); - sb_Free((&theStrOrFile->theStr)); - theStrOrFile->theStr = NULL; - } - - return theStr; -} - /******************************************************************** sf_closeFile() @@ -675,11 +684,7 @@ int sf_closeFile(strOrFileP theStrOrFile) return NOTOK; } - if (theStrOrFile->ungetBuf != NULL) - { - sp_Free(&(theStrOrFile->ungetBuf)); - } - theStrOrFile->ungetBuf = NULL; + sp_Free(&(theStrOrFile->ungetBuf)); return OK; } @@ -691,7 +696,7 @@ int sf_closeFile(strOrFileP theStrOrFile) If the strOrFile contains a string which has not yet been "taken" using sf_takeTheStr() (i.e. we want inputStr to be freed, and in an - error state we want to free outputStr), the string is freed, the + error state we want to free pOutputStr), the string is freed, the internal pointer is set to NULL, and theStrPos is set to 0. If the strOrFile contains a FILE pointer, we call sf_closeFile() @@ -707,9 +712,17 @@ void sf_Free(strOrFileP *pStrOrFile) { if (pStrOrFile != NULL && (*pStrOrFile) != NULL) { - if ((*pStrOrFile)->theStr != NULL) - sb_Free((&(*pStrOrFile)->theStr)); - (*pStrOrFile)->theStr = NULL; + if ((*pStrOrFile)->theStrBuf != NULL) + { + // TODO: (#56) If in an error state, just don't sb_TakeString() + // before freeing it + if ((*pStrOrFile)->pOutputStr != NULL) + { + (*((*pStrOrFile)->pOutputStr)) = sb_TakeString((*pStrOrFile)->theStrBuf); + (*pStrOrFile)->pOutputStr = NULL; + } + sb_Free(&((*pStrOrFile)->theStrBuf)); + } // TODO: (#56) if the strOrFile container's FILE pointer // corresponds to an output file, i.e. ioMode is 'w', diff --git a/planarity/c/graphLib/io/strOrFile.h b/planarity/c/graphLib/io/strOrFile.h index fb26eb5..8fa7794 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" @@ -21,17 +22,19 @@ extern "C" #define OUTPUT_CONTAINER 2 typedef struct { - strBufP theStr; + char **pOutputStr; + strBufP theStrBuf; FILE *pFile; int containerType; stackP ungetBuf; - } strOrFile; typedef strOrFile *strOrFileP; - strOrFileP sf_New(char const *theStr, char const *fileName, char const *ioMode); - int sf_ValidateStrOrFile(strOrFileP theStrOrFile); + strOrFileP sf_NewInputContainer(char const *const inputStr, char const *const fileName); + strOrFileP sf_NewOutputContainer(char **pOutputStr, char const *const fileName); + + bool sf_IsValidStrOrFile(strOrFileP theStrOrFile); char sf_getc(strOrFileP theStrOrFile); int sf_ReadSkipChar(strOrFileP theStrOrFile); @@ -48,8 +51,6 @@ extern "C" int sf_fputs(char const *strToWrite, strOrFileP theStrOrFile); - char *sf_takeTheStr(strOrFileP theStrOrFile); - int sf_closeFile(strOrFileP theStrOrFile); void sf_Free(strOrFileP *pStrOrFile); 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..0571d56 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. */ @@ -7,15 +7,13 @@ See the LICENSE.TXT file for licensing information. #include "graphDrawPlanar.h" #include "graphDrawPlanar.private.h" -extern int DRAWPLANAR_ID; - #include "../graph.h" #include #include #include -extern void _ClearVisitedFlags(graphP theGraph); +extern void _ClearAllVisitedFlagsInGraph(graphP theGraph); /* Private functions exported to system */ @@ -81,7 +79,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 +189,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 +210,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 +235,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; @@ -263,19 +261,19 @@ int _ComputeVertexPositionsInComponent(DrawPlanarContext *context, int root, int } // Push DFS children - e = gp_GetFirstArc(theEmbedding, W); - while (gp_IsArc(e)) + e = gp_GetFirstEdge(theEmbedding, W); + while (gp_IsEdge(theEmbedding, e)) { if (gp_GetEdgeType(theEmbedding, e) == EDGE_TYPE_CHILD) sp_Push(theEmbedding->theStack, gp_GetNeighbor(theEmbedding, e)); - e = gp_GetNextArc(theEmbedding, e); + e = gp_GetNextEdge(theEmbedding, e); } } // Use the order to assign vertical positions V = root; - while (gp_IsVertex(V)) + while (gp_IsVertex(theEmbedding, V)) { context->VI[V].pos = *pVertpos; (*pVertpos)++; @@ -297,21 +295,21 @@ void _LogEdgeList(graphP theEmbedding, listCollectionP edgeList, int edgeListHea { int eIndex = edgeListHead, e, eTwin; - gp_Log("EdgeList: [ "); + _gp_Log("EdgeList: [ "); - while (gp_IsArc(eIndex)) + while (gp_IsEdge(theGraph, eIndex)) { e = (eIndex << 1); - eTwin = gp_GetTwinArc(theEmbedding, e); + eTwin = gp_GetTwin(theEmbedding, e); - gp_Log(gp_MakeLogStr2("(%d, %d) ", - gp_GetVertexIndex(theEmbedding, gp_GetNeighbor(theEmbedding, e)), - gp_GetVertexIndex(theEmbedding, gp_GetNeighbor(theEmbedding, eTwin)))); + _gp_Log(_gp_MakeLogStr2("(%d, %d) ", + gp_GetIndex(theEmbedding, gp_GetNeighbor(theEmbedding, e)), + gp_GetIndex(theEmbedding, gp_GetNeighbor(theEmbedding, eTwin)))); eIndex = LCGetNext(edgeList, edgeListHead, eIndex); } - gp_LogLine("]"); + _gp_LogLine("]"); } #endif @@ -341,16 +339,16 @@ int _ComputeEdgePositions(DrawPlanarContext *context) int edgeListHead, edgeListInsertPoint; int e, eTwin, eCur, v, vpos, epos, eIndex; - gp_LogLine("\ngraphDrawPlanar.c/_ComputeEdgePositions() start"); + _gp_LogLine("\ngraphDrawPlanar.c/_ComputeEdgePositions() start"); // Sort the vertices by vertical position (in linear time) - if ((vertexOrder = (int *)malloc(theEmbedding->N * sizeof(int))) == NULL) + if ((vertexOrder = (int *)malloc(gp_GetN(theEmbedding) * sizeof(int))) == NULL) { 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. @@ -360,9 +358,11 @@ int _ComputeEdgePositions(DrawPlanarContext *context) // represented by a pair of adjacent edge records // at index 2X. - if (theEmbedding->M > 0 && (edgeList = LCNew(gp_GetFirstEdge(theEmbedding) / 2 + theEmbedding->M)) == NULL) + if (gp_GetM(theEmbedding) > 0 && (edgeList = LCNew(gp_EdgeArrayStart(theEmbedding) / 2 + gp_GetM(theEmbedding))) == NULL) { free(vertexOrder); + vertexOrder = NULL; + return NOTOK; } @@ -370,7 +370,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 @@ -379,12 +379,12 @@ int _ComputeEdgePositions(DrawPlanarContext *context) // the vertex order is recorded as the "generator edge", or the edge of // first discovery of that higher numbered vertex, unless the vertex already has // a recorded generator edge - for (vpos = 0; vpos < theEmbedding->N; vpos++) + for (vpos = 0; vpos < gp_GetN(theEmbedding); vpos++) { // 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_LogLine(_gp_MakeLogStr3("Processing vertex %d with DFI=%d at position=%d", + 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 @@ -401,20 +401,20 @@ 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)) + e = gp_GetFirstEdge(theEmbedding, v); + while (gp_IsEdge(theEmbedding, e)) { - eIndex = (e >> 1); // div by 2 since each edge is a pair of arcs + eIndex = (e >> 1); // div by 2 since each edge is a pair of edge records 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_LogLine(_gp_MakeLogStr2("Append generator edge (%d, %d) to edgeList", + 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); // Go to the next node of the root's adj list - e = gp_GetNextArc(theEmbedding, e); + e = gp_GetNextEdge(theEmbedding, e); } } @@ -424,9 +424,9 @@ 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_IsNotEdge(theEmbedding, eTwin)) return NOTOK; - e = gp_GetTwinArc(theEmbedding, eTwin); + e = gp_GetTwin(theEmbedding, eTwin); // Traverse the edges of the vertex, starting // from the generator edge and going counterclockwise... @@ -434,7 +434,7 @@ int _ComputeEdgePositions(DrawPlanarContext *context) eIndex = (e >> 1); edgeListInsertPoint = eIndex; - eCur = gp_GetNextArcCircular(theEmbedding, e); + eCur = gp_GetNextEdgeCircular(theEmbedding, e); while (eCur != e) { // If the neighboring vertex's position is greater @@ -446,28 +446,28 @@ int _ComputeEdgePositions(DrawPlanarContext *context) eIndex = eCur >> 1; 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_LogLine(_gp_MakeLogStr4("Insert (%d, %d) after (%d, %d)", + gp_GetIndex(theEmbedding, v), + gp_GetIndex(theEmbedding, gp_GetNeighbor(theEmbedding, eCur)), + gp_GetIndex(theEmbedding, gp_GetNeighbor(theEmbedding, gp_GetTwin(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_IsNotEdge(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_LogLine(_gp_MakeLogStr2("Generator edge (%d, %d)", + gp_GetIndex(theEmbedding, gp_GetNeighbor(theEmbedding, gp_GetTwin(theEmbedding, e))), + gp_GetIndex(theEmbedding, gp_GetNeighbor(theEmbedding, eCur)))); } } // Go to the next node in v's adjacency list - eCur = gp_GetNextArcCircular(theEmbedding, eCur); + eCur = gp_GetNextEdgeCircular(theEmbedding, eCur); } } @@ -479,23 +479,27 @@ 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_IsEdge(theEmbedding, e)) { - e = (eIndex << 1); - eTwin = gp_GetTwinArc(theEmbedding, e); + eTwin = gp_GetTwin(theEmbedding, e); context->E[e].pos = context->E[eTwin].pos = epos; 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"); + _gp_LogLine("graphDrawPlanar.c/_ComputeEdgePositions() end\n"); return OK; } @@ -511,24 +515,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; + min = gp_GetM(theEmbedding) + 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)) + e = gp_GetFirstEdge(theEmbedding, v); + if (gp_IsNotEdge(theEmbedding, e)) { min = max = 0; } else { - while (gp_IsArc(e)) + while (gp_IsEdge(theEmbedding, e)) { if (min > context->E[e].pos) min = context->E[e].pos; @@ -536,7 +540,7 @@ int _ComputeVertexRanges(DrawPlanarContext *context) if (max < context->E[e].pos) max = context->E[e].pos; - e = gp_GetNextArc(theEmbedding, e); + e = gp_GetNextEdge(theEmbedding, e); } } @@ -564,10 +568,10 @@ int _ComputeEdgeRanges(DrawPlanarContext *context) if (sp_NonEmpty(theEmbedding->edgeHoles)) return NOTOK; - EsizeOccupied = gp_EdgeInUseIndexBound(theEmbedding); - for (e = gp_GetFirstEdge(theEmbedding); e < EsizeOccupied; e += 2) + EsizeOccupied = gp_EdgeInUseArraySize(theEmbedding); + for (e = gp_EdgeArrayStart(theEmbedding); e < EsizeOccupied; e += 2) { - eTwin = gp_GetTwinArc(theEmbedding, e); + eTwin = gp_GetTwin(theEmbedding, e); v1 = gp_GetNeighbor(theEmbedding, e); v2 = gp_GetNeighbor(theEmbedding, eTwin); @@ -635,9 +639,9 @@ void _CollectDrawingData(DrawPlanarContext *context, int RootVertex, int W, int graphP theEmbedding = context->theGraph; int K, Parent, BicompRoot, DFSChild, direction, descendant; - gp_LogLine("\ngraphDrawPlanar.c/_CollectDrawingData() start"); - gp_LogLine(gp_MakeLogStr3("_CollectDrawingData(RootVertex=%d, W=%d, W_in=%d)", - RootVertex, W, WPrevLink)); + _gp_LogLine("\ngraphDrawPlanar.c/_CollectDrawingData() start"); + _gp_LogLine(_gp_MakeLogStr3("_CollectDrawingData(RootVertex=%d, W=%d, W_in=%d)", + RootVertex, W, WPrevLink)); /* Process all of the merge points to set their drawing flags. */ @@ -647,16 +651,13 @@ 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. This vertex is guaranteed to be found in one step due to external face 'short-circuiting' that was done in - step 'Parent' of the planarity algorithm. - We pass theEmbedding->N for the second parameter because - of this; we use this function to signify need of extFace - links in the other implementation.*/ + step 'Parent' of the planarity algorithm. */ direction = theEmbedding->theStack->S[K + 3]; descendant = _GetNextExternalFaceVertex(theEmbedding, BicompRoot, &direction); @@ -673,11 +674,11 @@ void _CollectDrawingData(DrawPlanarContext *context, int RootVertex, int W, int direction = theEmbedding->theStack->S[K + 1]; context->VI[Parent].tie[direction] = DFSChild; - gp_LogLine(gp_MakeLogStr5("V[Parent=%d]=.tie[%d] = V[descendant=%d].tie[%d] = (child=%d)", - Parent, direction, descendant, theEmbedding->theStack->S[K + 3], DFSChild)); + _gp_LogLine(_gp_MakeLogStr5("V[Parent=%d]=.tie[%d] = V[descendant=%d].tie[%d] = (child=%d)", + Parent, direction, descendant, theEmbedding->theStack->S[K + 3], DFSChild)); } - gp_LogLine("graphDrawPlanar.c/_CollectDrawingData() end\n"); + _gp_LogLine("graphDrawPlanar.c/_CollectDrawingData() end\n"); } /******************************************************************** @@ -719,14 +720,14 @@ int _BreakTie(DrawPlanarContext *context, int BicompRoot, int W, int WPrevLink) int WPredNextLink = 1 ^ WPrevLink, WPred = _GetNextExternalFaceVertex(theEmbedding, W, &WPredNextLink); - gp_LogLine("\ngraphDrawPlanar.c/::_BreakTie() start"); - gp_LogLine(gp_MakeLogStr4("_BreakTie(BicompRoot=%d, W=%d, W_in=%d) WPred=%d", - BicompRoot, W, WPrevLink, WPred)); + _gp_LogLine("\ngraphDrawPlanar.c/::_BreakTie() start"); + _gp_LogLine(_gp_MakeLogStr4("_BreakTie(BicompRoot=%d, W=%d, W_in=%d) WPred=%d", + BicompRoot, W, WPrevLink, WPred)); /* Ties happen only within a bicomp (i.e. between two non-root vertices) */ if (gp_IsVirtualVertex(theEmbedding, W) || gp_IsVirtualVertex(theEmbedding, WPred)) { - gp_LogLine("graphDrawPlanar.c/_BreakTie() end\n"); + _gp_LogLine("graphDrawPlanar.c/_BreakTie() end\n"); return OK; } @@ -737,26 +738,26 @@ 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)); + _gp_LogLine(_gp_MakeLogStr4("V[child=%d]=.ancestorChild = %d, V[child=%d]=.ancestor = %d", + DFSChild, context->VI[DFSChild].ancestorChild, DFSChild, context->VI[DFSChild].ancestor)); /* If W is the ancestor of WPred, then the DFSChild subtree contains WPred, and so must go between W and some ancestor. */ if (W < WPred) { context->VI[DFSChild].drawingFlag = DRAWINGFLAG_BETWEEN; - gp_LogLine(gp_MakeLogStr3("Child=%d is 'between' ancestorChild=%d and ancestor=%d", - DFSChild, context->VI[DFSChild].ancestorChild, context->VI[DFSChild].ancestor)); + _gp_LogLine(_gp_MakeLogStr3("Child=%d is 'between' ancestorChild=%d and ancestor=%d", + DFSChild, context->VI[DFSChild].ancestorChild, context->VI[DFSChild].ancestor)); } /* If W is the descendant, so we achieve the effect of putting WPred @@ -764,8 +765,8 @@ int _BreakTie(DrawPlanarContext *context, int BicompRoot, int W, int WPrevLink) else { context->VI[DFSChild].drawingFlag = DRAWINGFLAG_BEYOND; - gp_LogLine(gp_MakeLogStr3("Child=%d is 'beyond' ancestorChild=%d relative to ancestor=%d", - DFSChild, context->VI[DFSChild].ancestorChild, context->VI[DFSChild].ancestor)); + _gp_LogLine(_gp_MakeLogStr3("Child=%d is 'beyond' ancestorChild=%d relative to ancestor=%d", + DFSChild, context->VI[DFSChild].ancestorChild, context->VI[DFSChild].ancestor)); } /* The tie is resolved so clear the flags*/ @@ -773,7 +774,7 @@ int _BreakTie(DrawPlanarContext *context, int BicompRoot, int W, int WPrevLink) context->VI[WPred].tie[WPredNextLink] = NIL; } - gp_LogLine("graphDrawPlanar.c/_BreakTie() end\n"); + _gp_LogLine("graphDrawPlanar.c/_BreakTie() end\n"); return OK; } @@ -794,9 +795,9 @@ char *_RenderToString(graphP theEmbedding) if (context != NULL) { - int N = theEmbedding->N; - int M = theEmbedding->M; - int zeroBasedVertexOffset = (theEmbedding->internalFlags & FLAGS_ZEROBASEDIO) ? gp_GetFirstVertex(theEmbedding) : 0; + int N = gp_GetN(theEmbedding); + int M = gp_GetM(theEmbedding); + 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 +805,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 (gp_GetGraphFlags(theEmbedding) & FLAGS_ZEROBASEDIO) + zeroBasedVertexOffset = gp_GetFirstVertex(theGraph); + // Clear the space for (n = 0; n < N; n++) { @@ -824,7 +839,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,8 +865,8 @@ char *_RenderToString(graphP theEmbedding) } // Draw the edges - EsizeOccupied = gp_EdgeInUseIndexBound(theEmbedding); - for (e = gp_GetFirstEdge(theEmbedding); e < EsizeOccupied; e += 2) + EsizeOccupied = gp_EdgeInUseArraySize(theEmbedding); + for (e = gp_EdgeArrayStart(theEmbedding); e < EsizeOccupied; e += 2) { Pos = context->E[e].pos; for (eRange = context->E[e].start; eRange < context->E[e].end; eRange++) @@ -864,6 +879,7 @@ char *_RenderToString(graphP theEmbedding) // Null terminate string and return it visRep[(M + 1) * 2 * N] = '\0'; + return visRep; } @@ -902,6 +918,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 +936,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 +951,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,51 +969,51 @@ 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) + if (gp_GetM(theEmbedding) > 0) { if (context->VI[v].pos < 0 || - context->VI[v].pos >= theEmbedding->N || + context->VI[v].pos >= gp_GetN(theEmbedding) || context->VI[v].start < 0 || context->VI[v].start > context->VI[v].end || - context->VI[v].end >= theEmbedding->M) + context->VI[v].end >= gp_GetM(theEmbedding)) return NOTOK; } // 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); - for (e = gp_GetFirstEdge(theEmbedding); e < EsizeOccupied; e += 2) + EsizeOccupied = gp_EdgeInUseArraySize(theEmbedding); + for (e = gp_EdgeArrayStart(theEmbedding); e < EsizeOccupied; e += 2) { /* Each edge has two index locations in the edge information array */ - eTwin = gp_GetTwinArc(theEmbedding, e); + eTwin = gp_GetTwin(theEmbedding, e); if (context->E[e].pos != context->E[eTwin].pos || context->E[e].start != context->E[eTwin].start || context->E[e].end != context->E[eTwin].end || context->E[e].pos < 0 || - context->E[e].pos >= theEmbedding->M || + context->E[e].pos >= gp_GetM(theEmbedding) || context->E[e].start < 0 || context->E[e].start > context->E[e].end || - context->E[e].end >= theEmbedding->N) + context->E[e].end >= gp_GetN(theEmbedding)) return NOTOK; /* Get the recorded horizontal position of that edge, @@ -1004,8 +1025,8 @@ int _CheckVisibilityRepresentationIntegrity(DrawPlanarContext *context) can use the visited flags in the graph's edges to tell us whether the positions are being reused. */ - eposIndex = (epos << 1) + gp_GetFirstEdge(theEmbedding); - eTwin = gp_GetTwinArc(theEmbedding, eposIndex); + eposIndex = (epos << 1) + gp_EdgeArrayStart(theEmbedding); + eTwin = gp_GetTwin(theEmbedding, eposIndex); if (gp_GetEdgeVisited(theEmbedding, eposIndex) || gp_GetEdgeVisited(theEmbedding, eTwin)) return NOTOK; @@ -1017,12 +1038,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); - for (e = gp_GetFirstEdge(theEmbedding); e < EsizeOccupied; e += 2) + EsizeOccupied = gp_EdgeInUseArraySize(theEmbedding); + for (e = gp_EdgeArrayStart(theEmbedding); e < EsizeOccupied; e += 2) { - eTwin = gp_GetTwinArc(theEmbedding, e); + eTwin = gp_GetTwin(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..5d8a461 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. */ @@ -16,8 +16,8 @@ extern "C" #define DRAWPLANAR_NAME "DrawPlanar" - int gp_AttachDrawPlanar(graphP theGraph); - int gp_DetachDrawPlanar(graphP theGraph); + int gp_ExtendWith_DrawPlanar(graphP theGraph); + int gp_Detach_DrawPlanar(graphP theGraph); int gp_DrawPlanar_RenderToFile(graphP theEmbedding, char *theFileName); int gp_DrawPlanar_RenderToString(graphP theEmbedding, char **pRenditionString); diff --git a/planarity/c/graphLib/planarityRelated/graphDrawPlanar.private.h b/planarity/c/graphLib/planarityRelated/graphDrawPlanar.private.h index bdcd017..1b560b1 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. */ @@ -84,6 +84,8 @@ extern "C" } DrawPlanarContext; + extern int DRAWPLANAR_ID; + #ifdef __cplusplus } #endif diff --git a/planarity/c/graphLib/planarityRelated/graphDrawPlanar_Extensions.c b/planarity/c/graphLib/planarityRelated/graphDrawPlanar_Extensions.c index 0a87e7a..6943eb5 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); @@ -36,7 +36,7 @@ int _DrawPlanar_CheckObstructionIntegrity(graphP theGraph, graphP origGraph); int _DrawPlanar_InitGraph(graphP theGraph, int N); void _DrawPlanar_ReinitializeGraph(graphP theGraph); -int _DrawPlanar_EnsureArcCapacity(graphP theGraph, int requiredArcCapacity); +int _DrawPlanar_EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity); int _DrawPlanar_SortVertices(graphP theGraph); int _DrawPlanar_ReadPostprocess(graphP theGraph, char *extraData); @@ -56,7 +56,7 @@ void _DrawPlanar_FreeContext(void *); int DRAWPLANAR_ID = 0; /**************************************************************************** - gp_AttachDrawPlanar() + gp_ExtendWith_DrawPlanar() This function adjusts the graph data structure to attach the planar graph drawing feature. @@ -74,7 +74,7 @@ int DRAWPLANAR_ID = 0; Returns OK for success, NOTOK for failure. ****************************************************************************/ -int gp_AttachDrawPlanar(graphP theGraph) +int gp_ExtendWith_DrawPlanar(graphP theGraph) { DrawPlanarContext *context = NULL; @@ -112,7 +112,7 @@ int gp_AttachDrawPlanar(graphP theGraph) context->functions.fpInitGraph = _DrawPlanar_InitGraph; context->functions.fpReinitializeGraph = _DrawPlanar_ReinitializeGraph; - context->functions.fpEnsureArcCapacity = _DrawPlanar_EnsureArcCapacity; + context->functions.fpEnsureEdgeCapacity = _DrawPlanar_EnsureEdgeCapacity; context->functions.fpSortVertices = _DrawPlanar_SortVertices; context->functions.fpReadPostprocess = _DrawPlanar_ReadPostprocess; @@ -138,7 +138,7 @@ int gp_AttachDrawPlanar(graphP theGraph) // occur when N==0 in the case of gp_Read(). // But if a feature is attached after gp_InitGraph(), then N > 0 and so we // need to create and initialize all the custom data structures - if (theGraph->N > 0) + if (gp_GetN(theGraph) > 0) { if (_DrawPlanar_CreateStructures(context) != OK || _DrawPlanar_InitStructures(context) != OK) @@ -152,10 +152,10 @@ int gp_AttachDrawPlanar(graphP theGraph) } /******************************************************************** - gp_DetachDrawPlanar() + gp_Detach_DrawPlanar() ********************************************************************/ -int gp_DetachDrawPlanar(graphP theGraph) +int gp_Detach_DrawPlanar(graphP theGraph) { return gp_RemoveExtension(theGraph, DRAWPLANAR_ID); } @@ -198,10 +198,10 @@ 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) + if (gp_GetN(theGraph) <= 0) return NOTOK; if ((context->E = (DrawPlanar_EdgeRecP)malloc(Esize * sizeof(DrawPlanar_EdgeRec))) == NULL || @@ -222,20 +222,20 @@ 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; - if (theGraph->N <= 0) + if (gp_GetN(theGraph) <= 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); - for (e = gp_GetFirstEdge(theGraph); e < Esize; e++) + Esize = gp_EdgeArraySize(theGraph); + for (e = gp_EdgeArrayStart(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; @@ -306,8 +306,8 @@ int _DrawPlanar_InitGraph(graphP theGraph, int N) theGraph->N = N; theGraph->NV = N; - if (theGraph->arcCapacity == 0) - theGraph->arcCapacity = 2 * DEFAULT_EDGE_LIMIT * N; + if (theGraph->edgeCapacity == 0) + theGraph->edgeCapacity = DEFAULT_EDGE_LIMIT * N; if (_DrawPlanar_CreateStructures(context) != OK || _DrawPlanar_InitStructures(context) != OK) @@ -337,15 +337,16 @@ void _DrawPlanar_ReinitializeGraph(graphP theGraph) } /******************************************************************** - The current implementation does not support an increase of arc - (edge record) capacity once the extension is attached to the graph - data structure. This is only due to not being necessary to support. + The current implementation does not support an increase of edge + capacity once the extension is attached to the graph data structure. + This is only due to not being necessary to support. + For now, it is easy to ensure the correct capacity before attaching the extension, but support could be added later if there is some reason to do so. ********************************************************************/ -int _DrawPlanar_EnsureArcCapacity(graphP theGraph, int requiredArcCapacity) +int _DrawPlanar_EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity) { return NOTOK; } @@ -362,18 +363,18 @@ int _DrawPlanar_SortVertices(graphP theGraph) { // If this is a planarity-based algorithm to which graph drawing has been attached, // and if the embedding process has already been completed - if (theGraph->embedFlags == EMBEDFLAGS_DRAWPLANAR) + if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_DRAWPLANAR) { int v, vIndex; 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 +382,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 +404,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); } } } @@ -433,7 +434,7 @@ int _DrawPlanar_MergeBicomps(graphP theGraph, int v, int RootVertex, int W, int if (context != NULL) { - if (theGraph->embedFlags == EMBEDFLAGS_DRAWPLANAR) + if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_DRAWPLANAR) { _CollectDrawingData(context, RootVertex, W, WPrevLink); } @@ -456,7 +457,7 @@ int _DrawPlanar_HandleInactiveVertex(graphP theGraph, int BicompRoot, int *pW, i { int RetVal = context->functions.fpHandleInactiveVertex(theGraph, BicompRoot, pW, pWPrevLink); - if (theGraph->embedFlags == EMBEDFLAGS_DRAWPLANAR) + if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_DRAWPLANAR) { if (_BreakTie(context, BicompRoot, *pW, *pWPrevLink) != OK) return NOTOK; @@ -506,7 +507,7 @@ int _DrawPlanar_EmbedPostprocess(graphP theGraph, int v, int edgeEmbeddingResult { int RetVal = context->functions.fpEmbedPostprocess(theGraph, v, edgeEmbeddingResult); - if (theGraph->embedFlags == EMBEDFLAGS_DRAWPLANAR) + if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_DRAWPLANAR) { if (RetVal == OK) { @@ -576,7 +577,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,8 +588,8 @@ int _DrawPlanar_ReadPostprocess(graphP theGraph, char *extraData) } // Read the lines that contain edge information - EsizeOccupied = gp_EdgeInUseIndexBound(theGraph); - for (e = gp_GetFirstEdge(theGraph); e < EsizeOccupied; e++) + EsizeOccupied = gp_EdgeInUseArraySize(theGraph); + for (e = gp_EdgeArrayStart(theGraph); e < EsizeOccupied; e++) { sscanf(extraData, " %d%c %d %d %d", &tempInt, &tempChar, &context->E[e].pos, @@ -615,25 +616,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; + char *extraData = (char *)calloc((1 + gp_GetN(theGraph) + 2 * gp_GetM(theGraph) + 1) * maxLineSize, sizeof(char)); + 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 (gp_GetGraphFlags(theGraph) & FLAGS_ZEROBASEDIO) + { + zeroBasedVertexOffset = gp_GetFirstVertex(theGraph); + zeroBasedEdgeOffset = gp_EdgeArrayStart(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) + if (gp_GetN(theGraph) > 2000000000) { free(extraData); + extraData = NULL; + return NOTOK; } @@ -641,7 +664,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,8 +674,8 @@ int _DrawPlanar_WritePostprocess(graphP theGraph, char **pExtraData) extraDataPos += (int)strlen(line); } - EsizeOccupied = gp_EdgeInUseIndexBound(theGraph); - for (e = gp_GetFirstEdge(theGraph); e < EsizeOccupied; e++) + EsizeOccupied = gp_EdgeInUseArraySize(theGraph); + for (e = gp_EdgeArrayStart(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..c19106f 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. */ @@ -8,17 +8,26 @@ See the LICENSE.TXT file for licensing information. #include "../graph.h" +// Includes needed by _gp_EmbedFlagsValid(), until it become overloadable +#include "graphDrawPlanar.private.h" +#include "../homeomorphSearch/graphK23Search.private.h" +#include "../homeomorphSearch/graphK33Search.private.h" +#include "../homeomorphSearch/graphK4Search.private.h" + /* 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); + +extern int _gp_FindEdge(graphP theGraph, int u, int v); /* Private functions (some are exported to system only) */ +int _gp_EmbedFlagsValid(graphP theGraph, int embedFlags); int _EmbeddingInitialize(graphP theGraph); void _EmbedBackEdgeToDescendant(graphP theGraph, int RootSide, int RootVertex, int W, int WPrevLink); @@ -33,7 +42,7 @@ int _WalkDown(graphP theGraph, int v, int RootVertex); int _HandleInactiveVertex(graphP theGraph, int BicompRoot, int *pW, int *pWPrevLink); int _HandleBlockedBicomp(graphP theGraph, int v, int RootVertex, int R); -void _AdvanceFwdArcList(graphP theGraph, int v, int child, int nextChild); +void _AdvanceFwdEdgeList(graphP theGraph, int v, int child, int nextChild); int _EmbedPostprocess(graphP theGraph, int v, int edgeEmbeddingResult); int _OrientVerticesInEmbedding(graphP theGraph); @@ -55,7 +64,8 @@ int _JoinBicomps(graphP theGraph); return OK if the embedding was successfully created or no subgraph homeomorphic to a topological obstruction was found. - NOTOK on internal failure + NOTOK on failure (e.g., NULL graph, gp_Embed already called, + failure to attach algorithm extension) NONEMBEDDABLE if the embedding couldn't be created due to the existence of a subgraph homeomorphic to a @@ -84,14 +94,18 @@ int gp_Embed(graphP theGraph, int embedFlags) int v, e, c; int RetVal = OK; - // Basic parameter checks - if (theGraph == NULL) + // Basic safety checks + if (theGraph == NULL || embedFlags == 0 || gp_GetEmbedFlags(theGraph) != 0) return NOTOK; // Preprocessing + if (!_gp_EmbedFlagsValid(theGraph, embedFlags)) + return NOTOK; + theGraph->embedFlags = embedFlags; - // Allow extension algorithms to postprocess the DFS + // Initialize embedding data structures and allow extension algorithms + // that overload the function to postprocess the DFS if (theGraph->functions.fpEmbeddingInitialize(theGraph) != OK) return NOTOK; @@ -102,13 +116,13 @@ 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)) + e = gp_GetVertexFwdEdgeList(theGraph, v); + while (gp_IsEdge(theGraph, e)) { theGraph->functions.fpWalkUp(theGraph, v, e); - e = gp_GetNextArc(theGraph, e); - if (e == gp_GetVertexFwdArcList(theGraph, v)) + e = gp_GetNextEdge(theGraph, e); + if (e == gp_GetVertexFwdEdgeList(theGraph, v)) e = NIL; } gp_SetVertexPertinentRootsList(theGraph, v, NIL); @@ -116,11 +130,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) @@ -141,6 +155,64 @@ int gp_Embed(graphP theGraph, int embedFlags) return theGraph->functions.fpEmbedPostprocess(theGraph, v, RetVal); } +/******************************************************************** + _gp_EmbedFlagsValid() + + Returns TRUE the theGraph has been extended to a subclass that + supports the value in embedFlags and if embedFlags has a value + that is supportable by extensions available in the graphLib. + Returns FALSE otherwise. + + NOTE: Returns TRUE/FALSE rather than OK/NOTOK so the caller can + decide if it is an error or if they want to try to take + corrective actions on theGraph. + ********************************************************************/ + +int _gp_EmbedFlagsValid(graphP theGraph, int embedFlags) +{ + // Currently, planar and outerplanar graph embedding and obstruction + // isolation do not require an explicit extension. + if (embedFlags == EMBEDFLAGS_PLANAR || embedFlags == EMBEDFLAGS_OUTERPLANAR) + return TRUE; + + // For other algorithms that are supported by explicit extensions, we + // ensure they are attached (the attach methods exit early if it has + // already been done). + else if (embedFlags == EMBEDFLAGS_DRAWPLANAR) + { + DrawPlanarContext *context = NULL; + gp_FindExtension(theGraph, DRAWPLANAR_ID, (void *)&context); + if (context != NULL) + return TRUE; + } + else if (embedFlags == EMBEDFLAGS_SEARCHFORK23) + { + K23SearchContext *context = NULL; + gp_FindExtension(theGraph, K23SEARCH_ID, (void *)&context); + if (context != NULL) + return TRUE; + } + else if (embedFlags == EMBEDFLAGS_SEARCHFORK33) + { + K33SearchContext *context = NULL; + gp_FindExtension(theGraph, K33SEARCH_ID, (void *)&context); + if (context != NULL) + return TRUE; + } + else if (embedFlags == EMBEDFLAGS_SEARCHFORK4) + { + K4SearchContext *context = NULL; + gp_FindExtension(theGraph, K4SEARCH_ID, (void *)&context); + if (context != NULL) + return TRUE; + } + + // The embedFlags are not valid if they indicate an algorithm for + // which there is no graph extension, or even if they indicate + // multiple supported algorithm extensions at the same time. + return FALSE; +} + /******************************************************************** _EmbeddingInitialize() @@ -148,7 +220,7 @@ int gp_Embed(graphP theGraph, int embedFlags) (1) Assign depth first index (DFI) and DFS parentvalues to vertices (2) Assign DFS edge types (3) Create a sortedDFSChildList for each vertex, sorted by child DFI - (4) Create a sortedFwdArcList for each vertex, sorted by descendant DFI + (4) Create a sorted fwdEdgeList for each vertex, sorted by descendant DFI (5) Assign leastAncestor values to vertices (6) Sort the vertices by their DFIs (7) Initialize for pertinence and future pertinence management @@ -170,31 +242,32 @@ int _EmbeddingInitialize(graphP theGraph) platform_GetTime(start); #endif - gp_LogLine("graphEmbed.c/_EmbeddingInitialize() start\n"); + _gp_LogLine("graphEmbed.c/_EmbeddingInitialize() start\n"); theStack = theGraph->theStack; // At most we push 2 integers per edge from a vertex to each *unvisited* neighbor - // plus one additional integer to help detect post-processing. This is less - // than the 2 * arcCapacity integer stack that is already in theGraph structure, - // so we make sure it's still there and cleared, then we clear all vertex - // visited flags in prep for the Depth first search operation. */ + // plus one extra (NIL, NIL) at the beginning to represent arriving at a DFS tree + // root. We ensure that theGraph's stack has this capacity and, if so, we clear + // the stack for use in the depth-first search (DFS). - if (sp_GetCapacity(theStack) < 2 * gp_GetArcCapacity(theGraph)) + if (sp_GetCapacity(theStack) < 2 * 2 * gp_GetM(theGraph) + 2) return NOTOK; sp_ClearStack(theStack); - _ClearVertexVisitedFlags(theGraph, FALSE); + // We clear the visited flags of vertices because they are used to determine + // which vertices have already been visited as the DFS traverses theGraph. + _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,47 +279,47 @@ 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)); + _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_IsEdge(theGraph, e)) { // (2) Set the edge type values for tree edges gp_SetEdgeType(theGraph, e, EDGE_TYPE_CHILD); - gp_SetEdgeType(theGraph, gp_GetTwinArc(theGraph, e), EDGE_TYPE_PARENT); + gp_SetEdgeType(theGraph, gp_GetTwin(theGraph, e), EDGE_TYPE_PARENT); // (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, + // (8) Record e as the first and last edges of the virtual vertex R, // a root copy of uparent uniquely associated with child u - R = gp_GetRootFromDFSChild(theGraph, gp_GetVertexIndex(theGraph, u)); - gp_SetFirstArc(theGraph, R, e); - gp_SetLastArc(theGraph, R, e); + R = gp_GetBicompRootFromDFSChild(theGraph, gp_GetIndex(theGraph, u)); + gp_SetFirstEdge(theGraph, R, e); + gp_SetLastEdge(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)) + // tree edges to children or forward edge records to descendants + // Edges that are not pushed are either marked as back edges or as + // a tree edge if it leads back to the immediate DFS parent. + e = gp_GetFirstEdge(theGraph, u); + while (gp_IsEdge(theGraph, e)) { - if (!gp_GetVertexVisited(theGraph, gp_GetNeighbor(theGraph, e))) + if (!gp_GetVisited(theGraph, gp_GetNeighbor(theGraph, e))) { sp_Push2(theStack, u, e); } @@ -254,52 +327,52 @@ int _EmbeddingInitialize(graphP theGraph) { // (2) Set the edge type values for back edges gp_SetEdgeType(theGraph, e, EDGE_TYPE_BACK); - eTwin = gp_GetTwinArc(theGraph, e); + eTwin = gp_GetTwin(theGraph, e); gp_SetEdgeType(theGraph, eTwin, EDGE_TYPE_FORWARD); - // (4) Move the twin of back edge record e to the sortedFwdArcList of the ancestor + // (4) Move the twin of back edge record e to the sorted FwdEdgeList of the ancestor uneighbor = gp_GetNeighbor(theGraph, e); - ePrev = gp_GetPrevArc(theGraph, eTwin); - eNext = gp_GetNextArc(theGraph, eTwin); + ePrev = gp_GetPrevEdge(theGraph, eTwin); + eNext = gp_GetNextEdge(theGraph, eTwin); - if (gp_IsArc(ePrev)) - gp_SetNextArc(theGraph, ePrev, eNext); + if (gp_IsEdge(theGraph, ePrev)) + gp_SetNextEdge(theGraph, ePrev, eNext); else - gp_SetFirstArc(theGraph, uneighbor, eNext); - if (gp_IsArc(eNext)) - gp_SetPrevArc(theGraph, eNext, ePrev); + gp_SetFirstEdge(theGraph, uneighbor, eNext); + if (gp_IsEdge(theGraph, eNext)) + gp_SetPrevEdge(theGraph, eNext, ePrev); else - gp_SetLastArc(theGraph, uneighbor, ePrev); + gp_SetLastEdge(theGraph, uneighbor, ePrev); - if (gp_IsArc(f = gp_GetVertexFwdArcList(theGraph, uneighbor))) + if (gp_IsEdge(theGraph, f = gp_GetVertexFwdEdgeList(theGraph, uneighbor))) { - ePrev = gp_GetPrevArc(theGraph, f); - gp_SetPrevArc(theGraph, eTwin, ePrev); - gp_SetNextArc(theGraph, eTwin, f); - gp_SetPrevArc(theGraph, f, eTwin); - gp_SetNextArc(theGraph, ePrev, eTwin); + ePrev = gp_GetPrevEdge(theGraph, f); + gp_SetPrevEdge(theGraph, eTwin, ePrev); + gp_SetNextEdge(theGraph, eTwin, f); + gp_SetPrevEdge(theGraph, f, eTwin); + gp_SetNextEdge(theGraph, ePrev, eTwin); } else { - gp_SetVertexFwdArcList(theGraph, uneighbor, eTwin); - gp_SetPrevArc(theGraph, eTwin, eTwin); - gp_SetNextArc(theGraph, eTwin, eTwin); + gp_SetVertexFwdEdgeList(theGraph, uneighbor, eTwin); + gp_SetPrevEdge(theGraph, eTwin, eTwin); + gp_SetNextEdge(theGraph, eTwin, eTwin); } // (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); } - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } } } } // The graph is now DFS numbered - theGraph->internalFlags |= FLAGS_DFSNUMBERED; + theGraph->graphFlags |= FLAGS_DFSNUMBERED; // (6) Now that all vertices have a DFI in the index member, we can sort vertices if (gp_SortVertices(theGraph) != OK) @@ -309,13 +382,13 @@ int _EmbeddingInitialize(graphP theGraph) for (v = gp_GetLastVertex(theGraph); gp_VertexInRangeDescending(theGraph, v); v--) { // (7) Initialize for pertinence management - gp_SetVertexVisitedInfo(theGraph, v, theGraph->N); + gp_SetVertexVisitedInfo(theGraph, v, gp_GetN(theGraph)); // (7) Initialize for future pertinence management 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); @@ -329,27 +402,27 @@ int _EmbeddingInitialize(graphP theGraph) // in the singleton bicomp with v is at location v + N in the vertex array. if (gp_IsDFSTreeRoot(theGraph, v)) { - gp_SetFirstArc(theGraph, v, NIL); - gp_SetLastArc(theGraph, v, NIL); + gp_SetFirstEdge(theGraph, v, NIL); + gp_SetLastEdge(theGraph, v, NIL); } 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); - gp_SetPrevArc(theGraph, e, NIL); - gp_SetNextArc(theGraph, e, NIL); + e = gp_GetFirstEdge(theGraph, R); + gp_SetPrevEdge(theGraph, e, NIL); + gp_SetNextEdge(theGraph, e, NIL); // Reset the twin's neighbor value to point to the virtual vertex - eTwin = gp_GetTwinArc(theGraph, e); + eTwin = gp_GetTwin(theGraph, e); gp_SetNeighbor(theGraph, eTwin, R); // Make its twin the only edge in the child's adjacency list - gp_SetFirstArc(theGraph, v, eTwin); - gp_SetLastArc(theGraph, v, eTwin); - gp_SetPrevArc(theGraph, eTwin, NIL); - gp_SetNextArc(theGraph, eTwin, NIL); + gp_SetFirstEdge(theGraph, v, eTwin); + gp_SetLastEdge(theGraph, v, eTwin); + gp_SetPrevEdge(theGraph, eTwin, NIL); + gp_SetNextEdge(theGraph, eTwin, NIL); // Set up the external face management data structure to match gp_SetExtFaceVertex(theGraph, R, 0, v); @@ -359,7 +432,7 @@ int _EmbeddingInitialize(graphP theGraph) } } - gp_LogLine("graphEmbed.c/_EmbeddingInitialize() end\n"); + _gp_LogLine("graphEmbed.c/_EmbeddingInitialize() end\n"); #ifdef PROFILE platform_GetTime(end); @@ -379,48 +452,48 @@ int _EmbeddingInitialize(graphP theGraph) void _EmbedBackEdgeToDescendant(graphP theGraph, int RootSide, int RootVertex, int W, int WPrevLink) { - int fwdArc, backArc, parentCopy; + int fwdEdgeRec, backEdgeRec, parentCopy; - /* We get the two edge records of the back edge 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. */ + /* 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 edge record + that goes from the root's parent copy, v, to the descendant W. */ - fwdArc = gp_GetVertexPertinentEdge(theGraph, W); - backArc = gp_GetTwinArc(theGraph, fwdArc); + fwdEdgeRec = gp_GetVertexPertinentEdge(theGraph, W); + backEdgeRec = gp_GetTwin(theGraph, fwdEdgeRec); - /* The forward arc is removed from the fwdArcList of the root's parent copy. */ + /* The forward edge record is removed from the fwdEdgeList 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)); + _gp_LogLine(_gp_MakeLogStr5("graphEmbed.c/_EmbedBackEdgeToDescendant() V=%d, R=%d, R_out=%d, W=%d, W_in=%d", + parentCopy, RootVertex, RootSide, W, WPrevLink)); - if (gp_GetVertexFwdArcList(theGraph, parentCopy) == fwdArc) + if (gp_GetVertexFwdEdgeList(theGraph, parentCopy) == fwdEdgeRec) { - gp_SetVertexFwdArcList(theGraph, parentCopy, gp_GetNextArc(theGraph, fwdArc)); - if (gp_GetVertexFwdArcList(theGraph, parentCopy) == fwdArc) - gp_SetVertexFwdArcList(theGraph, parentCopy, NIL); + gp_SetVertexFwdEdgeList(theGraph, parentCopy, gp_GetNextEdge(theGraph, fwdEdgeRec)); + if (gp_GetVertexFwdEdgeList(theGraph, parentCopy) == fwdEdgeRec) + gp_SetVertexFwdEdgeList(theGraph, parentCopy, NIL); } - gp_SetNextArc(theGraph, gp_GetPrevArc(theGraph, fwdArc), gp_GetNextArc(theGraph, fwdArc)); - gp_SetPrevArc(theGraph, gp_GetNextArc(theGraph, fwdArc), gp_GetPrevArc(theGraph, fwdArc)); + gp_SetNextEdge(theGraph, gp_GetPrevEdge(theGraph, fwdEdgeRec), gp_GetNextEdge(theGraph, fwdEdgeRec)); + gp_SetPrevEdge(theGraph, gp_GetNextEdge(theGraph, fwdEdgeRec), gp_GetPrevEdge(theGraph, fwdEdgeRec)); - // The forward arc is added to the adjacency list of the RootVertex. + // The forward edge record is added to the adjacency list of the RootVertex. // Note that we're guaranteed that the RootVertex adjacency list is non-empty, // so tests for NIL are not needed - gp_SetAdjacentArc(theGraph, fwdArc, 1 ^ RootSide, NIL); - gp_SetAdjacentArc(theGraph, fwdArc, RootSide, gp_GetArc(theGraph, RootVertex, RootSide)); - gp_SetAdjacentArc(theGraph, gp_GetArc(theGraph, RootVertex, RootSide), 1 ^ RootSide, fwdArc); - gp_SetArc(theGraph, RootVertex, RootSide, fwdArc); + gp_SetAdjacentEdge(theGraph, fwdEdgeRec, 1 ^ RootSide, NIL); + gp_SetAdjacentEdge(theGraph, fwdEdgeRec, RootSide, gp_GetEdgeByLink(theGraph, RootVertex, RootSide)); + gp_SetAdjacentEdge(theGraph, gp_GetEdgeByLink(theGraph, RootVertex, RootSide), 1 ^ RootSide, fwdEdgeRec); + gp_SetEdgeByLink(theGraph, RootVertex, RootSide, fwdEdgeRec); - // The back arc is added to the adjacency list of W. + // The back edge record is added to the adjacency list of W. // The adjacency list of W is also guaranteed non-empty - gp_SetAdjacentArc(theGraph, backArc, 1 ^ WPrevLink, NIL); - gp_SetAdjacentArc(theGraph, backArc, WPrevLink, gp_GetArc(theGraph, W, WPrevLink)); - gp_SetAdjacentArc(theGraph, gp_GetArc(theGraph, W, WPrevLink), 1 ^ WPrevLink, backArc); - gp_SetArc(theGraph, W, WPrevLink, backArc); + gp_SetAdjacentEdge(theGraph, backEdgeRec, 1 ^ WPrevLink, NIL); + gp_SetAdjacentEdge(theGraph, backEdgeRec, WPrevLink, gp_GetEdgeByLink(theGraph, W, WPrevLink)); + gp_SetAdjacentEdge(theGraph, gp_GetEdgeByLink(theGraph, W, WPrevLink), 1 ^ WPrevLink, backEdgeRec); + gp_SetEdgeByLink(theGraph, W, WPrevLink, backEdgeRec); - gp_SetNeighbor(theGraph, backArc, RootVertex); + gp_SetNeighbor(theGraph, backEdgeRec, RootVertex); /* Link the two endpoint vertices together on the external face */ @@ -439,23 +512,23 @@ void _InvertVertex(graphP theGraph, int W) { int e, temp; - gp_LogLine(gp_MakeLogStr1("graphEmbed.c/_InvertVertex() W=%d", W)); + _gp_LogLine(_gp_MakeLogStr1("graphEmbed.c/_InvertVertex() W=%d", W)); - // Swap the links in all the arcs of the adjacency list - e = gp_GetFirstArc(theGraph, W); - while (gp_IsArc(e)) + // Swap the links in all of the edge records of the adjacency list + e = gp_GetFirstEdge(theGraph, W); + while (gp_IsEdge(theGraph, e)) { - temp = gp_GetNextArc(theGraph, e); - gp_SetNextArc(theGraph, e, gp_GetPrevArc(theGraph, e)); - gp_SetPrevArc(theGraph, e, temp); + temp = gp_GetNextEdge(theGraph, e); + gp_SetNextEdge(theGraph, e, gp_GetPrevEdge(theGraph, e)); + gp_SetPrevEdge(theGraph, e, temp); e = temp; } // Swap the first/last edge record indicators in the vertex - temp = gp_GetFirstArc(theGraph, W); - gp_SetFirstArc(theGraph, W, gp_GetLastArc(theGraph, W)); - gp_SetLastArc(theGraph, W, temp); + temp = gp_GetFirstEdge(theGraph, W); + gp_SetFirstEdge(theGraph, W, gp_GetLastEdge(theGraph, W)); + gp_SetLastEdge(theGraph, W, temp); // Swap the first/last external face indicators in the vertex temp = gp_GetExtFaceVertex(theGraph, W, 0); @@ -492,55 +565,55 @@ void _MergeVertex(graphP theGraph, int W, int WPrevLink, int R) { int e, eTwin, e_w, e_r, e_ext; - gp_LogLine(gp_MakeLogStr4("graphEmbed.c/_MergeVertex() W=%d, W_in=%d, R=%d, R_out=%d", - W, WPrevLink, R, 1 ^ WPrevLink)); + _gp_LogLine(_gp_MakeLogStr4("graphEmbed.c/_MergeVertex() W=%d, W_in=%d, R=%d, R_out=%d", + W, WPrevLink, R, 1 ^ WPrevLink)); - // 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)) + // All edge records leading _into_ R _from_ its neighbors must be changed + // to say that they are leading into W. + e = gp_GetFirstEdge(theGraph, R); + while (gp_IsEdge(theGraph, e)) { - eTwin = gp_GetTwinArc(theGraph, e); + eTwin = gp_GetTwin(theGraph, e); gp_GetNeighbor(theGraph, eTwin) = W; - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } - // Obtain the edge records involved in the list union - e_w = gp_GetArc(theGraph, W, WPrevLink); - e_r = gp_GetArc(theGraph, R, 1 ^ WPrevLink); - e_ext = gp_GetArc(theGraph, R, WPrevLink); + // Obtain the edge records that will be involved in the adjacency list union + e_w = gp_GetEdgeByLink(theGraph, W, WPrevLink); + e_r = gp_GetEdgeByLink(theGraph, R, 1 ^ WPrevLink); + e_ext = gp_GetEdgeByLink(theGraph, R, WPrevLink); - // If W has any edges, then join the list with that of R - if (gp_IsArc(e_w)) + // If W has any edges, then join its adjacency list with that of R + if (gp_IsEdge(theGraph, e_w)) { - // The WPrevLink arc of W is e_w, so the 1^WPrevLink arc in e_w leads back to W. + // The WPrevLink edge of W is e_w, so the 1^WPrevLink edge 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 // opposing link, which is WPrevLink // Note that the adjacency lists of W and R are guaranteed non-empty, which is // why these linkages can be made without NIL tests. - gp_SetAdjacentArc(theGraph, e_w, 1 ^ WPrevLink, e_r); - gp_SetAdjacentArc(theGraph, e_r, WPrevLink, e_w); + gp_SetAdjacentEdge(theGraph, e_w, 1 ^ WPrevLink, e_r); + gp_SetAdjacentEdge(theGraph, e_r, WPrevLink, e_w); - // Cross-link W's WPrevLink arc and the 1^WPrevLink arc in e_ext - gp_SetArc(theGraph, W, WPrevLink, e_ext); - gp_SetAdjacentArc(theGraph, e_ext, 1 ^ WPrevLink, NIL); + // Cross-link W's WPrevLink edge record and the 1^WPrevLink edge record in e_ext + gp_SetEdgeByLink(theGraph, W, WPrevLink, e_ext); + gp_SetAdjacentEdge(theGraph, e_ext, 1 ^ WPrevLink, NIL); } - // Otherwise, W just receives R's list. This happens, for example, on a - // DFS tree root vertex during JoinBicomps() + // Otherwise, W just receives R's adjacency list. This can happen, for example, on + // a DFS tree root vertex during JoinBicomps() else { - // Cross-link W's 1^WPrevLink arc and the WPrevLink arc in e_r - gp_SetArc(theGraph, W, 1 ^ WPrevLink, e_r); - gp_SetAdjacentArc(theGraph, e_r, WPrevLink, NIL); + // Cross-link W's 1^WPrevLink edge record and the WPrevLink edge record in e_r + gp_SetEdgeByLink(theGraph, W, 1 ^ WPrevLink, e_r); + gp_SetAdjacentEdge(theGraph, e_r, WPrevLink, NIL); - // Cross-link W's WPrevLink arc and the 1^WPrevLink arc in e_ext - gp_SetArc(theGraph, W, WPrevLink, e_ext); - gp_SetAdjacentArc(theGraph, e_ext, 1 ^ WPrevLink, NIL); + // Cross-link W's WPrevLink edge record and the 1^WPrevLink edge record in e_ext + gp_SetEdgeByLink(theGraph, W, WPrevLink, e_ext); + gp_SetAdjacentEdge(theGraph, e_ext, 1 ^ WPrevLink, NIL); } // Erase the entries in R, which is a root copy that is no longer needed - _InitVertexRec(theGraph, R); + _InitAnyTypeVertexRec(theGraph, R); } /******************************************************************** @@ -595,11 +668,11 @@ int _MergeBicomps(graphP theGraph, int v, int RootVertex, int W, int WPrevLink) { Rout = 1 ^ ZPrevLink; - if (gp_GetFirstArc(theGraph, R) != gp_GetLastArc(theGraph, R)) + if (gp_GetFirstEdge(theGraph, R) != gp_GetLastEdge(theGraph, R)) _InvertVertex(theGraph, R); - e = gp_GetFirstArc(theGraph, R); - while (gp_IsArc(e)) + e = gp_GetFirstEdge(theGraph, R); + while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) { @@ -614,7 +687,7 @@ int _MergeBicomps(graphP theGraph, int v, int RootVertex, int W, int WPrevLink) break; } - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } } @@ -624,7 +697,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))); @@ -640,7 +713,8 @@ int _MergeBicomps(graphP theGraph, int v, int RootVertex, int W, int WPrevLink) /******************************************************************** _WalkUp() v is the vertex currently being embedded - e is the forward arc of the back edge to a descendant W of v + e is the forward edge record of the "back" edge between v and + a descendant W of v The Walkup establishes pertinence for step v. It marks W with e as a way of indicating it is pertinent because it should be made @@ -738,7 +812,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 +825,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 +842,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); @@ -782,7 +858,7 @@ void _WalkUp(graphP theGraph, int v, int e) vertices. The root vertex is a root copy of v, the vertex currently being processed. The Walkup previously marked all vertices adjacent to v by setting their - pertinentEdge members with the forward arcs of the back edges to embed. + pertinentEdge members with the forward edge records of the back edges to embed. Two Walkdown traversals are performed to visit all reachable vertices along each of the external face paths emanating from RootVertex (a root copy of vertex v) to embed back edges to descendants of vertex v that @@ -845,7 +921,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 +939,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_IsEdge(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. @@ -874,12 +950,14 @@ int _WalkDown(graphP theGraph, int v, int RootVertex) } theGraph->functions.fpEmbedBackEdgeToDescendant(theGraph, RootSide, RootVertex, W, WPrevLink); - // Clear W's pertinentEdge since the forward arc it contained has been embedded + // Clear W's pertinentEdge since the forward edge record it contained has been embedded gp_SetVertexPertinentEdge(theGraph, W, NIL); } // 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); @@ -940,7 +1018,7 @@ int _WalkDown(graphP theGraph, int v, int RootVertex) // (or if the algorithm is based on outerplanarity), then the vertex is // a stopping vertex for the Walkdown traversal. gp_UpdateVertexFuturePertinentChild(theGraph, W, v); - if (FUTUREPERTINENT(theGraph, W, v) || (theGraph->embedFlags & EMBEDFLAGS_OUTERPLANAR)) + if (FUTUREPERTINENT(theGraph, W, v) || (gp_GetEmbedFlags(theGraph) & EMBEDFLAGS_OUTERPLANAR)) { // Create an external face short-circuit between RootVertex and the stopping vertex W // so that future steps do not walk down a long path of inactive vertices between them. @@ -978,19 +1056,19 @@ 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_IsEdge(theGraph, e = gp_GetVertexFwdEdgeList(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)) + // We finish detecting that the Walkdown was blocked from embedding all forward edge records into + // the RootEdgeChild subtree if there the next child's DFI is greater than the descendant endpoint + // of the next forward edge record, or if there is no next child. + 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 + // If an extension to core planarity indicates it is OK to proceed despite having detected + // unembedded forward edges, then advance to the forward edges for the next child, if any if ((RetVal = theGraph->functions.fpHandleBlockedBicomp(theGraph, v, RootVertex, RootVertex)) == OK) - _AdvanceFwdArcList(theGraph, v, RootEdgeChild, nextChild); + _AdvanceFwdEdgeList(theGraph, v, RootEdgeChild, nextChild); return RetVal; } @@ -1027,12 +1105,12 @@ int _HandleBlockedBicomp(graphP theGraph, int v, int RootVertex, int R) if (R != RootVertex) sp_Push2(theGraph->theStack, R, 0); - if (theGraph->embedFlags == EMBEDFLAGS_PLANAR) + if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_PLANAR) { if (_IsolateKuratowskiSubgraph(theGraph, v, RootVertex) != OK) RetVal = NOTOK; } - else if (theGraph->embedFlags == EMBEDFLAGS_OUTERPLANAR) + else if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_OUTERPLANAR) { if (_IsolateOuterplanarObstruction(theGraph, v, RootVertex) != OK) RetVal = NOTOK; @@ -1042,78 +1120,78 @@ int _HandleBlockedBicomp(graphP theGraph, int v, int RootVertex, int R) } /******************************************************************** - _AdvanceFwdArcList() + _AdvanceFwdEdgeList() - If an extension determines that it is OK to leave some forward arcs - unembedded, then we advance the forward arc list head pointer past - the unembedded arcs for the current child so that it points to the - first forward arc for the next child, if any. + If an extension determines that it is OK to leave some forward edges + unembedded, then we advance the forward edge list head pointer past + the unembedded edges for the current child so that it points to the + first forward edge for the next child, if any. There are two meanings of the phrase "if any". First, there may be - no next child, in which case nextChild is NIL, and the forward arc + no next child, in which case nextChild is NIL, and the forward edge list need not be advanced. - If there is a next child, then the forward arc list head needs to - be advanced to the first arc whose descendant endpoint is greater - than the nextChild, if any. However, the tail end of the forward arc - list may include unembedded forward arcs to a preceding sibling + If there is a next child, then the forward edge list head needs to + be advanced to the first edge whose descendant endpoint is greater + than the nextChild, if any. However, the tail end of the forward edge + list may include unembedded forward edge records to a preceding sibling of the child vertex. So, we advance an edge pointer e until one of the following happens: - 1) e gets all the way around to the forward arc list head + 1) e gets all the way around to the head of the forward edge list 2) e finds an edge whose descendant endpoint is less than the child 3) e finds an edge whose descendant endpoint is greater than the next child - In case 1, all the forward arcs belong in the subtree of the child, so - there is no need to change the forward arc list head. + In case 1, all the forward edges belong in the subtree of the child, so + there is no need to change the forward edge list head. - In case 2, there are no more forward arcs to any following siblings of - the child, only left-behind unembedded forward arcs that we advanced + In case 2, there are no more forward edges to any following siblings of + the child, only left-behind unembedded forward edges that we advanced past in previous calls to this method from Walkdowns of the preceding - children of v. So the forward arc list head should be set to e so that - it is set to the forward arc with the least numbered descendant endpoint. + children of v. So the forward edge list head should be set to e so that + it is set to the forward edge with the least numbered descendant endpoint. - In case 3, the desired forward arc into the subtree of a following sibling - of the child has been found, so again the forward arc list head should be + In case 3, the desired forward edge into the subtree of a following sibling + of the child has been found, so again the forward edge list head should be set to e to indicate that edge. - After all Walkdowns of the children of a vertex, the forward arc list will + After all Walkdowns of the children of a vertex, the forward edge list will be NIL if all edges were embedded, or it will indicate the unembedded - forward arc whose descendant endpoint has the least number. Cases 1 and 2 + forward edge whose descendant endpoint has the least number. Cases 1 and 2 directly implement this in cases where a Walkdown for the given child fails to embed an edge, and case 3 indirectly finishes the job by making - sure the forward arc list head has the right value at the beginning of + sure the forward edge list head has the right value at the beginning of a Walkdown for a particular child. If the Walkdown of that child succeeds at embedding all the forward edges into that child's subtree, then each - embedding advances the forward arc list head. So, even if the Walkdown - of the last pertinent child embeds all forward arcs, then the Walkdown - itself advances the forward arc list head to the first unembedded forward - arc, or to NIL. + embedding advances the forward edge list head. So, even if the Walkdown + of the last pertinent child embeds all forward edges, then the Walkdown + itself advances the head of the forward edge list to the first unembedded + forward edge, or to NIL. ********************************************************************/ -void _AdvanceFwdArcList(graphP theGraph, int v, int child, int nextChild) +void _AdvanceFwdEdgeList(graphP theGraph, int v, int child, int nextChild) { - int e = gp_GetVertexFwdArcList(theGraph, v); + int e = gp_GetVertexFwdEdgeList(theGraph, v); - while (gp_IsArc(e)) + while (gp_IsEdge(theGraph, e)) { // 2) e finds an edge whose descendant endpoint is less than the child if (gp_GetNeighbor(theGraph, e) < child) { - gp_SetVertexFwdArcList(theGraph, v, e); + gp_SetVertexFwdEdgeList(theGraph, v, e); break; } // 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); + gp_SetVertexFwdEdgeList(theGraph, v, e); break; } - e = gp_GetNextArc(theGraph, e); - // 1) e gets all the way around to the forward arc list head - if (e == gp_GetVertexFwdArcList(theGraph, v)) + e = gp_GetNextEdge(theGraph, e); + // 1) e gets all the way around to the head of the forward edge list + if (e == gp_GetVertexFwdEdgeList(theGraph, v)) e = NIL; } } @@ -1204,7 +1282,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)) { @@ -1264,8 +1342,8 @@ int _OrientVerticesInBicomp(graphP theGraph, int BicompRoot, int PreserveSigns) _InvertVertex(theGraph, W); /* Push the vertex's DFS children that are in the bicomp */ - e = gp_GetFirstArc(theGraph, W); - while (gp_IsArc(e)) + e = gp_GetFirstEdge(theGraph, W); + while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) { @@ -1276,7 +1354,7 @@ int _OrientVerticesInBicomp(graphP theGraph, int BicompRoot, int PreserveSigns) gp_ClearEdgeFlagInverted(theGraph, e); } - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } } return OK; @@ -1295,12 +1373,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; @@ -1322,10 +1400,10 @@ int _OrientExternalFacePath(graphP theGraph, int u, int v, int w, int x) { int e_u, e_v, e_ulink, e_vlink; - // Get the edge record in u that indicates v; uses the twinarc method to - // ensure the cost is dominated by the degree of v (which is 2), not u + // Get the edge record in u that indicates v; uses the "get twin" method + // to ensure the cost is dominated by the degree of v (which is 2), not u // (which can be any degree). - e_u = gp_GetTwinArc(theGraph, gp_GetNeighborEdgeRecord(theGraph, v, u)); + e_u = gp_GetTwin(theGraph, _gp_FindEdge(theGraph, v, u)); do { @@ -1334,9 +1412,9 @@ int _OrientExternalFacePath(graphP theGraph, int u, int v, int w, int x) // As a sanity check, we determine whether e_u is an // external face edge, because there would be an internal // implementation error if not - if (gp_GetFirstArc(theGraph, u) == e_u) + if (gp_GetFirstEdge(theGraph, u) == e_u) e_ulink = 0; - else if (gp_GetLastArc(theGraph, u) == e_u) + else if (gp_GetLastEdge(theGraph, u) == e_u) e_ulink = 1; else return NOTOK; @@ -1345,11 +1423,11 @@ int _OrientExternalFacePath(graphP theGraph, int u, int v, int w, int x) // Now get the external face link in vertex v that indicates the // edge e_v which connects back to the prior vertex u. - e_v = gp_GetTwinArc(theGraph, e_u); + e_v = gp_GetTwin(theGraph, e_u); - if (gp_GetFirstArc(theGraph, v) == e_v) + if (gp_GetFirstEdge(theGraph, v) == e_v) e_vlink = 0; - else if (gp_GetLastArc(theGraph, v) == e_v) + else if (gp_GetLastEdge(theGraph, v) == e_v) e_vlink = 1; else return NOTOK; @@ -1369,7 +1447,7 @@ int _OrientExternalFacePath(graphP theGraph, int u, int v, int w, int x) gp_SetExtFaceVertex(theGraph, v, e_vlink, u); u = v; - e_u = gp_GetArc(theGraph, v, 1 ^ e_vlink); + e_u = gp_GetEdgeByLink(theGraph, v, 1 ^ e_vlink); } while (u != x); return OK; diff --git a/planarity/c/graphLib/planarityRelated/graphIsolator.c b/planarity/c/graphLib/planarityRelated/graphIsolator.c index 4c53eff..71bf986 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_IsEdge(theGraph, gp_GetVertexPertinentEdge(theGraph, cutVertex))) { *pDescendant = cutVertex; return TRUE; @@ -522,26 +522,26 @@ 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)) + e = gp_GetVertexFwdEdgeList(theGraph, ancestor); + while (gp_IsEdge(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); } - e = gp_GetNextArc(theGraph, e); - if (e == gp_GetVertexFwdArcList(theGraph, ancestor)) + e = gp_GetNextEdge(theGraph, e); + if (e == gp_GetVertexFwdEdgeList(theGraph, 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; } @@ -564,17 +564,17 @@ int _FindUnembeddedEdgeToSubtree(graphP theGraph, int ancestor, _MarkPathAlongBicompExtFace() Sets the visited flags of vertices and edges on the external face of a - bicomp from startVert to endVert, inclusive, by following the 'first' arc - link out of each visited vertex. + bicomp from startVert to endVert, inclusive, by following the 'first' + edge link out of each visited vertex. ****************************************************************************/ int _MarkPathAlongBicompExtFace(graphP theGraph, int startVert, int endVert) { - int Z, ZPrevLink, ZPrevArc; + int Z, ZPrevLink, ZPrevEdge; /* 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. */ @@ -585,11 +585,11 @@ int _MarkPathAlongBicompExtFace(graphP theGraph, int startVert, int endVert) { Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); - ZPrevArc = gp_GetArc(theGraph, Z, ZPrevLink); + ZPrevEdge = gp_GetEdgeByLink(theGraph, Z, ZPrevLink); - gp_SetEdgeVisited(theGraph, ZPrevArc); - gp_SetEdgeVisited(theGraph, gp_GetTwinArc(theGraph, ZPrevArc)); - gp_SetVertexVisited(theGraph, Z); + gp_SetEdgeVisited(theGraph, ZPrevEdge); + gp_SetEdgeVisited(theGraph, gp_GetTwin(theGraph, ZPrevEdge)); + 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, @@ -642,28 +644,31 @@ 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)) + e = gp_GetFirstEdge(theGraph, descendant); + while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_PARENT) { parent = gp_GetNeighbor(theGraph, e); break; } - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } // 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 gp_SetEdgeVisited(theGraph, e); - gp_SetEdgeVisited(theGraph, gp_GetTwinArc(theGraph, e)); + gp_SetEdgeVisited(theGraph, gp_GetTwin(theGraph, e)); } // 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_SetEdgeVisited(theGraph, gp_GetFirstArc(theGraph, ancestor)); - gp_SetEdgeVisited(theGraph, gp_GetFirstArc(theGraph, descendant)); - gp_SetVertexVisited(theGraph, descendant); + gp_SetVisited(theGraph, ancestor); + gp_SetEdgeVisited(theGraph, gp_GetFirstEdge(theGraph, ancestor)); + gp_SetEdgeVisited(theGraph, gp_GetFirstEdge(theGraph, descendant)); + gp_SetVisited(theGraph, descendant); return OK; } @@ -747,51 +752,56 @@ int _AddAndMarkEdge(graphP theGraph, int ancestor, int descendant) void _AddBackEdge(graphP theGraph, int ancestor, int descendant) { - int fwdArc, backArc; + int fwdEdgeRec, backEdgeRec; /* We get the two edge records of the back edge to embed. */ - fwdArc = gp_GetVertexFwdArcList(theGraph, ancestor); - while (gp_IsArc(fwdArc)) + fwdEdgeRec = gp_GetVertexFwdEdgeList(theGraph, ancestor); + while (gp_IsEdge(theGraph, fwdEdgeRec)) { - if (gp_GetNeighbor(theGraph, fwdArc) == descendant) + if (gp_GetNeighbor(theGraph, fwdEdgeRec) == descendant) break; - fwdArc = gp_GetNextArc(theGraph, fwdArc); - if (fwdArc == gp_GetVertexFwdArcList(theGraph, ancestor)) - fwdArc = NIL; + fwdEdgeRec = gp_GetNextEdge(theGraph, fwdEdgeRec); + if (fwdEdgeRec == gp_GetVertexFwdEdgeList(theGraph, ancestor)) + fwdEdgeRec = NIL; } - if (gp_IsNotArc(fwdArc)) + if (gp_IsNotEdge(theGraph, fwdEdgeRec)) + { +#ifdef DEBUG + NOTOK; +#endif return; + } - backArc = gp_GetTwinArc(theGraph, fwdArc); + backEdgeRec = gp_GetTwin(theGraph, fwdEdgeRec); - /* The forward arc is removed from the fwdArcList of the ancestor. */ - if (gp_GetVertexFwdArcList(theGraph, ancestor) == fwdArc) + /* The forward edge record is removed from the fwdEdgeList of the ancestor. */ + if (gp_GetVertexFwdEdgeList(theGraph, ancestor) == fwdEdgeRec) { - if (gp_GetNextArc(theGraph, fwdArc) == fwdArc) - gp_SetVertexFwdArcList(theGraph, ancestor, NIL); + if (gp_GetNextEdge(theGraph, fwdEdgeRec) == fwdEdgeRec) + gp_SetVertexFwdEdgeList(theGraph, ancestor, NIL); else - gp_SetVertexFwdArcList(theGraph, ancestor, gp_GetNextArc(theGraph, fwdArc)); + gp_SetVertexFwdEdgeList(theGraph, ancestor, gp_GetNextEdge(theGraph, fwdEdgeRec)); } - gp_SetNextArc(theGraph, gp_GetPrevArc(theGraph, fwdArc), gp_GetNextArc(theGraph, fwdArc)); - gp_SetPrevArc(theGraph, gp_GetNextArc(theGraph, fwdArc), gp_GetPrevArc(theGraph, fwdArc)); + gp_SetNextEdge(theGraph, gp_GetPrevEdge(theGraph, fwdEdgeRec), gp_GetNextEdge(theGraph, fwdEdgeRec)); + gp_SetPrevEdge(theGraph, gp_GetNextEdge(theGraph, fwdEdgeRec), gp_GetPrevEdge(theGraph, fwdEdgeRec)); - /* The forward arc is added to the adjacency list of the ancestor. */ - gp_SetPrevArc(theGraph, fwdArc, NIL); - gp_SetNextArc(theGraph, fwdArc, gp_GetFirstArc(theGraph, ancestor)); - gp_SetPrevArc(theGraph, gp_GetFirstArc(theGraph, ancestor), fwdArc); - gp_SetFirstArc(theGraph, ancestor, fwdArc); + /* The forward edge record is added to the adjacency list of the ancestor. */ + gp_SetPrevEdge(theGraph, fwdEdgeRec, NIL); + gp_SetNextEdge(theGraph, fwdEdgeRec, gp_GetFirstEdge(theGraph, ancestor)); + gp_SetPrevEdge(theGraph, gp_GetFirstEdge(theGraph, ancestor), fwdEdgeRec); + gp_SetFirstEdge(theGraph, ancestor, fwdEdgeRec); - /* The back arc is added to the adjacency list of the descendant. */ - gp_SetPrevArc(theGraph, backArc, NIL); - gp_SetNextArc(theGraph, backArc, gp_GetFirstArc(theGraph, descendant)); - gp_SetPrevArc(theGraph, gp_GetFirstArc(theGraph, descendant), backArc); - gp_SetFirstArc(theGraph, descendant, backArc); + /* The back edge record is added to the adjacency list of the descendant. */ + gp_SetPrevEdge(theGraph, backEdgeRec, NIL); + gp_SetNextEdge(theGraph, backEdgeRec, gp_GetFirstEdge(theGraph, descendant)); + gp_SetPrevEdge(theGraph, gp_GetFirstEdge(theGraph, descendant), backEdgeRec); + gp_SetFirstEdge(theGraph, descendant, backEdgeRec); - gp_SetNeighbor(theGraph, backArc, ancestor); + gp_SetNeighbor(theGraph, backEdgeRec, ancestor); } /**************************************************************************** @@ -802,31 +812,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 + /* All of the forward and back edge records of all of the "back" edges 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_IsEdge(theGraph, e = gp_GetVertexFwdEdgeList(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)) + e = gp_GetFirstEdge(theGraph, v); + while (gp_IsEdge(theGraph, e)) { - if (gp_GetEdgeVisited(theGraph, e)) - e = gp_GetNextArc(theGraph, e); - else - e = gp_DeleteEdge(theGraph, e, 0); + eNext = gp_GetNextEdge(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..95a95ce 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 _ClearObstructionMarksInBicomp(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; @@ -127,7 +128,7 @@ int _ChooseTypeOfNonplanarityMinor(graphP theGraph, int v, int R) If R is NIL, the routine first determines which bicomp produced non-planarity condition. If the stack is non-empty, then R is on the top of the stack. - Otherwise, an unembedded fwdArc from the fwdArcList of vertex v is used in + Otherwise, an unembedded edge from the fwdEdgeList of vertex v is used in combination with the sortedDFSChildList of v to determine R. If the parameter R was not NIL, then this method assumes it must operate @@ -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; @@ -195,19 +202,22 @@ int _InitializeNonplanarityContext(graphP theGraph, int v, int R) _GetNeighborOnExtFace() Each vertex contains two 'link' index pointers that indicate the - first and last adjacency list arc. If the vertex is on the external face, - then these two arcs are also on the external face. We want to take one of - those edges to get to the next vertex on the external face. + first and last adjacency list edges. If the vertex is on the + external face, then these two edges are also on the external face. + We want to take one of those edges to get to the next vertex on the + external face. + On input *pPrevLink indicates which link we followed to arrive at curVertex. On output *pPrevLink will be set to the link we follow to get into the next vertex. + To get to the next vertex, we use the opposite link from the one used - to get into curVertex. This takes us to an edge node. The twinArc - of that edge node, carries us to an edge node in the next vertex. - At least one of the two links in that edge node will lead to a vertex + to get into curVertex. This takes us to an edge record. The twin + of that edge record carries us to an edge record in the next vertex. + At least one of the two links in that edge record will lead to a vertex node in G, which is the next vertex. Once we arrive at the next - vertex, at least one of its links will lead back to the edge node, and - that link becomes the output value of *pPrevLink. + vertex, at least one of its links will lead back to the edge record, + and that link becomes the output value of *pPrevLink. NOTE: This method intentionally ignores the extFace optimization links. It is invoked when the "real" external face must be @@ -221,24 +231,24 @@ int _GetNeighborOnExtFace(graphP theGraph, int curVertex, int *pPrevLink) { /* Exit curVertex from whichever link was not previously used to enter it */ - int arc = gp_GetArc(theGraph, curVertex, 1 ^ (*pPrevLink)); - int nextVertex = gp_GetNeighbor(theGraph, arc); + int e = gp_GetEdgeByLink(theGraph, curVertex, 1 ^ (*pPrevLink)); + int nextVertex = gp_GetNeighbor(theGraph, e); /* This if stmt assigns the new prev link that tells us which edge record was used to enter nextVertex (so that we exit from the opposing edge record). However, if we are in a singleton bicomp, then both links in nextVertex - lead back to curVertex. We want the two arcs of a singleton bicomp to - act like a cycle, so we just don't change the prev link in this case. + lead back to curVertex. We want the two edge records of a singleton bicomp + to act like a cycle, so we just don't change the prev link in this case. But when nextVertex has more than one edge, we need to figure out whether the first edge or last edge (which are the two on the external face) was used to enter nextVertex so we can exit from the other one as traversal of the external face continues later. */ - if (gp_GetFirstArc(theGraph, nextVertex) != gp_GetLastArc(theGraph, nextVertex)) - *pPrevLink = gp_GetTwinArc(theGraph, arc) == gp_GetFirstArc(theGraph, nextVertex) ? 0 : 1; + if (gp_GetFirstEdge(theGraph, nextVertex) != gp_GetLastEdge(theGraph, nextVertex)) + *pPrevLink = gp_GetTwin(theGraph, e) == gp_GetFirstEdge(theGraph, nextVertex) ? 0 : 1; return nextVertex; } @@ -247,8 +257,8 @@ int _GetNeighborOnExtFace(graphP theGraph, int curVertex, int *pPrevLink) _FindActiveVertices() Descends from the root of a bicomp R along both external face paths (which - are indicated by the first and last arcs in R's adjacency list), returning - the first active vertex appearing in each direction. + are indicated by the first and last edge records in R's adjacency list), + returning the first active vertex appearing in each direction. ****************************************************************************/ void _FindActiveVertices(graphP theGraph, int R, int *pX, int *pY) @@ -261,7 +271,7 @@ void _FindActiveVertices(graphP theGraph, int R, int *pX, int *pY) // For planarity algorithms, advance past inactive vertices // For outerplanarity algorithms, ignore the notion of inactive vertices // since all vertices must remain on the external face. - if (!(theGraph->embedFlags & EMBEDFLAGS_OUTERPLANAR)) + if (!(gp_GetEmbedFlags(theGraph) & EMBEDFLAGS_OUTERPLANAR)) { gp_UpdateVertexFuturePertinentChild(theGraph, *pX, v); while (INACTIVE(theGraph, *pX, v)) @@ -323,34 +333,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 (_ClearObstructionMarksInBicomp(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,9 +401,9 @@ 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)); + gp_ClearEdgeVisited(theGraph, gp_GetTwin(theGraph, e)); } return OK; @@ -489,16 +502,16 @@ int _MarkLowestXYPath(graphP theGraph) that only the desired path is identified. To walk the proper face containing the targetVertex, we first identify an - arc that will be considered to be the one used to enter the targetVertex. + edge record that will be considered to be the one used to enter the targetVertex. When the first loop iteration exits the targetVertex, it comes out on the RXW side (even though it may be an internal vertex not marked RXW). - Then we take either the next arc (if targetVertex==W) or predecessor arc - (if targetVertex==R) at every subsequent corner to determine the exit arc - for the vertex. Then, we use the twin arc of the exit arc to determine the - entry arc for the next vertex. + Then we take either the next edge (if targetVertex==W) or previous edge + (if targetVertex==R) at every subsequent corner to determine the edge record + to use to exit the vertex. Then, we use the twin of the exit edge record to + determine the edge record to use to enter the next vertex. - For each vertex, we mark as visited the vertex as well as both arcs of - the edge used to enter the vertex. We also push the visited vertices and + For each vertex, we mark as visited the vertex as well as both edge records + of the edge used to enter the vertex. We also push the visited vertices and edges onto a stack. Each time the traversal lands on an external face vertex on the RXW side, it is recorded as a candidate point of attachment Px. We also pop and unmark all previously visited vertices and edges because they @@ -588,31 +601,33 @@ int _MarkClosestXYPath(graphP theGraph, int targetVertex) Z = targetVertex; - // Now we will get the arc that we consider to be the arc used to enter - // the targetVertex (which will be an edge on the RYW side, and the - // first line of the loop code will get the previous or next arc to exit - // the targetVertex on the RXW side of the bicomp) - e = targetVertex == R ? gp_GetLastArc(theGraph, R) : gp_GetFirstArc(theGraph, W); + // Now we will get the edge considered to be the one used to enter + // the targetVertex. This will be an edge on the RYW side, and the + // first line of the loop code will get the previous or next edge + // that will be used to exit the targetVertex on the RXW side of the + // bicomp (that one operation to get previous or next, circular, will + // switch sides because all internal edges of targetVertex are hidden). + e = targetVertex == R ? gp_GetLastEdge(theGraph, R) : gp_GetFirstEdge(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 */ - // Get the opposing arc of the corner at vertex Z, as the arc to exit Z - e = targetVertex == R ? gp_GetPrevArcCircular(theGraph, e) - : gp_GetNextArcCircular(theGraph, e); + // Get the opposing edge of the corner at vertex Z, as the edge to exit Z + e = targetVertex == R ? gp_GetPrevEdgeCircular(theGraph, e) + : gp_GetNextEdgeCircular(theGraph, e); - // Now use the exit arc to get the next Z to visit + // Now use the exit edge record to get the next Z to visit Z = gp_GetNeighbor(theGraph, e); - // And get the entry arc of the new Z being visited - e = gp_GetTwinArc(theGraph, e); + // And get the entry edge record of the new Z being visited + e = gp_GetTwin(theGraph, e); /* 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 +653,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,19 +670,19 @@ 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); - gp_SetEdgeVisited(theGraph, gp_GetTwinArc(theGraph, e)); + gp_SetEdgeVisited(theGraph, gp_GetTwin(theGraph, e)); } /* If we found an RYW vertex, then we have successfully finished 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 +700,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; @@ -697,33 +712,36 @@ int _MarkClosestXYPath(graphP theGraph, int targetVertex) This function assumes that _MarkHighestXYPath() has already been called, which marked as visited the vertices and edges along the X-Y path. - We begin at the point of attachment P_x, take the last arc and traverse - the predecessor arcs until we find one marked visited, which leads to the + We begin at the point of attachment P_x, take its last edge and traverse + the predecessor edges until we find one marked visited, which leads to the first internal vertex along the X-Y path. We begin with this vertex (and its edge of entry), and we run until we find P_y. For each internal - vertex Z and its edge of entry ZPrevArc, we take the predecessor edge record - of ZPrevArc. This is called ZNextArc. If ZNextArc is marked visited - then it is along the X-Y path, so we use it to exit Z and go to the next - vertex on the X-Y path. - - If ZNextArc is not visited, then when _MarkHighestXYPath() ran, it exited - Z from ZNextArc, then eventually reentered Z. In other words, Z became a - cut vertex when we removed the internal edges incident to R. Thus, ZNextArc + vertex Z and its edge of entry ZPrevEdge, we take the predecessor edge record + of ZPrevEdge, called ZNextEdge. If ZNextEdge is marked visited then it is + along the X-Y path, so we use it to exit Z and go to the next vertex on the + X-Y path. + + If ZNextEdge is not visited, then when _MarkHighestXYPath() ran, it exited + Z from ZNextedge, then eventually reentered Z. In other words, Z became a + cut vertex when we removed the internal edges incident to R. Thus, ZNextEdge indicates the first edge in an internal path to R. - When we find an unvisited ZNextArc, we stop running the X-Y path and instead + When we find an unvisited ZNextEdge, we stop running the X-Y path and instead begin marking the Z to R path. We move to successive vertices using a - twin arc then its predecessor arc in the adjacency list, only this time + twin edge record then its predecessor in the adjacency list, only this time we have not removed the internal edges incident to R, so this technique does eventually lead us all the way to R. - If we do not find an unvisited ZNextArc for any vertex Z on the X-Y path and + If we do not find an unvisited ZNextEdge for any vertex Z on the X-Y path and inside the bicomp, then there is no Z to R path, so we return. + + Returns OK if a Z-to-R path has been marked or if it has been found that + there is not a Z-to-R path; returns NOTOK on error ****************************************************************************/ int _MarkZtoRPath(graphP theGraph) { - int ZPrevArc, ZNextArc, Z, R, Px, Py; + int ZPrevEdge, ZNextEdge, Z, R, Px, Py; /* Initialize */ @@ -736,28 +754,28 @@ int _MarkZtoRPath(graphP theGraph) the first internal vertex of the X-Y path. */ Z = Px; - ZNextArc = gp_GetLastArc(theGraph, Z); - while (ZNextArc != gp_GetFirstArc(theGraph, Z)) + ZNextEdge = gp_GetLastEdge(theGraph, Z); + while (ZNextEdge != gp_GetFirstEdge(theGraph, Z)) { - if (gp_GetEdgeVisited(theGraph, ZNextArc)) + if (gp_GetEdgeVisited(theGraph, ZNextEdge)) break; - ZNextArc = gp_GetPrevArc(theGraph, ZNextArc); + ZNextEdge = gp_GetPrevEdge(theGraph, ZNextEdge); } - if (!gp_GetEdgeVisited(theGraph, ZNextArc)) + if (!gp_GetEdgeVisited(theGraph, ZNextEdge)) return NOTOK; /* For each internal vertex Z, determine whether it has a path to root. */ - while (gp_GetEdgeVisited(theGraph, ZNextArc)) + while (gp_GetEdgeVisited(theGraph, ZNextEdge)) { - ZPrevArc = gp_GetTwinArc(theGraph, ZNextArc); - ZNextArc = gp_GetPrevArcCircular(theGraph, ZPrevArc); + ZPrevEdge = gp_GetTwin(theGraph, ZNextEdge); + ZNextEdge = gp_GetPrevEdgeCircular(theGraph, ZPrevEdge); } - ZPrevArc = gp_GetTwinArc(theGraph, ZNextArc); - Z = gp_GetNeighbor(theGraph, ZPrevArc); + ZPrevEdge = gp_GetTwin(theGraph, ZNextEdge); + Z = gp_GetNeighbor(theGraph, ZPrevEdge); /* If there is no Z to R path, return */ @@ -768,7 +786,7 @@ int _MarkZtoRPath(graphP theGraph) theGraph->IC.z = Z; - /* Walk the proper face starting with (Z, ZNextArc) until we reach R, marking + /* Walk the proper face starting with (Z, ZNextEdge) until we reach R, marking the vertices and edges encountered along the way, then Return OK. */ while (Z != R) @@ -776,23 +794,23 @@ 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 */ + /* Go to the next vertex indicated by ZNextEdge */ - Z = gp_GetNeighbor(theGraph, ZNextArc); + Z = gp_GetNeighbor(theGraph, ZNextEdge); /* Mark the next vertex and the edge leading to it as visited. */ - gp_SetEdgeVisited(theGraph, ZNextArc); - gp_SetEdgeVisited(theGraph, ZPrevArc); - gp_SetVertexVisited(theGraph, Z); + gp_SetEdgeVisited(theGraph, ZNextEdge); + gp_SetEdgeVisited(theGraph, ZPrevEdge); + gp_SetVisited(theGraph, Z); /* Go to the next edge in the proper face */ - ZNextArc = gp_GetPrevArcCircular(theGraph, ZPrevArc); - ZPrevArc = gp_GetTwinArc(theGraph, ZNextArc); + ZNextEdge = gp_GetPrevEdgeCircular(theGraph, ZPrevEdge); + ZPrevEdge = gp_GetTwin(theGraph, ZNextEdge); } /* Found Z to R path, so indicate as much to caller */ 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..ee10226 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) */ @@ -130,7 +130,7 @@ int _CheckEmbeddingIntegrity(graphP theGraph, graphP origGraph) if (_CheckEmbeddingFacialIntegrity(theGraph) != OK) return NOTOK; - if (theGraph->embedFlags == EMBEDFLAGS_OUTERPLANAR) + if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_OUTERPLANAR) { if (_CheckAllVerticesOnExternalFace(theGraph) != OK) return NOTOK; @@ -144,25 +144,26 @@ int _CheckEmbeddingIntegrity(graphP theGraph, graphP origGraph) This function traverses all faces of a graph structure containing the planar embedding that results from gp_Embed(). The algorithm - begins by placing all of the graph's arcs onto a stack and marking - all of them as unvisited. For each arc popped, if it is visited, - it is immediately discarded and the next arc is popped. Popping an - unvisited arc e begins a face traversal. We move to the true twin - arc of e, and obtain its successor arc. This amounts to always - going clockwise or counterclockwise (depending on how the graph is - drawn on the plane, or alternately whether one is above or below - the plane). This traversal continues until we make it back to the - original arc e. Each arc along the way is marked as visited. Further, - if the successor arc has been visited, then there is an error since - an arc can only appear in one face (the twin arc appears in a separate - face, which is traversed in the opposing direction). - If this algorithm succeeds without double visiting any arcs, and it - produces the correct face count according to Euler's formula, then - the embedding has all vertices oriented the same way. - NOTE: In disconnected graphs, the face reader counts the external - face of each connected component. So, we adjust the face - count by subtracting one for each component, then we add one - to count the external face shared by all components. + begins by placing all of the graph's edge records onto a stack and + marking all of them as unvisited. For each edge record popped, if it + is visited, it is discarded and the next edge record is popped. + Popping an unvisited edge record e begins a face traversal. We move + to the true twin edge record of e, and obtain its adjacency list + successor. This amounts to always going clockwise or counterclockwise + (depending on how the graph is drawn on the plane, or alternately + whether one is above or below the plane). This traversal continues + until we make it back to the original edge record e. Each edge record + along the way is marked as visited. Further, if the successor edge + record has been visited, then there is an error since an edge record + can only appear in one face (the twin edge record in an edge appears + in a separate face, which is traversed in the opposing direction). + If this algorithm succeeds without doubly visiting any edge records, + and it produces the correct face count according to Euler's formula, + then the embedding has all vertices oriented the same way. + NOTE: In disconnected graphs, the face reader counts the external + face of each connected component. So, we adjust the face + count by subtracting one for each component, then we add one + to count the external face shared by all components. ********************************************************************/ int _CheckEmbeddingFacialIntegrity(graphP theGraph) @@ -180,34 +181,35 @@ int _CheckEmbeddingFacialIntegrity(graphP theGraph) sp_ClearStack(theStack); - /* Push all arcs and set them to unvisited */ + /* Push all edge records (both parts of each edge) and set them all to unvisited */ - EsizeOccupied = gp_EdgeInUseIndexBound(theGraph); - for (e = gp_GetFirstEdge(theGraph); e < EsizeOccupied; e += 2) + EsizeOccupied = gp_EdgeInUseArraySize(theGraph); + for (e = gp_EdgeArrayStart(theGraph); e < EsizeOccupied; e += 2) { // Except skip edge holes if (gp_EdgeInUse(theGraph, e)) { sp_Push(theStack, e); gp_ClearEdgeVisited(theGraph, e); - eTwin = gp_GetTwinArc(theGraph, e); + eTwin = gp_GetTwin(theGraph, e); sp_Push(theStack, eTwin); gp_ClearEdgeVisited(theGraph, eTwin); } } - // There are M edges, so we better have pushed 2M arcs just now - // i.e. testing that the continue above skipped only edge holes - if (sp_GetCurrentSize(theStack) != 2 * theGraph->M) + // There are M edges, so we better have pushed 2M edge records, + // i.e., we test that the continue above skipped edge holes and + // didn't push edge records beyond the boundary of those in use. + if (sp_GetCurrentSize(theStack) != 2 * gp_GetM(theGraph)) return NOTOK; - /* Read faces until every arc is used */ + /* Read faces until every edge record is popped */ NumFaces = 0; while (sp_NonEmpty(theStack)) { - /* Get an arc; if it has already been used by a face, then - don't use it to traverse a new face */ + /* Get an edge record; if it has already been used by a face, + then don't use it to traverse a new face */ sp_Pop(theStack, eStart); if (gp_GetEdgeVisited(theGraph, eStart)) continue; @@ -215,7 +217,7 @@ int _CheckEmbeddingFacialIntegrity(graphP theGraph) e = eStart; do { - eNext = gp_GetNextArcCircular(theGraph, gp_GetTwinArc(theGraph, e)); + eNext = gp_GetNextEdgeCircular(theGraph, gp_GetTwin(theGraph, e)); if (gp_GetEdgeVisited(theGraph, eNext)) return NOTOK; gp_SetEdgeVisited(theGraph, eNext); @@ -230,7 +232,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)) { @@ -247,7 +249,7 @@ int _CheckEmbeddingFacialIntegrity(graphP theGraph) for disconnected graphs it is extended to f=m-n+1+c where c is the number of connected components.*/ - return NumFaces == theGraph->M - theGraph->N + 1 + connectedComponents + return NumFaces == gp_GetM(theGraph) - gp_GetN(theGraph) + 1 + connectedComponents ? OK : NOTOK; } @@ -268,11 +270,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 +282,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 @@ -306,58 +308,58 @@ int _CheckAllVerticesOnExternalFace(graphP theGraph) void _MarkExternalFaceVertices(graphP theGraph, int startVertex) { int nextVertex = startVertex; - int e = gp_GetFirstArc(theGraph, nextVertex); + int e = gp_GetFirstEdge(theGraph, nextVertex); int eTwin; // Handle the case of an isolated vertex - if (gp_IsNotArc(e)) + if (gp_IsNotEdge(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 + // The edge record out of the vertex just visited points to the next vertex nextVertex = gp_GetNeighbor(theGraph, e); - // Arc used to enter the next vertex is needed so we can get the - // next edge in rotation order. - // Note: for bicomps, first and last arcs of all external face vertices + // The edge record used to enter the next vertex is needed so we can get + // the next edge in rotation order. + // Note: for bicomps, first and last edges of all external face vertices // indicate the edges that hold them to the external face // But _JoinBicomps() has already occurred, so cut vertices - // will have external face edges other than the first and last arcs - // Hence we need this more sophisticated traversal method - eTwin = gp_GetTwinArc(theGraph, e); + // will have external face edges other than their first and last + // edge records, so we need this more sophisticated traversal method. + eTwin = gp_GetTwin(theGraph, e); - // Now we get the next arc in rotation order as the new arc out to the + // Now we get the next edge in rotation order as the new edge out to the // vertex after nextVertex. This sets us up for the next iteration. - // Note: We cannot simply follow the chain of nextVertex first arcs + // NOTE: We cannot simply follow the chain of nextVertex first edges // as we started out doing at the top of this method. This is // because we are no longer dealing with bicomps only. // Since _JoinBicomps() has already been invoked, there may now // be cut vertices on the external face whose adjacency lists - // contain external face arcs in positions other than the first and - // and last arcs. We will visit those vertices multiple times, + // contain external face edges in positions other than their first + // and last edges. We will visit those vertices multiple times, // which is OK (just that we have to explain why we're calculating - // jout in this way). - e = gp_GetNextArcCircular(theGraph, eTwin); + // the out edge to exit a vertex in this way). + e = gp_GetNextEdgeCircular(theGraph, eTwin); // Now things get really interesting. The DFS root (startVertex) may // itself be a cut vertex to which multiple bicomps have been joined. // So we cannot simply stop when the external face walk gets back to // startVertex. We must actually get back to startVertex using its - // last arc. This ensures that we've looped down into all the DFS + // last edge. This ensures that we've looped down into all the DFS // subtrees rooted at startVertex and walked their external faces. - // Since we started the whole external face walk with the first arc + // Since we started the whole external face walk with the first edge // of startVertex, we need to proceed until we reenter startVertex - // using its last arc. + // using its last edge. - } while (eTwin != gp_GetLastArc(theGraph, startVertex)); + } while (eTwin != gp_GetLastEdge(theGraph, startVertex)); } /******************************************************************** @@ -383,10 +385,10 @@ int _CheckObstructionIntegrity(graphP theGraph, graphP origGraph) return NOTOK; } - if (theGraph->embedFlags == EMBEDFLAGS_PLANAR) + if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_PLANAR) return _CheckKuratowskiSubgraphIntegrity(theGraph); - else if (theGraph->embedFlags == EMBEDFLAGS_OUTERPLANAR) + else if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_OUTERPLANAR) return _CheckOuterplanarObstructionIntegrity(theGraph); return NOTOK; @@ -424,7 +426,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) @@ -477,11 +479,11 @@ int _TestForCompleteGraphObstruction(graphP theGraph, int numVerts, return FALSE; // All vertices need to be degree 0, degree 2 or degree numVerts-1 - if (degrees[0] + degrees[2] + degrees[numVerts - 1] != theGraph->N) + if (degrees[0] + degrees[2] + degrees[numVerts - 1] != gp_GetN(theGraph)) 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 +499,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 +564,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 +572,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 @@ -673,14 +675,14 @@ int _TestForK23GraphObstruction(graphP theGraph, int *degrees, int *imageVerts) // the two degree 3 image vertices are in the same partition // and hence must not be adjacent. - e = gp_GetFirstArc(theGraph, imageVerts[0]); - while (gp_IsArc(e)) + e = gp_GetFirstEdge(theGraph, imageVerts[0]); + while (gp_IsEdge(theGraph, e)) { imageVerts[imageVertPos] = gp_GetNeighbor(theGraph, e); if (imageVerts[imageVertPos] == imageVerts[1]) return FALSE; imageVertPos++; - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } /* The paths from imageVerts[0] to each of the new degree 2 @@ -688,7 +690,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 +698,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 @@ -775,9 +777,9 @@ int _CheckOuterplanarObstructionIntegrity(graphP theGraph) int _TestPath(graphP theGraph, int U, int V) { - int e = gp_GetFirstArc(theGraph, U); + int e = gp_GetFirstEdge(theGraph, U); - while (gp_IsArc(e)) + while (gp_IsEdge(theGraph, e)) { if (_TryPath(theGraph, e, V) == OK) { @@ -785,7 +787,7 @@ int _TestPath(graphP theGraph, int U, int V) return TRUE; } - e = gp_GetNextArc(theGraph, e); + e = gp_GetNextEdge(theGraph, e); } return FALSE; @@ -809,14 +811,14 @@ 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)) && - gp_GetNextArc(theGraph, gp_GetFirstArc(theGraph, nextVertex)) == gp_GetLastArc(theGraph, nextVertex)) + while (gp_IsEdge(theGraph, gp_GetFirstEdge(theGraph, nextVertex)) && + gp_IsEdge(theGraph, gp_GetLastEdge(theGraph, nextVertex)) && + gp_GetNextEdge(theGraph, gp_GetFirstEdge(theGraph, nextVertex)) == gp_GetLastEdge(theGraph, nextVertex)) { - eTwin = gp_GetTwinArc(theGraph, e); - e = gp_GetFirstArc(theGraph, nextVertex); + eTwin = gp_GetTwin(theGraph, e); + e = gp_GetFirstEdge(theGraph, nextVertex); if (e == eTwin) - e = gp_GetLastArc(theGraph, nextVertex); + e = gp_GetLastEdge(theGraph, nextVertex); nextVertex = gp_GetNeighbor(theGraph, e); } @@ -838,16 +840,16 @@ 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)) && - gp_GetNextArc(theGraph, gp_GetFirstArc(theGraph, nextVertex)) == gp_GetLastArc(theGraph, nextVertex)) + while (gp_IsEdge(theGraph, gp_GetFirstEdge(theGraph, nextVertex)) && + gp_IsEdge(theGraph, gp_GetLastEdge(theGraph, nextVertex)) && + gp_GetNextEdge(theGraph, gp_GetFirstEdge(theGraph, nextVertex)) == gp_GetLastEdge(theGraph, nextVertex)) { - gp_SetVertexVisited(theGraph, nextVertex); + gp_SetVisited(theGraph, nextVertex); - eTwin = gp_GetTwinArc(theGraph, e); - e = gp_GetFirstArc(theGraph, nextVertex); + eTwin = gp_GetTwin(theGraph, e); + e = gp_GetFirstEdge(theGraph, nextVertex); if (e == eTwin) - e = gp_GetLastArc(theGraph, nextVertex); + e = gp_GetLastEdge(theGraph, nextVertex); nextVertex = gp_GetNeighbor(theGraph, e); } @@ -876,8 +878,8 @@ int _TestSubgraph(graphP theSubgraph, graphP theGraph) // If the graph is not sorted by DFI, but the alleged subgraph is, // then "unsort" the alleged subgraph so both have the same vertex order - if (!(theGraph->internalFlags & FLAGS_SORTEDBYDFI) && - (theSubgraph->internalFlags & FLAGS_SORTEDBYDFI)) + if (!(gp_GetGraphFlags(theGraph) & FLAGS_SORTEDBYDFI) && + (gp_GetGraphFlags(theSubgraph) & FLAGS_SORTEDBYDFI)) { invokeSortOnSubgraph = TRUE; gp_SortVertices(theSubgraph); @@ -885,8 +887,8 @@ int _TestSubgraph(graphP theSubgraph, graphP theGraph) // If the graph is not sorted by DFI, but the alleged subgraph is, // then "unsort" the alleged subgraph so both have the same vertex order - if (!(theSubgraph->internalFlags & FLAGS_SORTEDBYDFI) && - (theGraph->internalFlags & FLAGS_SORTEDBYDFI)) + if (!(gp_GetGraphFlags(theSubgraph) & FLAGS_SORTEDBYDFI) && + (gp_GetGraphFlags(theGraph) & FLAGS_SORTEDBYDFI)) { invokeSortOnGraph = TRUE; gp_SortVertices(theGraph); @@ -894,25 +896,25 @@ 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)) + e = gp_GetFirstEdge(theSubgraph, v); + while (gp_IsEdge(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)); - e = gp_GetNextArc(theSubgraph, e); + gp_SetVisited(theGraph, gp_GetNeighbor(theSubgraph, e)); + e = gp_GetNextEdge(theSubgraph, e); } if (Result != TRUE) @@ -921,16 +923,16 @@ int _TestSubgraph(graphP theSubgraph, graphP theGraph) /* For each neighbor w in the adjacency list of vertex v in the graph, clear the visited flag in w in the graph */ - e = gp_GetFirstArc(theGraph, v); - while (gp_IsArc(e)) + e = gp_GetFirstEdge(theGraph, v); + while (gp_IsEdge(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)); - e = gp_GetNextArc(theGraph, e); + gp_ClearVisited(theGraph, gp_GetNeighbor(theGraph, e)); + e = gp_GetNextEdge(theGraph, e); } if (Result != TRUE) @@ -940,15 +942,15 @@ int _TestSubgraph(graphP theSubgraph, graphP theGraph) ensure that the visited flag in w was cleared (otherwise, the "subgraph" would incorrectly contain an adjacency not contained in the ("super") graph) */ - e = gp_GetFirstArc(theSubgraph, v); - while (gp_IsArc(e)) + e = gp_GetFirstEdge(theSubgraph, v); + while (gp_IsEdge(theGraph, e)) { - if (gp_GetVertexVisited(theGraph, gp_GetNeighbor(theSubgraph, e))) + if (gp_GetVisited(theGraph, gp_GetNeighbor(theSubgraph, e))) { Result = FALSE; break; } - e = gp_GetNextArc(theSubgraph, e); + e = gp_GetNextEdge(theSubgraph, e); } if (Result != TRUE) @@ -967,7 +969,7 @@ int _TestSubgraph(graphP theSubgraph, graphP theGraph) { // If the edge count is wrong, we fail the subgraph test in a way that invokes // the name NOTOK so that in debug mode there is more trace on the failure. - if (degreeCount != 2 * theSubgraph->M) + if (degreeCount != 2 * gp_GetM(theSubgraph)) Result = NOTOK == FALSE ? NOTOK : FALSE; } diff --git a/planarity/classic/cplanarity.pxd b/planarity/classic/cplanarity.pxd index 6b59c1b..6dc0476 100644 --- a/planarity/classic/cplanarity.pxd +++ b/planarity/classic/cplanarity.pxd @@ -8,38 +8,41 @@ cdef extern from "../c/graphLib/graphStructures.h": pass ctypedef edgeRec * edgeRecP - cdef int gp_GetFirstVertex(graphP theGraph) - 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_GetNeighbor(graphP theGraph, int v) - cdef int gp_GetPrevArc(graphP theGraph, int v) - cdef int gp_GetNextArc(graphP theGraph, int v) - cdef int gp_GetDirection(graphP theGraph, int v) + int gp_GetFirstVertex(graphP theGraph) + int gp_GetLastVertex(graphP theGraph) + int gp_GetFirstEdge(graphP theGraph, int v) + int gp_GetLastEdge(graphP theGraph, int v) + int gp_IsEdge(graphP theGraph, int v) + int gp_GetNeighbor(graphP theGraph, int v) + int gp_GetPrevEdge(graphP theGraph, int v) + int gp_GetNextEdge(graphP theGraph, int v) + int gp_GetDirection(graphP theGraph, int v) cdef extern from "../c/graphLib/lowLevelUtils/appconst.h": - cdef int OK, NOTOK, NULL + int OK, NOTOK, NULL cdef extern from "../c/graphLib/graph.h": - cdef int WRITE_ADJLIST + int WRITE_ADJLIST cdef extern from "../c/graphLib/graphStructures.h": - cdef int EMBEDFLAGS_PLANAR, NONEMBEDDABLE, EMBEDFLAGS_DRAWPLANAR - cdef int EDGEFLAG_DIRECTION_INONLY, EDGEFLAG_DIRECTION_OUTONLY + int EMBEDFLAGS_PLANAR, NONEMBEDDABLE, EMBEDFLAGS_DRAWPLANAR + int EDGEFLAG_DIRECTION_INONLY, EDGEFLAG_DIRECTION_OUTONLY - cdef graphP gp_New() - cdef void gp_Free(graphP *pGraph) - cdef int gp_InitGraph(graphP theGraph, int N) - cdef int gp_AddEdge(graphP theGraph, int u, int ulink, int v, int vlink) - cdef int gp_Embed(graphP theGraph, int embedFlags) - cdef int gp_Write(graphP theGraph, char *FileName, int Mode) - cdef void gp_SortVertices(graphP theGraph) + graphP gp_New() + void gp_Free(graphP *pGraph) + int gp_InitGraph(graphP theGraph, int N) + int gp_AddEdge(graphP theGraph, int u, int ulink, int v, int vlink) + int gp_Embed(graphP theGraph, int embedFlags) + int gp_Write(graphP theGraph, char *FileName, int Mode) + void gp_SortVertices(graphP theGraph) + + int gp_ExtendWith_Planarity(graphP theGraph) + int gp_ExtendWith_Outerplanarity(graphP theGraph) cdef extern from "../c/graphLib/planarityRelated/graphDrawPlanar.h": - cdef int gp_DrawPlanar_RenderToString(graphP theEmbedding, char **pRenditionString); - cdef int gp_AttachDrawPlanar(graphP theGraph) + int gp_DrawPlanar_RenderToString(graphP theEmbedding, char **pRenditionString); + int gp_ExtendWith_DrawPlanar(graphP theGraph) cdef extern from "../c/graphLib/planarityRelated/graphDrawPlanar.private.h": @@ -60,5 +63,5 @@ cdef extern from "../c/graphLib/planarityRelated/graphDrawPlanar.private.h": DrawPlanar_VertexInfoP VI cdef extern from "../c/graphLib/extensionSystem/graphExtensions.h": - cdef void * gp_GetExtension(graphP theGraph, int moduleID) - cdef int gp_FindExtension(graphP theGraph, int moduleID, void *pContext) + void * gp_GetExtension(graphP theGraph, int moduleID) + int gp_FindExtension(graphP theGraph, int moduleID, void *pContext) diff --git a/planarity/classic/planarity.c b/planarity/classic/planarity.c index c5fbb3c..cf9068f 100644 --- a/planarity/classic/planarity.c +++ b/planarity/classic/planarity.c @@ -2580,7 +2580,7 @@ typedef struct { __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; PyObject *__pyx_tuple[1]; PyObject *__pyx_codeobj_tab[11]; - PyObject *__pyx_string_tab[98]; + PyObject *__pyx_string_tab[99]; PyObject *__pyx_number_tab[1]; /* #### Code section: module_state_contents ### */ /* CommonTypesMetaclass.module_state_decls */ @@ -2633,93 +2633,94 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati #define __pyx_kp_u_planarity_Unknown_error __pyx_string_tab[8] #define __pyx_kp_u_planarity_classic_planarity_pyx __pyx_string_tab[9] #define __pyx_kp_u_planarity_failed_adding_edge __pyx_string_tab[10] -#define __pyx_kp_u_planarity_failed_attaching_drawp __pyx_string_tab[11] -#define __pyx_kp_u_planarity_failed_to_initialize_g __pyx_string_tab[12] -#define __pyx_kp_u_planarity_graph_not_planar __pyx_string_tab[13] -#define __pyx_kp_u_self_theGraph_cannot_be_converte __pyx_string_tab[14] -#define __pyx_kp_u_stringsource __pyx_string_tab[15] -#define __pyx_n_u_DRAWPLANAR_ID __pyx_string_tab[16] -#define __pyx_n_u_PGraph __pyx_string_tab[17] -#define __pyx_n_u_PGraph___reduce_cython __pyx_string_tab[18] -#define __pyx_n_u_PGraph___setstate_cython __pyx_string_tab[19] -#define __pyx_n_u_PGraph_ascii __pyx_string_tab[20] -#define __pyx_n_u_PGraph_edges __pyx_string_tab[21] -#define __pyx_n_u_PGraph_embed_drawplanar __pyx_string_tab[22] -#define __pyx_n_u_PGraph_embed_planar __pyx_string_tab[23] -#define __pyx_n_u_PGraph_is_planar __pyx_string_tab[24] -#define __pyx_n_u_PGraph_kuratowski_edges __pyx_string_tab[25] -#define __pyx_n_u_PGraph_mapping __pyx_string_tab[26] -#define __pyx_n_u_PGraph_nodes __pyx_string_tab[27] -#define __pyx_n_u_PGraph_write __pyx_string_tab[28] -#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[29] -#define __pyx_n_u_ascii __pyx_string_tab[30] -#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[31] -#define __pyx_n_u_bpath __pyx_string_tab[32] -#define __pyx_n_u_cline_in_traceback __pyx_string_tab[33] -#define __pyx_n_u_context __pyx_string_tab[34] -#define __pyx_n_u_data __pyx_string_tab[35] -#define __pyx_n_u_drawing __pyx_string_tab[36] -#define __pyx_n_u_e __pyx_string_tab[37] -#define __pyx_n_u_edges __pyx_string_tab[38] -#define __pyx_n_u_embed_drawplanar __pyx_string_tab[39] -#define __pyx_n_u_embed_planar __pyx_string_tab[40] -#define __pyx_n_u_encode __pyx_string_tab[41] -#define __pyx_n_u_end __pyx_string_tab[42] -#define __pyx_n_u_extend __pyx_string_tab[43] -#define __pyx_n_u_first __pyx_string_tab[44] -#define __pyx_n_u_func __pyx_string_tab[45] -#define __pyx_n_u_getstate __pyx_string_tab[46] -#define __pyx_n_u_graph __pyx_string_tab[47] -#define __pyx_n_u_is_coroutine __pyx_string_tab[48] -#define __pyx_n_u_is_planar __pyx_string_tab[49] -#define __pyx_n_u_isarc __pyx_string_tab[50] -#define __pyx_n_u_items __pyx_string_tab[51] -#define __pyx_n_u_keys __pyx_string_tab[52] -#define __pyx_n_u_kuratowski_edges __pyx_string_tab[53] -#define __pyx_n_u_last __pyx_string_tab[54] -#define __pyx_n_u_main __pyx_string_tab[55] -#define __pyx_n_u_mapping __pyx_string_tab[56] -#define __pyx_n_u_module __pyx_string_tab[57] -#define __pyx_n_u_n __pyx_string_tab[58] -#define __pyx_n_u_name __pyx_string_tab[59] -#define __pyx_n_u_nbr __pyx_string_tab[60] -#define __pyx_n_u_nodes __pyx_string_tab[61] -#define __pyx_n_u_path __pyx_string_tab[62] -#define __pyx_n_u_planarity_classic_planarity __pyx_string_tab[63] -#define __pyx_n_u_pop __pyx_string_tab[64] -#define __pyx_n_u_pos __pyx_string_tab[65] -#define __pyx_n_u_py_bytes __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_r __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_s __pyx_string_tab[73] -#define __pyx_n_u_self __pyx_string_tab[74] -#define __pyx_n_u_set_name __pyx_string_tab[75] -#define __pyx_n_u_setdefault __pyx_string_tab[76] -#define __pyx_n_u_setstate __pyx_string_tab[77] -#define __pyx_n_u_setstate_cython __pyx_string_tab[78] -#define __pyx_n_u_start __pyx_string_tab[79] -#define __pyx_n_u_status __pyx_string_tab[80] -#define __pyx_n_u_test __pyx_string_tab[81] -#define __pyx_n_u_update __pyx_string_tab[82] -#define __pyx_n_u_values __pyx_string_tab[83] -#define __pyx_n_u_warn __pyx_string_tab[84] -#define __pyx_n_u_warnings __pyx_string_tab[85] -#define __pyx_n_u_write __pyx_string_tab[86] -#define __pyx_n_u_zip __pyx_string_tab[87] -#define __pyx_kp_b_iso88591_A_4_Q_y_Q78_at1 __pyx_string_tab[88] -#define __pyx_kp_b_iso88591_A_4z_1_M_4vQe1_aq __pyx_string_tab[89] -#define __pyx_kp_b_iso88591_A_M_D_1_q __pyx_string_tab[90] -#define __pyx_kp_b_iso88591_A_d_4 __pyx_string_tab[91] -#define __pyx_kp_b_iso88591_A_q_A_7_q_aq_9AT_78_7_q_aq_4q __pyx_string_tab[92] -#define __pyx_kp_b_iso88591_A_q_Q_8_1A_AQ_xwaq __pyx_string_tab[93] -#define __pyx_kp_b_iso88591_A_t1 __pyx_string_tab[94] -#define __pyx_kp_b_iso88591_Q __pyx_string_tab[95] -#define __pyx_kp_b_iso88591_a_1D_5Qa_4q_Zq_a_a_E_avQ_q_Q_7 __pyx_string_tab[96] -#define __pyx_kp_b_iso88591_a_1D_5Qa_a_a_4q_Zq_E_avQ_q_Ja_I __pyx_string_tab[97] +#define __pyx_kp_u_planarity_failed_to_extend_graph __pyx_string_tab[11] +#define __pyx_kp_u_planarity_failed_to_extend_graph_2 __pyx_string_tab[12] +#define __pyx_kp_u_planarity_failed_to_initialize_g __pyx_string_tab[13] +#define __pyx_kp_u_planarity_graph_not_planar __pyx_string_tab[14] +#define __pyx_kp_u_self_theGraph_cannot_be_converte __pyx_string_tab[15] +#define __pyx_kp_u_stringsource __pyx_string_tab[16] +#define __pyx_n_u_DRAWPLANAR_ID __pyx_string_tab[17] +#define __pyx_n_u_PGraph __pyx_string_tab[18] +#define __pyx_n_u_PGraph___reduce_cython __pyx_string_tab[19] +#define __pyx_n_u_PGraph___setstate_cython __pyx_string_tab[20] +#define __pyx_n_u_PGraph_ascii __pyx_string_tab[21] +#define __pyx_n_u_PGraph_edges __pyx_string_tab[22] +#define __pyx_n_u_PGraph_embed_drawplanar __pyx_string_tab[23] +#define __pyx_n_u_PGraph_embed_planar __pyx_string_tab[24] +#define __pyx_n_u_PGraph_is_planar __pyx_string_tab[25] +#define __pyx_n_u_PGraph_kuratowski_edges __pyx_string_tab[26] +#define __pyx_n_u_PGraph_mapping __pyx_string_tab[27] +#define __pyx_n_u_PGraph_nodes __pyx_string_tab[28] +#define __pyx_n_u_PGraph_write __pyx_string_tab[29] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[30] +#define __pyx_n_u_ascii __pyx_string_tab[31] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[32] +#define __pyx_n_u_bpath __pyx_string_tab[33] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[34] +#define __pyx_n_u_context __pyx_string_tab[35] +#define __pyx_n_u_data __pyx_string_tab[36] +#define __pyx_n_u_drawing __pyx_string_tab[37] +#define __pyx_n_u_e __pyx_string_tab[38] +#define __pyx_n_u_edges __pyx_string_tab[39] +#define __pyx_n_u_embed_drawplanar __pyx_string_tab[40] +#define __pyx_n_u_embed_planar __pyx_string_tab[41] +#define __pyx_n_u_encode __pyx_string_tab[42] +#define __pyx_n_u_end __pyx_string_tab[43] +#define __pyx_n_u_extend __pyx_string_tab[44] +#define __pyx_n_u_first __pyx_string_tab[45] +#define __pyx_n_u_func __pyx_string_tab[46] +#define __pyx_n_u_getstate __pyx_string_tab[47] +#define __pyx_n_u_graph __pyx_string_tab[48] +#define __pyx_n_u_is_coroutine __pyx_string_tab[49] +#define __pyx_n_u_is_edge __pyx_string_tab[50] +#define __pyx_n_u_is_planar __pyx_string_tab[51] +#define __pyx_n_u_items __pyx_string_tab[52] +#define __pyx_n_u_keys __pyx_string_tab[53] +#define __pyx_n_u_kuratowski_edges __pyx_string_tab[54] +#define __pyx_n_u_last __pyx_string_tab[55] +#define __pyx_n_u_main __pyx_string_tab[56] +#define __pyx_n_u_mapping __pyx_string_tab[57] +#define __pyx_n_u_module __pyx_string_tab[58] +#define __pyx_n_u_n __pyx_string_tab[59] +#define __pyx_n_u_name __pyx_string_tab[60] +#define __pyx_n_u_nbr __pyx_string_tab[61] +#define __pyx_n_u_nodes __pyx_string_tab[62] +#define __pyx_n_u_path __pyx_string_tab[63] +#define __pyx_n_u_planarity_classic_planarity __pyx_string_tab[64] +#define __pyx_n_u_pop __pyx_string_tab[65] +#define __pyx_n_u_pos __pyx_string_tab[66] +#define __pyx_n_u_py_bytes __pyx_string_tab[67] +#define __pyx_n_u_pyx_state __pyx_string_tab[68] +#define __pyx_n_u_qualname __pyx_string_tab[69] +#define __pyx_n_u_r __pyx_string_tab[70] +#define __pyx_n_u_reduce __pyx_string_tab[71] +#define __pyx_n_u_reduce_cython __pyx_string_tab[72] +#define __pyx_n_u_reduce_ex __pyx_string_tab[73] +#define __pyx_n_u_s __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_start __pyx_string_tab[80] +#define __pyx_n_u_status __pyx_string_tab[81] +#define __pyx_n_u_test __pyx_string_tab[82] +#define __pyx_n_u_update __pyx_string_tab[83] +#define __pyx_n_u_values __pyx_string_tab[84] +#define __pyx_n_u_warn __pyx_string_tab[85] +#define __pyx_n_u_warnings __pyx_string_tab[86] +#define __pyx_n_u_write __pyx_string_tab[87] +#define __pyx_n_u_zip __pyx_string_tab[88] +#define __pyx_kp_b_iso88591_A_4AT_7_q_aq_9AT_78_7_q_aq_4q __pyx_string_tab[89] +#define __pyx_kp_b_iso88591_A_4_Q_31D_7_q_aq_9AT_67_4q __pyx_string_tab[90] +#define __pyx_kp_b_iso88591_A_4z_1_M_4vQe1_aq __pyx_string_tab[91] +#define __pyx_kp_b_iso88591_A_M_D_1_q __pyx_string_tab[92] +#define __pyx_kp_b_iso88591_A_d_4 __pyx_string_tab[93] +#define __pyx_kp_b_iso88591_A_q_Q_8_1A_AQ_xwaq __pyx_string_tab[94] +#define __pyx_kp_b_iso88591_A_t1 __pyx_string_tab[95] +#define __pyx_kp_b_iso88591_Q __pyx_string_tab[96] +#define __pyx_kp_b_iso88591_a_1D_5Qa_4q_Zq_a_a_E_avQ_q_Q_7 __pyx_string_tab[97] +#define __pyx_kp_b_iso88591_a_1D_5Qa_a_a_4q_Zq_E_avQ_Zq_j_A __pyx_string_tab[98] #define __pyx_int_1 __pyx_number_tab[0] /* #### Code section: module_state_clear ### */ #if CYTHON_USE_MODULE_STATE @@ -2739,7 +2740,7 @@ static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_type_9planarity_7classic_9planarity_PGraph); for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); } for (int i=0; i<11; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } - for (int i=0; i<98; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } + for (int i=0; i<99; ++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 */ @@ -2767,7 +2768,7 @@ static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void Py_VISIT(traverse_module_state->__pyx_type_9planarity_7classic_9planarity_PGraph); for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); } for (int i=0; i<11; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } - for (int i=0; i<98; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } + for (int i=0; i<99; ++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 */ @@ -4023,8 +4024,8 @@ static void __pyx_pf_9planarity_7classic_9planarity_6PGraph_2__dealloc__(struct * * * def embed_planar(self): # <<<<<<<<<<<<<< - * if self.embedding == 0: - * self.embedding = cplanarity.gp_Embed(self.theGraph, + * if self.embedding != 0: + * return */ /* Python wrapper */ @@ -4071,68 +4072,141 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_4embed_planar(struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self) { + int __pyx_v_status; 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("embed_planar", 0); /* "planarity/classic/planarity.pyx":69 * * def embed_planar(self): - * if self.embedding == 0: # <<<<<<<<<<<<<< - * self.embedding = cplanarity.gp_Embed(self.theGraph, - * cplanarity.EMBEDFLAGS_PLANAR) + * if self.embedding != 0: # <<<<<<<<<<<<<< + * return + * */ - __pyx_t_1 = (__pyx_v_self->embedding == 0); + __pyx_t_1 = (__pyx_v_self->embedding != 0); if (__pyx_t_1) { /* "planarity/classic/planarity.pyx":70 * def embed_planar(self): - * if self.embedding == 0: - * self.embedding = cplanarity.gp_Embed(self.theGraph, # <<<<<<<<<<<<<< - * cplanarity.EMBEDFLAGS_PLANAR) - * cplanarity.gp_SortVertices(self.theGraph) + * if self.embedding != 0: + * return # <<<<<<<<<<<<<< + * + * status = cplanarity.gp_ExtendWith_Planarity(self.theGraph) */ - __pyx_v_self->embedding = gp_Embed(__pyx_v_self->theGraph, EMBEDFLAGS_PLANAR); + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* "planarity/classic/planarity.pyx":72 - * self.embedding = cplanarity.gp_Embed(self.theGraph, - * cplanarity.EMBEDFLAGS_PLANAR) - * cplanarity.gp_SortVertices(self.theGraph) # <<<<<<<<<<<<<< + /* "planarity/classic/planarity.pyx":69 * + * def embed_planar(self): + * if self.embedding != 0: # <<<<<<<<<<<<<< + * return * */ - gp_SortVertices(__pyx_v_self->theGraph); + } - /* "planarity/classic/planarity.pyx":69 + /* "planarity/classic/planarity.pyx":72 + * return * - * def embed_planar(self): - * if self.embedding == 0: # <<<<<<<<<<<<<< - * self.embedding = cplanarity.gp_Embed(self.theGraph, - * cplanarity.EMBEDFLAGS_PLANAR) + * status = cplanarity.gp_ExtendWith_Planarity(self.theGraph) # <<<<<<<<<<<<<< + * if status == cplanarity.NOTOK: + * raise RuntimeError("planarity: failed to extend graph with planarity structures.") +*/ + __pyx_v_status = gp_ExtendWith_Planarity(__pyx_v_self->theGraph); + + /* "planarity/classic/planarity.pyx":73 + * + * status = cplanarity.gp_ExtendWith_Planarity(self.theGraph) + * if status == cplanarity.NOTOK: # <<<<<<<<<<<<<< + * raise RuntimeError("planarity: failed to extend graph with planarity structures.") + * self.embedding = cplanarity.gp_Embed(self.theGraph, +*/ + __pyx_t_1 = (__pyx_v_status == NOTOK); + if (unlikely(__pyx_t_1)) { + + /* "planarity/classic/planarity.pyx":74 + * status = cplanarity.gp_ExtendWith_Planarity(self.theGraph) + * if status == cplanarity.NOTOK: + * raise RuntimeError("planarity: failed to extend graph with planarity structures.") # <<<<<<<<<<<<<< + * self.embedding = cplanarity.gp_Embed(self.theGraph, + * cplanarity.EMBEDFLAGS_PLANAR) +*/ + __pyx_t_3 = NULL; + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_planarity_failed_to_extend_graph}; + __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, 74, __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, 74, __pyx_L1_error) + + /* "planarity/classic/planarity.pyx":73 + * + * status = cplanarity.gp_ExtendWith_Planarity(self.theGraph) + * if status == cplanarity.NOTOK: # <<<<<<<<<<<<<< + * raise RuntimeError("planarity: failed to extend graph with planarity structures.") + * self.embedding = cplanarity.gp_Embed(self.theGraph, */ } + /* "planarity/classic/planarity.pyx":75 + * if status == cplanarity.NOTOK: + * raise RuntimeError("planarity: failed to extend graph with planarity structures.") + * self.embedding = cplanarity.gp_Embed(self.theGraph, # <<<<<<<<<<<<<< + * cplanarity.EMBEDFLAGS_PLANAR) + * cplanarity.gp_SortVertices(self.theGraph) +*/ + __pyx_v_self->embedding = gp_Embed(__pyx_v_self->theGraph, EMBEDFLAGS_PLANAR); + + /* "planarity/classic/planarity.pyx":77 + * self.embedding = cplanarity.gp_Embed(self.theGraph, + * cplanarity.EMBEDFLAGS_PLANAR) + * cplanarity.gp_SortVertices(self.theGraph) # <<<<<<<<<<<<<< + * + * +*/ + gp_SortVertices(__pyx_v_self->theGraph); + /* "planarity/classic/planarity.pyx":68 * * * def embed_planar(self): # <<<<<<<<<<<<<< - * if self.embedding == 0: - * self.embedding = cplanarity.gp_Embed(self.theGraph, + * if self.embedding != 0: + * return */ /* 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.classic.planarity.PGraph.embed_planar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "planarity/classic/planarity.pyx":75 +/* "planarity/classic/planarity.pyx":80 * * * def embed_drawplanar(self): # <<<<<<<<<<<<<< - * status = cplanarity.gp_AttachDrawPlanar(self.theGraph) + * status = cplanarity.gp_ExtendWith_DrawPlanar(self.theGraph) * if status == cplanarity.NOTOK: */ @@ -4192,64 +4266,64 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_6embed_drawplan int __pyx_clineno = 0; __Pyx_RefNannySetupContext("embed_drawplanar", 0); - /* "planarity/classic/planarity.pyx":76 + /* "planarity/classic/planarity.pyx":81 * * def embed_drawplanar(self): - * status = cplanarity.gp_AttachDrawPlanar(self.theGraph) # <<<<<<<<<<<<<< + * status = cplanarity.gp_ExtendWith_DrawPlanar(self.theGraph) # <<<<<<<<<<<<<< * if status == cplanarity.NOTOK: - * raise RuntimeError("planarity: failed attaching drawplanar.") + * raise RuntimeError("planarity: failed to extend graph with drawplanar structures.") */ - __pyx_v_status = gp_AttachDrawPlanar(__pyx_v_self->theGraph); + __pyx_v_status = gp_ExtendWith_DrawPlanar(__pyx_v_self->theGraph); - /* "planarity/classic/planarity.pyx":77 + /* "planarity/classic/planarity.pyx":82 * def embed_drawplanar(self): - * status = cplanarity.gp_AttachDrawPlanar(self.theGraph) + * status = cplanarity.gp_ExtendWith_DrawPlanar(self.theGraph) * if status == cplanarity.NOTOK: # <<<<<<<<<<<<<< - * raise RuntimeError("planarity: failed attaching drawplanar.") + * raise RuntimeError("planarity: failed to extend graph with drawplanar structures.") * status = cplanarity.gp_Embed(self.theGraph, */ __pyx_t_1 = (__pyx_v_status == NOTOK); if (unlikely(__pyx_t_1)) { - /* "planarity/classic/planarity.pyx":78 - * status = cplanarity.gp_AttachDrawPlanar(self.theGraph) + /* "planarity/classic/planarity.pyx":83 + * status = cplanarity.gp_ExtendWith_DrawPlanar(self.theGraph) * if status == cplanarity.NOTOK: - * raise RuntimeError("planarity: failed attaching drawplanar.") # <<<<<<<<<<<<<< + * raise RuntimeError("planarity: failed to extend graph with drawplanar structures.") # <<<<<<<<<<<<<< * status = cplanarity.gp_Embed(self.theGraph, * cplanarity.EMBEDFLAGS_DRAWPLANAR) */ __pyx_t_3 = NULL; __pyx_t_4 = 1; { - PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_planarity_failed_attaching_drawp}; + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_planarity_failed_to_extend_graph_2}; __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, 78, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __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, 78, __pyx_L1_error) + __PYX_ERR(0, 83, __pyx_L1_error) - /* "planarity/classic/planarity.pyx":77 + /* "planarity/classic/planarity.pyx":82 * def embed_drawplanar(self): - * status = cplanarity.gp_AttachDrawPlanar(self.theGraph) + * status = cplanarity.gp_ExtendWith_DrawPlanar(self.theGraph) * if status == cplanarity.NOTOK: # <<<<<<<<<<<<<< - * raise RuntimeError("planarity: failed attaching drawplanar.") + * raise RuntimeError("planarity: failed to extend graph with drawplanar structures.") * status = cplanarity.gp_Embed(self.theGraph, */ } - /* "planarity/classic/planarity.pyx":79 + /* "planarity/classic/planarity.pyx":84 * if status == cplanarity.NOTOK: - * raise RuntimeError("planarity: failed attaching drawplanar.") + * raise RuntimeError("planarity: failed to extend graph with drawplanar structures.") * status = cplanarity.gp_Embed(self.theGraph, # <<<<<<<<<<<<<< * cplanarity.EMBEDFLAGS_DRAWPLANAR) * if status == cplanarity.NONEMBEDDABLE: */ __pyx_v_status = gp_Embed(__pyx_v_self->theGraph, EMBEDFLAGS_DRAWPLANAR); - /* "planarity/classic/planarity.pyx":81 + /* "planarity/classic/planarity.pyx":86 * status = cplanarity.gp_Embed(self.theGraph, * cplanarity.EMBEDFLAGS_DRAWPLANAR) * if status == cplanarity.NONEMBEDDABLE: # <<<<<<<<<<<<<< @@ -4259,7 +4333,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_6embed_drawplan __pyx_t_1 = (__pyx_v_status == NONEMBEDDABLE); if (unlikely(__pyx_t_1)) { - /* "planarity/classic/planarity.pyx":82 + /* "planarity/classic/planarity.pyx":87 * cplanarity.EMBEDFLAGS_DRAWPLANAR) * if status == cplanarity.NONEMBEDDABLE: * raise RuntimeError("planarity: graph not planar.") # <<<<<<<<<<<<<< @@ -4272,14 +4346,14 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_6embed_drawplan PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_planarity_graph_not_planar}; __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, 82, __pyx_L1_error) + 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, 82, __pyx_L1_error) + __PYX_ERR(0, 87, __pyx_L1_error) - /* "planarity/classic/planarity.pyx":81 + /* "planarity/classic/planarity.pyx":86 * status = cplanarity.gp_Embed(self.theGraph, * cplanarity.EMBEDFLAGS_DRAWPLANAR) * if status == cplanarity.NONEMBEDDABLE: # <<<<<<<<<<<<<< @@ -4288,7 +4362,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_6embed_drawplan */ } - /* "planarity/classic/planarity.pyx":83 + /* "planarity/classic/planarity.pyx":88 * if status == cplanarity.NONEMBEDDABLE: * raise RuntimeError("planarity: graph not planar.") * cplanarity.gp_SortVertices(self.theGraph) # <<<<<<<<<<<<<< @@ -4297,11 +4371,11 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_6embed_drawplan */ gp_SortVertices(__pyx_v_self->theGraph); - /* "planarity/classic/planarity.pyx":75 + /* "planarity/classic/planarity.pyx":80 * * * def embed_drawplanar(self): # <<<<<<<<<<<<<< - * status = cplanarity.gp_AttachDrawPlanar(self.theGraph) + * status = cplanarity.gp_ExtendWith_DrawPlanar(self.theGraph) * if status == cplanarity.NOTOK: */ @@ -4319,7 +4393,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_6embed_drawplan return __pyx_r; } -/* "planarity/classic/planarity.pyx":86 +/* "planarity/classic/planarity.pyx":91 * * * def is_planar(self): # <<<<<<<<<<<<<< @@ -4382,7 +4456,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_8is_planar(stru int __pyx_clineno = 0; __Pyx_RefNannySetupContext("is_planar", 0); - /* "planarity/classic/planarity.pyx":88 + /* "planarity/classic/planarity.pyx":93 * def is_planar(self): * """Return True if graph is planar.""" * self.embed_planar() # <<<<<<<<<<<<<< @@ -4396,12 +4470,12 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_8is_planar(stru PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_embed_planar, __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, 88, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "planarity/classic/planarity.pyx":89 + /* "planarity/classic/planarity.pyx":94 * """Return True if graph is planar.""" * self.embed_planar() * if self.embedding == cplanarity.NONEMBEDDABLE: # <<<<<<<<<<<<<< @@ -4411,7 +4485,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_8is_planar(stru __pyx_t_4 = (__pyx_v_self->embedding == NONEMBEDDABLE); if (__pyx_t_4) { - /* "planarity/classic/planarity.pyx":90 + /* "planarity/classic/planarity.pyx":95 * self.embed_planar() * if self.embedding == cplanarity.NONEMBEDDABLE: * return False # <<<<<<<<<<<<<< @@ -4423,7 +4497,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_8is_planar(stru __pyx_r = Py_False; goto __pyx_L0; - /* "planarity/classic/planarity.pyx":89 + /* "planarity/classic/planarity.pyx":94 * """Return True if graph is planar.""" * self.embed_planar() * if self.embedding == cplanarity.NONEMBEDDABLE: # <<<<<<<<<<<<<< @@ -4432,7 +4506,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_8is_planar(stru */ } - /* "planarity/classic/planarity.pyx":91 + /* "planarity/classic/planarity.pyx":96 * if self.embedding == cplanarity.NONEMBEDDABLE: * return False * return True # <<<<<<<<<<<<<< @@ -4444,7 +4518,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_8is_planar(stru __pyx_r = Py_True; goto __pyx_L0; - /* "planarity/classic/planarity.pyx":86 + /* "planarity/classic/planarity.pyx":91 * * * def is_planar(self): # <<<<<<<<<<<<<< @@ -4464,7 +4538,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_8is_planar(stru return __pyx_r; } -/* "planarity/classic/planarity.pyx":94 +/* "planarity/classic/planarity.pyx":99 * * * def kuratowski_edges(self): # <<<<<<<<<<<<<< @@ -4528,7 +4602,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_10kuratowski_ed int __pyx_clineno = 0; __Pyx_RefNannySetupContext("kuratowski_edges", 0); - /* "planarity/classic/planarity.pyx":95 + /* "planarity/classic/planarity.pyx":100 * * def kuratowski_edges(self): * if self.is_planar(): # <<<<<<<<<<<<<< @@ -4542,14 +4616,14 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_10kuratowski_ed PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_is_planar, __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, 95, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 95, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_4) { - /* "planarity/classic/planarity.pyx":96 + /* "planarity/classic/planarity.pyx":101 * def kuratowski_edges(self): * if self.is_planar(): * return [] # <<<<<<<<<<<<<< @@ -4557,13 +4631,13 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_10kuratowski_ed * return self.edges(data=False) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/classic/planarity.pyx":95 + /* "planarity/classic/planarity.pyx":100 * * def kuratowski_edges(self): * if self.is_planar(): # <<<<<<<<<<<<<< @@ -4572,7 +4646,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_10kuratowski_ed */ } - /* "planarity/classic/planarity.pyx":97 + /* "planarity/classic/planarity.pyx":102 * if self.is_planar(): * return [] * elif self.embedding == cplanarity.NONEMBEDDABLE: # <<<<<<<<<<<<<< @@ -4582,7 +4656,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_10kuratowski_ed __pyx_t_4 = (__pyx_v_self->embedding == NONEMBEDDABLE); if (likely(__pyx_t_4)) { - /* "planarity/classic/planarity.pyx":98 + /* "planarity/classic/planarity.pyx":103 * return [] * elif self.embedding == cplanarity.NONEMBEDDABLE: * return self.edges(data=False) # <<<<<<<<<<<<<< @@ -4595,20 +4669,20 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_10kuratowski_ed __pyx_t_3 = 0; { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, NULL}; - __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_data, Py_False, __pyx_t_5, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 98, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_data, Py_False, __pyx_t_5, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 103, __pyx_L1_error) __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_edges, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/classic/planarity.pyx":97 + /* "planarity/classic/planarity.pyx":102 * if self.is_planar(): * return [] * elif self.embedding == cplanarity.NONEMBEDDABLE: # <<<<<<<<<<<<<< @@ -4617,7 +4691,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_10kuratowski_ed */ } - /* "planarity/classic/planarity.pyx":100 + /* "planarity/classic/planarity.pyx":105 * return self.edges(data=False) * else: * raise RuntimeError("planarity: Unknown error.") # <<<<<<<<<<<<<< @@ -4631,15 +4705,15 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_10kuratowski_ed PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_planarity_Unknown_error}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __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, 100, __pyx_L1_error) + __PYX_ERR(0, 105, __pyx_L1_error) } - /* "planarity/classic/planarity.pyx":94 + /* "planarity/classic/planarity.pyx":99 * * * def kuratowski_edges(self): # <<<<<<<<<<<<<< @@ -4660,7 +4734,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_10kuratowski_ed return __pyx_r; } -/* "planarity/classic/planarity.pyx":103 +/* "planarity/classic/planarity.pyx":108 * * * def nodes(self,data=False): # <<<<<<<<<<<<<< @@ -4708,24 +4782,24 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_data,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, 103, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 108, __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, 103, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 108, __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, "nodes", 0) < (0)) __PYX_ERR(0, 103, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "nodes", 0) < (0)) __PYX_ERR(0, 108, __pyx_L3_error) if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False)); } else { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 103, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 108, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; @@ -4736,7 +4810,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("nodes", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 103, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("nodes", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 108, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4786,7 +4860,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_12nodes(struct __Pyx_RefNannySetupContext("nodes", 0); __Pyx_INCREF(__pyx_v_data); - /* "planarity/classic/planarity.pyx":104 + /* "planarity/classic/planarity.pyx":109 * * def nodes(self,data=False): * DRAWPLANAR_ID=1 # <<<<<<<<<<<<<< @@ -4795,7 +4869,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_12nodes(struct */ __pyx_v_DRAWPLANAR_ID = 1; - /* "planarity/classic/planarity.pyx":106 + /* "planarity/classic/planarity.pyx":111 * DRAWPLANAR_ID=1 * cdef cplanarity.DrawPlanarContext *context * drawing=cplanarity.gp_FindExtension(self.theGraph, # <<<<<<<<<<<<<< @@ -4804,7 +4878,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_12nodes(struct */ __pyx_v_drawing = gp_FindExtension(__pyx_v_self->theGraph, __pyx_v_DRAWPLANAR_ID, ((void *)(&__pyx_v_context))); - /* "planarity/classic/planarity.pyx":110 + /* "planarity/classic/planarity.pyx":115 * &context) * * first=cplanarity.gp_GetFirstVertex(self.theGraph) # <<<<<<<<<<<<<< @@ -4813,7 +4887,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_12nodes(struct */ __pyx_v_first = gp_GetFirstVertex(__pyx_v_self->theGraph); - /* "planarity/classic/planarity.pyx":111 + /* "planarity/classic/planarity.pyx":116 * * first=cplanarity.gp_GetFirstVertex(self.theGraph) * last=cplanarity.gp_GetLastVertex(self.theGraph)+1 # <<<<<<<<<<<<<< @@ -4822,7 +4896,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_12nodes(struct */ __pyx_v_last = (gp_GetLastVertex(__pyx_v_self->theGraph) + 1); - /* "planarity/classic/planarity.pyx":112 + /* "planarity/classic/planarity.pyx":117 * first=cplanarity.gp_GetFirstVertex(self.theGraph) * last=cplanarity.gp_GetLastVertex(self.theGraph)+1 * r=self.reverse_nodemap # <<<<<<<<<<<<<< @@ -4834,19 +4908,19 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_12nodes(struct __pyx_v_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "planarity/classic/planarity.pyx":113 + /* "planarity/classic/planarity.pyx":118 * last=cplanarity.gp_GetLastVertex(self.theGraph)+1 * r=self.reverse_nodemap * nodes=[] # <<<<<<<<<<<<<< * for n in range(first,last): * if data: */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_nodes = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "planarity/classic/planarity.pyx":114 + /* "planarity/classic/planarity.pyx":119 * r=self.reverse_nodemap * nodes=[] * for n in range(first,last): # <<<<<<<<<<<<<< @@ -4858,29 +4932,29 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_12nodes(struct for (__pyx_t_4 = __pyx_v_first; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_n = __pyx_t_4; - /* "planarity/classic/planarity.pyx":115 + /* "planarity/classic/planarity.pyx":120 * nodes=[] * for n in range(first,last): * if data: # <<<<<<<<<<<<<< * data={} * if drawing==1: */ - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_data); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 115, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_data); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 120, __pyx_L1_error) if (__pyx_t_5) { - /* "planarity/classic/planarity.pyx":116 + /* "planarity/classic/planarity.pyx":121 * for n in range(first,last): * if data: * data={} # <<<<<<<<<<<<<< * if drawing==1: * data.update(pos=context.VI[n].pos, */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF_SET(__pyx_v_data, __pyx_t_1); __pyx_t_1 = 0; - /* "planarity/classic/planarity.pyx":117 + /* "planarity/classic/planarity.pyx":122 * if data: * data={} * if drawing==1: # <<<<<<<<<<<<<< @@ -4890,7 +4964,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_12nodes(struct __pyx_t_5 = (__pyx_v_drawing == 1); if (__pyx_t_5) { - /* "planarity/classic/planarity.pyx":118 + /* "planarity/classic/planarity.pyx":123 * data={} * if drawing==1: * data.update(pos=context.VI[n].pos, # <<<<<<<<<<<<<< @@ -4899,48 +4973,48 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_12nodes(struct */ __pyx_t_6 = __pyx_v_data; __Pyx_INCREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyLong_From_int((__pyx_v_context->VI[__pyx_v_n]).pos); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyLong_From_int((__pyx_v_context->VI[__pyx_v_n]).pos); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - /* "planarity/classic/planarity.pyx":119 + /* "planarity/classic/planarity.pyx":124 * if drawing==1: * data.update(pos=context.VI[n].pos, * start=context.VI[n].start, # <<<<<<<<<<<<<< * end=context.VI[n].end) * nodes.append((r[n],data)) */ - __pyx_t_8 = __Pyx_PyLong_From_int((__pyx_v_context->VI[__pyx_v_n]).start); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 119, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyLong_From_int((__pyx_v_context->VI[__pyx_v_n]).start); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - /* "planarity/classic/planarity.pyx":120 + /* "planarity/classic/planarity.pyx":125 * data.update(pos=context.VI[n].pos, * start=context.VI[n].start, * end=context.VI[n].end) # <<<<<<<<<<<<<< * nodes.append((r[n],data)) * else: */ - __pyx_t_9 = __Pyx_PyLong_From_int((__pyx_v_context->VI[__pyx_v_n]).end); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyLong_From_int((__pyx_v_context->VI[__pyx_v_n]).end); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = 0; { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_6, NULL}; - __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_pos, __pyx_t_7, __pyx_t_11, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 118, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_start, __pyx_t_8, __pyx_t_11, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 118, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_end, __pyx_t_9, __pyx_t_11, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 118, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_pos, __pyx_t_7, __pyx_t_11, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 123, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_start, __pyx_t_8, __pyx_t_11, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 123, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_end, __pyx_t_9, __pyx_t_11, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 123, __pyx_L1_error) __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_10, (1-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_11); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "planarity/classic/planarity.pyx":117 + /* "planarity/classic/planarity.pyx":122 * if data: * data={} * if drawing==1: # <<<<<<<<<<<<<< @@ -4949,7 +5023,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_12nodes(struct */ } - /* "planarity/classic/planarity.pyx":121 + /* "planarity/classic/planarity.pyx":126 * start=context.VI[n].start, * end=context.VI[n].end) * nodes.append((r[n],data)) # <<<<<<<<<<<<<< @@ -4958,25 +5032,25 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_12nodes(struct */ if (unlikely(__pyx_v_r == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 121, __pyx_L1_error) + __PYX_ERR(0, 126, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = __Pyx_PyDict_GetItem(__pyx_v_r, __pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyDict_GetItem(__pyx_v_r, __pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_11); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_11) != (0)) __PYX_ERR(0, 121, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_11) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); __Pyx_INCREF(__pyx_v_data); __Pyx_GIVEREF(__pyx_v_data); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_data) != (0)) __PYX_ERR(0, 121, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_data) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); __pyx_t_11 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_nodes, __pyx_t_1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_nodes, __pyx_t_1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "planarity/classic/planarity.pyx":115 + /* "planarity/classic/planarity.pyx":120 * nodes=[] * for n in range(first,last): * if data: # <<<<<<<<<<<<<< @@ -4986,7 +5060,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_12nodes(struct goto __pyx_L5; } - /* "planarity/classic/planarity.pyx":123 + /* "planarity/classic/planarity.pyx":128 * nodes.append((r[n],data)) * else: * nodes.append((r[n])) # <<<<<<<<<<<<<< @@ -4996,20 +5070,20 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_12nodes(struct /*else*/ { if (unlikely(__pyx_v_r == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 123, __pyx_L1_error) + __PYX_ERR(0, 128, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = __Pyx_PyDict_GetItem(__pyx_v_r, __pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyDict_GetItem(__pyx_v_r, __pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_nodes, __pyx_t_11); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_nodes, __pyx_t_11); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } __pyx_L5:; } - /* "planarity/classic/planarity.pyx":124 + /* "planarity/classic/planarity.pyx":129 * else: * nodes.append((r[n])) * return nodes # <<<<<<<<<<<<<< @@ -5021,7 +5095,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_12nodes(struct __pyx_r = __pyx_v_nodes; goto __pyx_L0; - /* "planarity/classic/planarity.pyx":103 + /* "planarity/classic/planarity.pyx":108 * * * def nodes(self,data=False): # <<<<<<<<<<<<<< @@ -5048,7 +5122,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_12nodes(struct return __pyx_r; } -/* "planarity/classic/planarity.pyx":127 +/* "planarity/classic/planarity.pyx":132 * * * def edges(self,data=False): # <<<<<<<<<<<<<< @@ -5096,24 +5170,24 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_data,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, 127, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 132, __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, 127, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 132, __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, "edges", 0) < (0)) __PYX_ERR(0, 127, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "edges", 0) < (0)) __PYX_ERR(0, 132, __pyx_L3_error) if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False)); } else { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 127, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 132, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; @@ -5124,7 +5198,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("edges", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 127, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("edges", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 132, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -5155,7 +5229,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct long __pyx_v_last; long __pyx_v_n; int __pyx_v_e; - int __pyx_v_isarc; + int __pyx_v_is_edge; int __pyx_v_nbr; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -5177,7 +5251,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct __Pyx_RefNannySetupContext("edges", 0); __Pyx_INCREF(__pyx_v_data); - /* "planarity/classic/planarity.pyx":128 + /* "planarity/classic/planarity.pyx":133 * * def edges(self,data=False): * DRAWPLANAR_ID=1 # <<<<<<<<<<<<<< @@ -5186,7 +5260,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct */ __pyx_v_DRAWPLANAR_ID = 1; - /* "planarity/classic/planarity.pyx":130 + /* "planarity/classic/planarity.pyx":135 * DRAWPLANAR_ID=1 * cdef cplanarity.DrawPlanarContext *context * drawing=cplanarity.gp_FindExtension(self.theGraph, # <<<<<<<<<<<<<< @@ -5195,19 +5269,19 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct */ __pyx_v_drawing = gp_FindExtension(__pyx_v_self->theGraph, __pyx_v_DRAWPLANAR_ID, ((void *)(&__pyx_v_context))); - /* "planarity/classic/planarity.pyx":133 + /* "planarity/classic/planarity.pyx":138 * DRAWPLANAR_ID, * &context) * edges=[] # <<<<<<<<<<<<<< * r=self.reverse_nodemap * first=cplanarity.gp_GetFirstVertex(self.theGraph) */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_edges = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "planarity/classic/planarity.pyx":134 + /* "planarity/classic/planarity.pyx":139 * &context) * edges=[] * r=self.reverse_nodemap # <<<<<<<<<<<<<< @@ -5219,7 +5293,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct __pyx_v_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "planarity/classic/planarity.pyx":135 + /* "planarity/classic/planarity.pyx":140 * edges=[] * r=self.reverse_nodemap * first=cplanarity.gp_GetFirstVertex(self.theGraph) # <<<<<<<<<<<<<< @@ -5228,67 +5302,67 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct */ __pyx_v_first = gp_GetFirstVertex(__pyx_v_self->theGraph); - /* "planarity/classic/planarity.pyx":136 + /* "planarity/classic/planarity.pyx":141 * r=self.reverse_nodemap * first=cplanarity.gp_GetFirstVertex(self.theGraph) * last=cplanarity.gp_GetLastVertex(self.theGraph)+1 # <<<<<<<<<<<<<< * for n in range(first,last): - * e=cplanarity.gp_GetFirstArc(self.theGraph,n) + * e=cplanarity.gp_GetFirstEdge(self.theGraph,n) */ __pyx_v_last = (gp_GetLastVertex(__pyx_v_self->theGraph) + 1); - /* "planarity/classic/planarity.pyx":137 + /* "planarity/classic/planarity.pyx":142 * first=cplanarity.gp_GetFirstVertex(self.theGraph) * 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) + * e=cplanarity.gp_GetFirstEdge(self.theGraph,n) + * is_edge=cplanarity.gp_IsEdge(self.theGraph, e) */ __pyx_t_2 = __pyx_v_last; __pyx_t_3 = __pyx_t_2; for (__pyx_t_4 = __pyx_v_first; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_n = __pyx_t_4; - /* "planarity/classic/planarity.pyx":138 + /* "planarity/classic/planarity.pyx":143 * 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) - * while isarc > 0: + * e=cplanarity.gp_GetFirstEdge(self.theGraph,n) # <<<<<<<<<<<<<< + * is_edge=cplanarity.gp_IsEdge(self.theGraph, e) + * while is_edge > 0: */ - __pyx_v_e = gp_GetFirstArc(__pyx_v_self->theGraph, __pyx_v_n); + __pyx_v_e = gp_GetFirstEdge(__pyx_v_self->theGraph, __pyx_v_n); - /* "planarity/classic/planarity.pyx":139 + /* "planarity/classic/planarity.pyx":144 * for n in range(first,last): - * e=cplanarity.gp_GetFirstArc(self.theGraph,n) - * isarc=cplanarity.gp_IsArc(e) # <<<<<<<<<<<<<< - * while isarc > 0: + * e=cplanarity.gp_GetFirstEdge(self.theGraph,n) + * is_edge=cplanarity.gp_IsEdge(self.theGraph, e) # <<<<<<<<<<<<<< + * while is_edge > 0: * nbr=cplanarity.gp_GetNeighbor(self.theGraph,e) */ - __pyx_v_isarc = gp_IsArc(__pyx_v_e); + __pyx_v_is_edge = gp_IsEdge(__pyx_v_self->theGraph, __pyx_v_e); - /* "planarity/classic/planarity.pyx":140 - * e=cplanarity.gp_GetFirstArc(self.theGraph,n) - * isarc=cplanarity.gp_IsArc(e) - * while isarc > 0: # <<<<<<<<<<<<<< + /* "planarity/classic/planarity.pyx":145 + * e=cplanarity.gp_GetFirstEdge(self.theGraph,n) + * is_edge=cplanarity.gp_IsEdge(self.theGraph, e) + * while is_edge > 0: # <<<<<<<<<<<<<< * nbr=cplanarity.gp_GetNeighbor(self.theGraph,e) * if nbr > n: */ while (1) { - __pyx_t_5 = (__pyx_v_isarc > 0); + __pyx_t_5 = (__pyx_v_is_edge > 0); if (!__pyx_t_5) break; - /* "planarity/classic/planarity.pyx":141 - * isarc=cplanarity.gp_IsArc(e) - * while isarc > 0: + /* "planarity/classic/planarity.pyx":146 + * is_edge=cplanarity.gp_IsEdge(self.theGraph, e) + * while is_edge > 0: * nbr=cplanarity.gp_GetNeighbor(self.theGraph,e) # <<<<<<<<<<<<<< * if nbr > n: * if data: */ __pyx_v_nbr = gp_GetNeighbor(__pyx_v_self->theGraph, __pyx_v_e); - /* "planarity/classic/planarity.pyx":142 - * while isarc > 0: + /* "planarity/classic/planarity.pyx":147 + * while is_edge > 0: * nbr=cplanarity.gp_GetNeighbor(self.theGraph,e) * if nbr > n: # <<<<<<<<<<<<<< * if data: @@ -5297,29 +5371,29 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct __pyx_t_5 = (__pyx_v_nbr > __pyx_v_n); if (__pyx_t_5) { - /* "planarity/classic/planarity.pyx":143 + /* "planarity/classic/planarity.pyx":148 * nbr=cplanarity.gp_GetNeighbor(self.theGraph,e) * if nbr > n: * if data: # <<<<<<<<<<<<<< * data={} * if drawing==1: */ - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_data); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_data); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 148, __pyx_L1_error) if (__pyx_t_5) { - /* "planarity/classic/planarity.pyx":144 + /* "planarity/classic/planarity.pyx":149 * if nbr > n: * if data: * data={} # <<<<<<<<<<<<<< * if drawing==1: * data.update(pos=context.E[e].pos, */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF_SET(__pyx_v_data, __pyx_t_1); __pyx_t_1 = 0; - /* "planarity/classic/planarity.pyx":145 + /* "planarity/classic/planarity.pyx":150 * if data: * data={} * if drawing==1: # <<<<<<<<<<<<<< @@ -5329,7 +5403,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct __pyx_t_5 = (__pyx_v_drawing == 1); if (__pyx_t_5) { - /* "planarity/classic/planarity.pyx":146 + /* "planarity/classic/planarity.pyx":151 * data={} * if drawing==1: * data.update(pos=context.E[e].pos, # <<<<<<<<<<<<<< @@ -5338,48 +5412,48 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct */ __pyx_t_6 = __pyx_v_data; __Pyx_INCREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyLong_From_int((__pyx_v_context->E[__pyx_v_e]).pos); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 146, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyLong_From_int((__pyx_v_context->E[__pyx_v_e]).pos); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 151, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - /* "planarity/classic/planarity.pyx":147 + /* "planarity/classic/planarity.pyx":152 * if drawing==1: * data.update(pos=context.E[e].pos, * start=context.E[e].start, # <<<<<<<<<<<<<< * end=context.E[e].end) * edges.append((r[n],r[nbr],data)) */ - __pyx_t_8 = __Pyx_PyLong_From_int((__pyx_v_context->E[__pyx_v_e]).start); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 147, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyLong_From_int((__pyx_v_context->E[__pyx_v_e]).start); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - /* "planarity/classic/planarity.pyx":148 + /* "planarity/classic/planarity.pyx":153 * data.update(pos=context.E[e].pos, * start=context.E[e].start, * end=context.E[e].end) # <<<<<<<<<<<<<< * edges.append((r[n],r[nbr],data)) * else: */ - __pyx_t_9 = __Pyx_PyLong_From_int((__pyx_v_context->E[__pyx_v_e]).end); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyLong_From_int((__pyx_v_context->E[__pyx_v_e]).end); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = 0; { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_6, NULL}; - __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 146, __pyx_L1_error) + __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 151, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_pos, __pyx_t_7, __pyx_t_11, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 146, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_start, __pyx_t_8, __pyx_t_11, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 146, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_end, __pyx_t_9, __pyx_t_11, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 146, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_pos, __pyx_t_7, __pyx_t_11, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 151, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_start, __pyx_t_8, __pyx_t_11, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 151, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_end, __pyx_t_9, __pyx_t_11, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 151, __pyx_L1_error) __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_10, (1-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_11); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "planarity/classic/planarity.pyx":145 + /* "planarity/classic/planarity.pyx":150 * if data: * data={} * if drawing==1: # <<<<<<<<<<<<<< @@ -5388,7 +5462,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct */ } - /* "planarity/classic/planarity.pyx":149 + /* "planarity/classic/planarity.pyx":154 * start=context.E[e].start, * end=context.E[e].end) * edges.append((r[n],r[nbr],data)) # <<<<<<<<<<<<<< @@ -5397,37 +5471,37 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct */ if (unlikely(__pyx_v_r == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 149, __pyx_L1_error) + __PYX_ERR(0, 154, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = __Pyx_PyDict_GetItem(__pyx_v_r, __pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyDict_GetItem(__pyx_v_r, __pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_v_r == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 149, __pyx_L1_error) + __PYX_ERR(0, 154, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_nbr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_nbr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_r, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_r, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_11); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_11) != (0)) __PYX_ERR(0, 149, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_11) != (0)) __PYX_ERR(0, 154, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_9); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_9) != (0)) __PYX_ERR(0, 149, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_9) != (0)) __PYX_ERR(0, 154, __pyx_L1_error); __Pyx_INCREF(__pyx_v_data); __Pyx_GIVEREF(__pyx_v_data); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_data) != (0)) __PYX_ERR(0, 149, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_data) != (0)) __PYX_ERR(0, 154, __pyx_L1_error); __pyx_t_11 = 0; __pyx_t_9 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_edges, __pyx_t_1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_edges, __pyx_t_1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "planarity/classic/planarity.pyx":143 + /* "planarity/classic/planarity.pyx":148 * nbr=cplanarity.gp_GetNeighbor(self.theGraph,e) * if nbr > n: * if data: # <<<<<<<<<<<<<< @@ -5437,47 +5511,47 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct goto __pyx_L8; } - /* "planarity/classic/planarity.pyx":151 + /* "planarity/classic/planarity.pyx":156 * edges.append((r[n],r[nbr],data)) * else: * edges.append((r[n],r[nbr])) # <<<<<<<<<<<<<< - * e=cplanarity.gp_GetNextArc(self.theGraph,e) - * isarc=cplanarity.gp_IsArc(e) + * e=cplanarity.gp_GetNextEdge(self.theGraph,e) + * is_edge=cplanarity.gp_IsEdge(self.theGraph, e) */ /*else*/ { if (unlikely(__pyx_v_r == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 151, __pyx_L1_error) + __PYX_ERR(0, 156, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_r, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 151, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_r, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_v_r == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 151, __pyx_L1_error) + __PYX_ERR(0, 156, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_nbr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_nbr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = __Pyx_PyDict_GetItem(__pyx_v_r, __pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 151, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyDict_GetItem(__pyx_v_r, __pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_9); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9) != (0)) __PYX_ERR(0, 151, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9) != (0)) __PYX_ERR(0, 156, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_11); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_11) != (0)) __PYX_ERR(0, 151, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_11) != (0)) __PYX_ERR(0, 156, __pyx_L1_error); __pyx_t_9 = 0; __pyx_t_11 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_edges, __pyx_t_1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 151, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_edges, __pyx_t_1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __pyx_L8:; - /* "planarity/classic/planarity.pyx":142 - * while isarc > 0: + /* "planarity/classic/planarity.pyx":147 + * while is_edge > 0: * nbr=cplanarity.gp_GetNeighbor(self.theGraph,e) * if nbr > n: # <<<<<<<<<<<<<< * if data: @@ -5485,29 +5559,29 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct */ } - /* "planarity/classic/planarity.pyx":152 + /* "planarity/classic/planarity.pyx":157 * else: * edges.append((r[n],r[nbr])) - * e=cplanarity.gp_GetNextArc(self.theGraph,e) # <<<<<<<<<<<<<< - * isarc=cplanarity.gp_IsArc(e) + * e=cplanarity.gp_GetNextEdge(self.theGraph,e) # <<<<<<<<<<<<<< + * is_edge=cplanarity.gp_IsEdge(self.theGraph, e) * return edges */ - __pyx_v_e = gp_GetNextArc(__pyx_v_self->theGraph, __pyx_v_e); + __pyx_v_e = gp_GetNextEdge(__pyx_v_self->theGraph, __pyx_v_e); - /* "planarity/classic/planarity.pyx":153 + /* "planarity/classic/planarity.pyx":158 * edges.append((r[n],r[nbr])) - * e=cplanarity.gp_GetNextArc(self.theGraph,e) - * isarc=cplanarity.gp_IsArc(e) # <<<<<<<<<<<<<< + * e=cplanarity.gp_GetNextEdge(self.theGraph,e) + * is_edge=cplanarity.gp_IsEdge(self.theGraph, e) # <<<<<<<<<<<<<< * return edges * */ - __pyx_v_isarc = gp_IsArc(__pyx_v_e); + __pyx_v_is_edge = gp_IsEdge(__pyx_v_self->theGraph, __pyx_v_e); } } - /* "planarity/classic/planarity.pyx":154 - * e=cplanarity.gp_GetNextArc(self.theGraph,e) - * isarc=cplanarity.gp_IsArc(e) + /* "planarity/classic/planarity.pyx":159 + * e=cplanarity.gp_GetNextEdge(self.theGraph,e) + * is_edge=cplanarity.gp_IsEdge(self.theGraph, e) * return edges # <<<<<<<<<<<<<< * * @@ -5517,7 +5591,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct __pyx_r = __pyx_v_edges; goto __pyx_L0; - /* "planarity/classic/planarity.pyx":127 + /* "planarity/classic/planarity.pyx":132 * * * def edges(self,data=False): # <<<<<<<<<<<<<< @@ -5544,7 +5618,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct return __pyx_r; } -/* "planarity/classic/planarity.pyx":157 +/* "planarity/classic/planarity.pyx":162 * * * def ascii(self): # <<<<<<<<<<<<<< @@ -5609,7 +5683,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_16ascii(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("ascii", 0); - /* "planarity/classic/planarity.pyx":158 + /* "planarity/classic/planarity.pyx":163 * * def ascii(self): * cdef char* s = NULL # <<<<<<<<<<<<<< @@ -5618,7 +5692,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_16ascii(struct */ __pyx_v_s = NULL; - /* "planarity/classic/planarity.pyx":159 + /* "planarity/classic/planarity.pyx":164 * def ascii(self): * cdef char* s = NULL * self.embed_drawplanar() # <<<<<<<<<<<<<< @@ -5632,12 +5706,12 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_16ascii(struct PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_embed_drawplanar, __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, 159, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "planarity/classic/planarity.pyx":160 + /* "planarity/classic/planarity.pyx":165 * cdef char* s = NULL * self.embed_drawplanar() * status = cplanarity.gp_DrawPlanar_RenderToString(self.theGraph, &s) # <<<<<<<<<<<<<< @@ -5646,19 +5720,19 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_16ascii(struct */ __pyx_v_status = gp_DrawPlanar_RenderToString(__pyx_v_self->theGraph, (&__pyx_v_s)); - /* "planarity/classic/planarity.pyx":161 + /* "planarity/classic/planarity.pyx":166 * self.embed_drawplanar() * status = cplanarity.gp_DrawPlanar_RenderToString(self.theGraph, &s) * py_bytes = s[:] # <<<<<<<<<<<<<< * free(s) * return py_bytes.decode('ascii') */ - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_s + 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_s + 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_py_bytes = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "planarity/classic/planarity.pyx":162 + /* "planarity/classic/planarity.pyx":167 * status = cplanarity.gp_DrawPlanar_RenderToString(self.theGraph, &s) * py_bytes = s[:] * free(s) # <<<<<<<<<<<<<< @@ -5667,7 +5741,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_16ascii(struct */ free(__pyx_v_s); - /* "planarity/classic/planarity.pyx":163 + /* "planarity/classic/planarity.pyx":168 * py_bytes = s[:] * free(s) * return py_bytes.decode('ascii') # <<<<<<<<<<<<<< @@ -5675,13 +5749,13 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_16ascii(struct * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_decode_bytes(__pyx_v_py_bytes, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) + __pyx_t_1 = __Pyx_decode_bytes(__pyx_v_py_bytes, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/classic/planarity.pyx":157 + /* "planarity/classic/planarity.pyx":162 * * * def ascii(self): # <<<<<<<<<<<<<< @@ -5702,7 +5776,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_16ascii(struct return __pyx_r; } -/* "planarity/classic/planarity.pyx":166 +/* "planarity/classic/planarity.pyx":171 * * * def write(self,path): # <<<<<<<<<<<<<< @@ -5750,32 +5824,32 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,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, 166, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 171, __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, 166, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 171, __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, "write", 0) < (0)) __PYX_ERR(0, 166, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "write", 0) < (0)) __PYX_ERR(0, 171, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("write", 1, 1, 1, i); __PYX_ERR(0, 166, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("write", 1, 1, 1, i); __PYX_ERR(0, 171, __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, 166, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 171, __pyx_L3_error) } __pyx_v_path = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 166, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("write", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 171, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -5810,7 +5884,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_18write(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write", 0); - /* "planarity/classic/planarity.pyx":167 + /* "planarity/classic/planarity.pyx":172 * * def write(self,path): * bpath=path.encode() # <<<<<<<<<<<<<< @@ -5824,22 +5898,22 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_18write(struct PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __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, 167, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_bpath = __pyx_t_1; __pyx_t_1 = 0; - /* "planarity/classic/planarity.pyx":168 + /* "planarity/classic/planarity.pyx":173 * def write(self,path): * bpath=path.encode() * status=cplanarity.gp_Write(self.theGraph, bpath, # <<<<<<<<<<<<<< * cplanarity.WRITE_ADJLIST) * */ - __pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_bpath); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_bpath); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 173, __pyx_L1_error) - /* "planarity/classic/planarity.pyx":169 + /* "planarity/classic/planarity.pyx":174 * bpath=path.encode() * status=cplanarity.gp_Write(self.theGraph, bpath, * cplanarity.WRITE_ADJLIST) # <<<<<<<<<<<<<< @@ -5848,7 +5922,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_18write(struct */ __pyx_v_status = gp_Write(__pyx_v_self->theGraph, __pyx_t_4, WRITE_ADJLIST); - /* "planarity/classic/planarity.pyx":166 + /* "planarity/classic/planarity.pyx":171 * * * def write(self,path): # <<<<<<<<<<<<<< @@ -5871,7 +5945,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_18write(struct return __pyx_r; } -/* "planarity/classic/planarity.pyx":171 +/* "planarity/classic/planarity.pyx":176 * cplanarity.WRITE_ADJLIST) * * def mapping(self): # <<<<<<<<<<<<<< @@ -5926,7 +6000,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_20mapping(struc __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("mapping", 0); - /* "planarity/classic/planarity.pyx":172 + /* "planarity/classic/planarity.pyx":177 * * def mapping(self): * return self.reverse_nodemap # <<<<<<<<<<<<<< @@ -5936,7 +6010,7 @@ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_20mapping(struc __pyx_r = __pyx_v_self->reverse_nodemap; goto __pyx_L0; - /* "planarity/classic/planarity.pyx":171 + /* "planarity/classic/planarity.pyx":176 * cplanarity.WRITE_ADJLIST) * * def mapping(self): # <<<<<<<<<<<<<< @@ -6728,8 +6802,8 @@ __Pyx_RefNannySetupContext("PyInit_planarity", 0); * * * def embed_planar(self): # <<<<<<<<<<<<<< - * if self.embedding == 0: - * self.embedding = cplanarity.gp_Embed(self.theGraph, + * if self.embedding != 0: + * return */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_5embed_planar, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_embed_planar, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); @@ -6739,125 +6813,125 @@ __Pyx_RefNannySetupContext("PyInit_planarity", 0); if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_embed_planar, __pyx_t_2) < (0)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/classic/planarity.pyx":75 + /* "planarity/classic/planarity.pyx":80 * * * def embed_drawplanar(self): # <<<<<<<<<<<<<< - * status = cplanarity.gp_AttachDrawPlanar(self.theGraph) + * status = cplanarity.gp_ExtendWith_DrawPlanar(self.theGraph) * if status == cplanarity.NOTOK: */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_7embed_drawplanar, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_embed_drawplanar, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_7embed_drawplanar, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_embed_drawplanar, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __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_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_embed_drawplanar, __pyx_t_2) < (0)) __PYX_ERR(0, 75, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_embed_drawplanar, __pyx_t_2) < (0)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/classic/planarity.pyx":86 + /* "planarity/classic/planarity.pyx":91 * * * def is_planar(self): # <<<<<<<<<<<<<< * """Return True if graph is planar.""" * self.embed_planar() */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_9is_planar, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_is_planar, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_9is_planar, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_is_planar, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __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_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_is_planar, __pyx_t_2) < (0)) __PYX_ERR(0, 86, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_is_planar, __pyx_t_2) < (0)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/classic/planarity.pyx":94 + /* "planarity/classic/planarity.pyx":99 * * * def kuratowski_edges(self): # <<<<<<<<<<<<<< * if self.is_planar(): * return [] */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_11kuratowski_edges, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_kuratowski_edges, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_11kuratowski_edges, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_kuratowski_edges, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __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_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_kuratowski_edges, __pyx_t_2) < (0)) __PYX_ERR(0, 94, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_kuratowski_edges, __pyx_t_2) < (0)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/classic/planarity.pyx":103 + /* "planarity/classic/planarity.pyx":108 * * * def nodes(self,data=False): # <<<<<<<<<<<<<< * DRAWPLANAR_ID=1 * cdef cplanarity.DrawPlanarContext *context */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_13nodes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_nodes, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_13nodes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_nodes, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __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_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[0]); - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_nodes, __pyx_t_2) < (0)) __PYX_ERR(0, 103, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_nodes, __pyx_t_2) < (0)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/classic/planarity.pyx":127 + /* "planarity/classic/planarity.pyx":132 * * * def edges(self,data=False): # <<<<<<<<<<<<<< * DRAWPLANAR_ID=1 * cdef cplanarity.DrawPlanarContext *context */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_15edges, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_edges, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_15edges, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_edges, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __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_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[0]); - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_edges, __pyx_t_2) < (0)) __PYX_ERR(0, 127, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_edges, __pyx_t_2) < (0)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/classic/planarity.pyx":157 + /* "planarity/classic/planarity.pyx":162 * * * def ascii(self): # <<<<<<<<<<<<<< * cdef char* s = NULL * self.embed_drawplanar() */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_17ascii, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_ascii, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 157, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_17ascii, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_ascii, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __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_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_ascii, __pyx_t_2) < (0)) __PYX_ERR(0, 157, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_ascii, __pyx_t_2) < (0)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/classic/planarity.pyx":166 + /* "planarity/classic/planarity.pyx":171 * * * def write(self,path): # <<<<<<<<<<<<<< * bpath=path.encode() * status=cplanarity.gp_Write(self.theGraph, bpath, */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_19write, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_write, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_19write, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_write, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __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_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_write, __pyx_t_2) < (0)) __PYX_ERR(0, 166, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_write, __pyx_t_2) < (0)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/classic/planarity.pyx":171 + /* "planarity/classic/planarity.pyx":176 * cplanarity.WRITE_ADJLIST) * * def mapping(self): # <<<<<<<<<<<<<< * return self.reverse_nodemap */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_21mapping, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_mapping, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_21mapping, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_mapping, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 176, __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_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_mapping, __pyx_t_2) < (0)) __PYX_ERR(0, 171, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_mapping, __pyx_t_2) < (0)) __PYX_ERR(0, 176, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "(tree fragment)":1 @@ -6953,14 +7027,14 @@ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "planarity/classic/planarity.pyx":103 + /* "planarity/classic/planarity.pyx":108 * * * def nodes(self,data=False): # <<<<<<<<<<<<<< * DRAWPLANAR_ID=1 * cdef cplanarity.DrawPlanarContext *context */ - __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(1, Py_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 103, __pyx_L1_error) + __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(1, Py_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); #if CYTHON_IMMORTAL_CONSTANTS @@ -6993,42 +7067,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: 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},{60},{61},{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},{7},{9},{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},{73},{72},{47},{30},{27},{56},{9},{9},{182},{278}}; + #if (CYTHON_COMPRESS_STRINGS) == 3 && __PYX_LIMITED_VERSION_HEX >= 0x030e0000 /* compression: zstd (1053 bytes) */ +const char* const cstring = "(\265/\375`f\006\235 \000\266s\2578\020\265\016\000D\002A\000@\301\025\210\232\nDM\005\024\010\204\373aE\322\356\344\377\310feR2nb\246=F\302\247\346\360\370\t\362\022C\226\031\005\214\005\233\213LK\003\226\000\223\000\251\0003,\224k5)n\276M`\031\2072\213GO\213/\217\333\253\343\022\275,\306\370M\306\253\\\337\235,Z\357\272r\265,7\306Q\257\360n\024\027\363\345\301a\305\034g\\\253\032\334W\223\334\222\232o\317\213q\\\363bc\3250\017\314\227\333\256'r\024\010V\017\327\227\3556\242<,\336\273\206\326\003\245E\255\257Wr\343X\327\\\303\021\334\330\2730\360z\341\r\303\252\353\350\3012\326b\206a\013\313\367\206\256\2721\230r\307\033\36789f\354\345\232\230e\331\246#\266KuXI\332H\351\276\374\346\242\267q\213\343(\216(\355\232\325\034\222\240Hi\306uV\303}\273\262=\273\034oL7\246\024Fm&_\224\362\255\361\013\314\327\346{+\257 \317\242\225\331\352\272\266jN3\246\241\215\361:\272\366\315\230\223\242\026-J\3046\337v}\335\031n\2730\224[\314\262\335.\307\272\006\212y\034\353\214b\331\256\211\274jR\2661\005\257k\2661\266\273\362\3127\277\233RK\257%\301\253)E\311\260Z\350\314\007\363\271\310\334|\001\037\344\223*y\255\264\265p\337W\376\200~rr\0139Pn\244\325%J\007T\307?\235=\017\375\001\243\004q\0078\204\020\310\237\364\202\222\365\202\023\205v\273\224y{\253\357\224*\377\322M%\311\340\247J\005\321'u\236\225\310'\2355\376\363$f\205H'\002\345Xg\352\004\331\031\210~\253W\364\036\234\352\363\241\231*\363dR$\214\254>\311\327\230\237I\322i\275v\2162A\364i\275\243\\\341\nB\237\224\2539\277Se\322\231B\377\363\0311O\326\265\266/\031\326\235\313+8\222\227S\272IMyH\326\327\0057\245\0014\034B\350\1779\223\206I1\"\210\351\021\243\337\332\235N\033\377\005TS\305\274\341\310\370\247\034\300\314\t\363\250\014\327\307\311\342\005<\315\0340\275\210\377\231\024\346\252\233J\245\005\235\3238A\337\362b\237\030e\344\350\364\t\321\007\005\230*\375\306\302\373\2513\341\004\2354\036f^x\332W\017\342YL\001\223\326\007zi\341\177\235\242\257J\205\321o\225\014\243/\372\265d(Wj\305Y\340\010h'\216_\360 \237\341\240\243y""\225?y\215\222\256t\266\316\020\216\337\301\361A'\313\247\374\006\204\016\"\264\253eC/\t\350Z\345\006\216@ \200\230\250Q\245bH\321\004B\244\244\205B\007 \204\030\306\354:\"\272(\345\2205fH\202!M=J\315\001\206R\213\301w0\202\366\247B\272x5\366\370\035\023\001]\313b#\021H\016Q\006\033\034@R\302\265\305\313:\014\007\206\225\222\003jQT\004\266\210!\207\347\321\257\344\231a\325\242^\2105\230\346\031\025\022Bky\353\244\346\334\001\271\rO\336g\276\205\263\3227\310\263\254u`\224\006'P`\344\324\365\233o\243J\250\002\266\221\272`!G\221\231Q \244K}O\002Z\352`q\014\357\027\370\302\315\266$\2675\225\277\333\021\341\033H\272\247\221\240E\"\330\203T6\211\221\346LHQ\202\234|\356\246\000\337X5\300(S\334b\355U\327b\363\377So\273\262\016\017\310[f\025\201q\200)\303\324'\364W/\350f/\343\203\016\222\014\025\032\271h*\032\340\3576]l\267\221\346\360\177\"\270\022\345\232} \222\214\354\004\365U\006\366\366Q\323\357\004)\341\235fvg:\372\255m\324I7\034\020+\324sFE\001\361\372rc\0172j\002*\217\350\035\000\252N\345\375\333R\265\014\203(f\267\2662\360v\313\246@\233\377\037\350E'\255\277@\270\032"; + PyObject *data = __Pyx_DecompressString(cstring, 1053, 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 (1151 bytes) */ +const char* const cstring = "BZh91AY&SY\270\315W\316\000\000\222\377\377|\337\377\377}\337\277\367\266\247\376\230\277\377\377\370@@@@@@@@\000@@@@\000P\003\376\343]\000\n\014 \224\222CA\240\323\304\312dh\321\240\r6\246\200\031\000\r\032h\323@h\32024a0\203PPM\352\236\247\220\232z\232\014G\240\021\204\311\2104h\006LL\021\223\t\220\321\210db\002P@\200Bm\001'\225?HM\000\310\001\2204\000\000\003@4a2h\364!\300\003M4\000\031\000\000\r\000\000\r\000\0002\000\001\241\240\004S\324F\200\023\000\000M\030\000\000\000\004d0\000\000& 3A\356\001\376\001\313\231\237\304\220a\200Ib\005\200\232(:\365\002\212,\223D\020\035\204\000\000D\004\004D\312d\251\220\360\301\"\250\225*\301\021\261a\025FH(h\266\313\324\272\306Q\244T\203\324\306\265X\021\n:ZH\264^b\223.X%\344k\222[\021\205N\rU\314\225YI\"\263\237\207\265\331\374\373\277\307\354\275\216\277je\002kB\220\213Q\247\334\2449^\201\010\036n\"@ \014\215\231\303\027\016\231\264j\217\333\024\340\375.o\035\306\035\203\260\216\265GI\274.\215@dM]\3565\355J\035\271{\267FV\033\020\312\302\346\024s\247\304D\212@\206C1$\226\257\225\205#\262H\023l\355\205\313\276\251h(\003=\340\241V)\013\242\030\034\300\302\357\212\210A\020`\237\240\004\241\023\320x\327\326\203mc\373\337\275\027B\376\235\231t\026\253\262\006\213\340\r\006\245\376T\343\225F\257\221\345QP\341\252\320\327c\035\365C\242i`\346\263\254U[;\262\347S\037\257\305y\275s\2346\264\203\2446\301\356\027k!5\224\225Y\020\251j]\r\005\273\271\n^\035\353\245\377r\324\236\222 g\210\2012\010r\250\211\337,\306\332\222\334\321AhV<\2306\233Q7\234g\003\304Qbl\3070t}T\327\216\312\216!\351\206\260\246\352\211<\364\365\267G\277e\322\311KH\003\314P4\352\267+\251\022(\232\373\r+j\034'\243N\377\006&\3743\344u7le\035\225W2\370#\005J\303!\223B\345X\354\013\333\036r\265\320m\245J\263\265\353w\031l\344\201B\270\326\343\276\272\222\n=\336cVO\215\370`D/$\324\265\010@eC\337\335$\222\304\344\333\262\325UDE\001gp\355\201\017#ZoB\334\2240\305\350s\337\014\205{\271\366g\330\266\316\244\254\255\221\013x\364\335\231\026E\217f\010\201\021\366g\n\222\271""\222\307:Mr\330\262\007Fl\016\001d\031\240=k$@Zt\"\204\221\014\253\312N\310s3g\300\245\344\265\003\307,\316\034\2109\243]R\201\0064\300b\263Uz\245\216\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 (1030 bytes) */ +const char* const cstring = "x\332\215SMo\333F\020\205\032\003\021l\245\265\035\247V\2424\240\235\2405\034[\201\032\265J\212~\200\201\n\243@\223Z\256\003\003\315a\261\"W\322F\324\222\332]Z\226s\361QG\036y\344q\217<\352'\344\250#\217\376)\235%eY\216\215\246\002(\356\316\307\2337o\206\273oY\227\271\003fP\346\371\322\220C\217\374fS\201\233\016!L\377\267-\332f.\247\254mx\230c\307!\216A\35461\250\310\002l\317\301\014s*\207?\031\027`\204s\227\227g\216g\226\203\205\240\326\263\231\245\354\rO\346\362Z\230\002\220\201m[\327\321\360\345\353^\351\032\344D\022f\033m\216\275\2161\240\262c\314\302\014!\271oI\237\023\361\177sm\216\007Y\350g\223)\243\222b\207\236\222\014`.(\003d\256\234r)\013\342\264\312\262C\366R\207\205\231\3665\211a\271\354\230p\231\001bc\177(;.3\334\346{bI\243\345r\303\243V\327\001\001~\0066\360\022\256\317-\362k\375\300<\332\377\323|c\036\240?\352\373)h\366_F\210\023\333\267\010\262R(\204fvA\244\220X^\363`aQ:=k\225\305\305\271\327$6\272\324\343\212\371\212\211\212\253\367\256\317\261t\007\242K\321<`\017{\036\2640\2751\327\236y\006\240\032\001B\303\023x\352\324\222\350\rL\346\200\264RnX\014\231E\335\262\345r\327\227\224\021\321\364\260\354X \013A\224!\311\261E\232\330\352\202\230\022\362l,\261\246\r\265HZ\377\323N\346[ \314\002\"\260\004\331*\264(\027\022\241\226\317,\004\277\366\205f(\235(\202Ng,\340\254\321g\315C\013=\321%C\361i\373\260\347\000\331\303@\025M5\200\203k\373\016\340\202\215\341\236>4y*\211n\355\362\223\230~$\227\013\350\271\236\347\no\210\232CI\004B\360\315\240)\305\276\217\235\014\213\317\266\000]\333\207\231\201\234\300N\350\275LWc\312\002N6\310\356;rna\320\r\313\0037\236\232| \001L \336\367@yr\214\035\237\210\001\346L?ze\323\351\236R\357\314L\362\245I\251\032\233\361\341x%\311/\215j\301n\330O\n\253\301N\210\341\220/\205/#3:T+I\355\305\r\376\325\315h#\252F}\r\2644\252\216>\204\217\303FR\270s\256a\237\307\225\270>\316\335\004[\230\024\036G/\225\251\016\343\225\344\307\3325\234\323p%)\334\r*\311\235\225\240\024\276V\351\255\032\034\207\215\220D\225\363\013\2403\363<_\030""\275\206`x\325\203\245\360\027\225\313\362\362_\215R\260/Gv\360\235\366\337\017\357\247%>\304\033\311nY\273\326\203\214\3107\300X\323}1\316\215\327\306\357>\346>B8`\004\246F5G\r\rv\022\014\262\202\372\"\203\312Y.YX\034=\r\032\223\205b\010-~\035\340\363\374\203\311\203\247\252\242\352q.\331\331Mv~\210\0331X\213\223\342\266\332PU\005\345\326'\353[*\247\326\324?q_+\2638z2\302\232%\326\265~\017\356\005X7\231\024\200~\262|/h$\313w\203Z\270\031\232\311Z1\274\035\366\243\205hO=WXq\020\316\3706j\253\277\343\\\274\032W\022\343\311\234\007R\217\302W\232qt\013\364\232\273\346Ri>\307zJiJ\357\277:\270\302\032\002g\316\244\360(|\237^\336A\034Ll+mc\371Q\350\252\206\262\343\355\261\251\233\253\006\034\306\263\246\207Q\324\223(\226\302Z\264\031\231\311C#\272\035\365\325\202\332\213\277\007JM\000\331*\253v|\000u\277\030o$[;s\036H=\212^E\030\022nA/\246z\033o\234_3\202\232\017\303\277\322^\027\001ay3\332NW\2604N\307\332\377\027\233\017\355\314"; + PyObject *data = __Pyx_DecompressString(cstring, 1030, 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 (1894 bytes) */ +const char* const bytes = "-Unknown input type?disableenablegcignoring parallel edge isenabledplanarity: Unknown error.planarity/classic/planarity.pyxplanarity: failed adding edge.planarity: failed to extend graph with planarity structures.planarity: failed to extend graph with drawplanar structures.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_edgeis_planaritemskeyskuratowski_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\033\320\0334\260A\260T\270\021\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\013\2104\210{\230#\230Q\330\014\r\340\010\033\320\0333\2601\260D\270\001\330\010\013\2107\220-\230q\330\014\022\220,\230a\230q\330\010\014\320\014#\2409\250A\250T\260\021\33067\330\022\"\240!\2404\240q\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\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\320\030(\250\001\250\024\250Z\260q\330\014\036\230j\250\001\250\024\250[\270\001\330\014\022\220(\230\"\230A\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\230O\2501\250D\260\n\270!\330\020\"\240*\250A\250T\260\033\270A\330\010\017\210q"; 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 < 88; i++) { + for (int i = 0; i < 89; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); - if (likely(string) && i >= 16) PyUnicode_InternInPlace(&string); + if (likely(string) && i >= 17) PyUnicode_InternInPlace(&string); if (unlikely(!string)) { Py_XDECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) @@ -7036,7 +7110,7 @@ const char* const bytes = "-Unknown input type?disableenablegcignoring parallel stringtab[i] = string; pos += bytes_length; } - for (int i = 88; i < 98; i++) { + for (int i = 89; i < 99; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length); stringtab[i] = string; @@ -7047,14 +7121,14 @@ const char* const bytes = "-Unknown input type?disableenablegcignoring parallel } } Py_XDECREF(data); - for (Py_ssize_t i = 0; i < 98; i++) { + for (Py_ssize_t i = 0; i < 99; i++) { if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { __PYX_ERR(0, 1, __pyx_L1_error) } } #if CYTHON_IMMORTAL_CONSTANTS { - PyObject **table = stringtab + 88; + PyObject **table = stringtab + 89; for (Py_ssize_t i=0; i<10; ++i) { #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #if PY_VERSION_HEX < 0x030E0000 @@ -7127,47 +7201,47 @@ 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), 68}; - 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_classic_planarity_pyx, __pyx_mstate->__pyx_n_u_embed_planar, __pyx_mstate->__pyx_kp_b_iso88591_A_4_Q_y_Q78_at1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 68}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_status}; + __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_classic_planarity_pyx, __pyx_mstate->__pyx_n_u_embed_planar, __pyx_mstate->__pyx_kp_b_iso88591_A_4_Q_31D_7_q_aq_9AT_67_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 75}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 80}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_status}; - __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_classic_planarity_pyx, __pyx_mstate->__pyx_n_u_embed_drawplanar, __pyx_mstate->__pyx_kp_b_iso88591_A_q_A_7_q_aq_9AT_78_7_q_aq_4q, 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_classic_planarity_pyx, __pyx_mstate->__pyx_n_u_embed_drawplanar, __pyx_mstate->__pyx_kp_b_iso88591_A_4AT_7_q_aq_9AT_78_7_q_aq_4q, 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), 86}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 91}; 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_classic_planarity_pyx, __pyx_mstate->__pyx_n_u_is_planar, __pyx_mstate->__pyx_kp_b_iso88591_A_M_D_1_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), 94}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 99}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_classic_planarity_pyx, __pyx_mstate->__pyx_n_u_kuratowski_edges, __pyx_mstate->__pyx_kp_b_iso88591_A_4z_1_M_4vQe1_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 103}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 108}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_DRAWPLANAR_ID, __pyx_mstate->__pyx_n_u_context, __pyx_mstate->__pyx_n_u_drawing, __pyx_mstate->__pyx_n_u_first, __pyx_mstate->__pyx_n_u_last, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_nodes, __pyx_mstate->__pyx_n_u_n}; __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_classic_planarity_pyx, __pyx_mstate->__pyx_n_u_nodes, __pyx_mstate->__pyx_kp_b_iso88591_a_1D_5Qa_4q_Zq_a_a_E_avQ_q_Q_7, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 13, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 127}; - PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_DRAWPLANAR_ID, __pyx_mstate->__pyx_n_u_context, __pyx_mstate->__pyx_n_u_drawing, __pyx_mstate->__pyx_n_u_edges, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_first, __pyx_mstate->__pyx_n_u_last, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_e, __pyx_mstate->__pyx_n_u_isarc, __pyx_mstate->__pyx_n_u_nbr}; - __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_classic_planarity_pyx, __pyx_mstate->__pyx_n_u_edges, __pyx_mstate->__pyx_kp_b_iso88591_a_1D_5Qa_a_a_4q_Zq_E_avQ_q_Ja_I, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 13, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 132}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_DRAWPLANAR_ID, __pyx_mstate->__pyx_n_u_context, __pyx_mstate->__pyx_n_u_drawing, __pyx_mstate->__pyx_n_u_edges, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_first, __pyx_mstate->__pyx_n_u_last, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_e, __pyx_mstate->__pyx_n_u_is_edge, __pyx_mstate->__pyx_n_u_nbr}; + __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_classic_planarity_pyx, __pyx_mstate->__pyx_n_u_edges, __pyx_mstate->__pyx_kp_b_iso88591_a_1D_5Qa_a_a_4q_Zq_E_avQ_Zq_j_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, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 157}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 162}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_s, __pyx_mstate->__pyx_n_u_status, __pyx_mstate->__pyx_n_u_py_bytes}; __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_classic_planarity_pyx, __pyx_mstate->__pyx_n_u_ascii, __pyx_mstate->__pyx_kp_b_iso88591_A_q_Q_8_1A_AQ_xwaq, 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), 166}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 171}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_bpath, __pyx_mstate->__pyx_n_u_status}; __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_classic_planarity_pyx, __pyx_mstate->__pyx_n_u_write, __pyx_mstate->__pyx_kp_b_iso88591_A_d_4, 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), 171}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 176}; 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_classic_planarity_pyx, __pyx_mstate->__pyx_n_u_mapping, __pyx_mstate->__pyx_kp_b_iso88591_A_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; } diff --git a/planarity/classic/planarity.pyx b/planarity/classic/planarity.pyx index 7f8d9fa..fee2490 100644 --- a/planarity/classic/planarity.pyx +++ b/planarity/classic/planarity.pyx @@ -66,16 +66,21 @@ cdef class PGraph: def embed_planar(self): - if self.embedding == 0: - self.embedding = cplanarity.gp_Embed(self.theGraph, - cplanarity.EMBEDFLAGS_PLANAR) - cplanarity.gp_SortVertices(self.theGraph) + if self.embedding != 0: + return + + status = cplanarity.gp_ExtendWith_Planarity(self.theGraph) + if status == cplanarity.NOTOK: + raise RuntimeError("planarity: failed to extend graph with planarity structures.") + self.embedding = cplanarity.gp_Embed(self.theGraph, + cplanarity.EMBEDFLAGS_PLANAR) + cplanarity.gp_SortVertices(self.theGraph) def embed_drawplanar(self): - status = cplanarity.gp_AttachDrawPlanar(self.theGraph) + status = cplanarity.gp_ExtendWith_DrawPlanar(self.theGraph) if status == cplanarity.NOTOK: - raise RuntimeError("planarity: failed attaching drawplanar.") + raise RuntimeError("planarity: failed to extend graph with drawplanar structures.") status = cplanarity.gp_Embed(self.theGraph, cplanarity.EMBEDFLAGS_DRAWPLANAR) if status == cplanarity.NONEMBEDDABLE: @@ -135,9 +140,9 @@ cdef class PGraph: first=cplanarity.gp_GetFirstVertex(self.theGraph) 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) - while isarc > 0: + e=cplanarity.gp_GetFirstEdge(self.theGraph,n) + is_edge=cplanarity.gp_IsEdge(self.theGraph, e) + while is_edge > 0: nbr=cplanarity.gp_GetNeighbor(self.theGraph,e) if nbr > n: if data: @@ -149,8 +154,8 @@ cdef class PGraph: edges.append((r[n],r[nbr],data)) else: edges.append((r[n],r[nbr])) - e=cplanarity.gp_GetNextArc(self.theGraph,e) - isarc=cplanarity.gp_IsArc(e) + e=cplanarity.gp_GetNextEdge(self.theGraph,e) + is_edge=cplanarity.gp_IsEdge(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..53af576 100644 --- a/planarity/full/cgraphLib.pxd +++ b/planarity/full/cgraphLib.pxd @@ -4,75 +4,86 @@ Specifically provides definitions for functions and macros that are required to interact with graphP structs. """ +cdef extern from "../c/graphLib/graphLib.h": + char *gp_GetProjectVersionFull() + char *gp_GetLibPlanarityVersionFull() + + cdef extern from "../c/graphLib/graphStructures.h": - cdef int NONEMBEDDABLE + int NONEMBEDDABLE ctypedef struct baseGraphStructure: pass ctypedef baseGraphStructure * graphP - int gp_IsArc(int e) - int gp_GetFirstEdge(graphP theGraph) + int gp_IsEdge(graphP theGraph, int e) + int gp_EdgeArrayStart(graphP theGraph) int gp_EdgeInUse(graphP theGraph, int e) - int gp_EdgeIndexBound(graphP theGraph) - int gp_EdgeInUseIndexBound(graphP theGraph) - int gp_GetFirstArc(graphP theGraph, int v) - int gp_GetNextArc(graphP theGraph, int e) + int gp_EdgeArraySize(graphP theGraph) + int gp_EdgeInUseArraySize(graphP theGraph) + int gp_GetFirstEdge(graphP theGraph, int v) + int gp_GetNextEdge(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_ExtendWith_Planarity(graphP theGraph) + int gp_ExtendWith_Outerplanarity(graphP theGraph) cdef extern from "../c/graphLib/graph.h": int EMBEDFLAGS_PLANAR, EMBEDFLAGS_DRAWPLANAR, EMBEDFLAGS_OUTERPLANAR int EMBEDFLAGS_SEARCHFORK23, EMBEDFLAGS_SEARCHFORK33, EMBEDFLAGS_SEARCHFORK4 - cdef int WRITE_ADJLIST, WRITE_ADJMATRIX, WRITE_G6 + int WRITE_ADJLIST, WRITE_ADJMATRIX, WRITE_G6 graphP gp_New() int gp_InitGraph(graphP theGraph, int N) void gp_ReinitializeGraph(graphP theGraph) - int gp_CopyGraph(graphP dstGraph, graphP srcGraph) - graphP gp_DupGraph(graphP theGraph); - void gp_Free(graphP *pGraph) + int gp_GetN(graphP theGraph) + + int gp_CopyGraph(graphP dstGraph, graphP srcGraph) + graphP gp_DupGraph(graphP theGraph) + int gp_Read(graphP theGraph, char *FileName) int gp_ReadFromString(graphP theGraph, char *inputStr) int gp_Write(graphP theGraph, char *FileName, int Mode) int gp_WriteToString(graphP theGraph, char **pOutputStr, int Mode) - int gp_GetNeighborEdgeRecord(graphP theGraph, int u, int v) + int gp_FindEdge(graphP theGraph, int u, int v) int gp_GetVertexDegree(graphP theGraph, int v) - int gp_GetArcCapacity(graphP theGraph) - int gp_EnsureArcCapacity(graphP theGraph, int requiredArcCapacity) + int gp_GetEdgeCapacity(graphP theGraph) + int gp_EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity) 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) cdef extern from "../c/graphLib/planarityRelated/graphDrawPlanar.h": - int gp_AttachDrawPlanar(graphP theGraph) + int gp_ExtendWith_DrawPlanar(graphP theGraph) + + int gp_DrawPlanar_RenderToFile(graphP theEmbedding, char *theFileName) + int gp_DrawPlanar_RenderToString(graphP theEmbedding, char **pRenditionString) cdef extern from "../c/graphLib/homeomorphSearch/graphK23Search.h": - int gp_AttachK23Search(graphP theGraph) + int gp_ExtendWith_K23Search(graphP theGraph) cdef extern from "../c/graphLib/homeomorphSearch/graphK33Search.h": - int gp_AttachK33Search(graphP theGraph) + int gp_ExtendWith_K33Search(graphP theGraph) cdef extern from "../c/graphLib/homeomorphSearch/graphK4Search.h": - int gp_AttachK4Search(graphP theGraph) + int gp_ExtendWith_K4Search(graphP theGraph) 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..ea61219 100644 --- a/planarity/full/graph.c +++ b/planarity/full/graph.c @@ -3,6 +3,7 @@ /* BEGIN: Cython Metadata { "distutils": { + "depends": [], "include_dirs": [ "planarity/c/graphLib" ], @@ -1157,12 +1158,15 @@ static int __Pyx_init_co_variables(void) { #define __PYX_HAVE__planarity__full__graph #define __PYX_HAVE_API__planarity__full__graph /* Early includes */ +#include "../c/graphLib/graphLib.h" #include "../c/graphLib/graphStructures.h" #include "../c/graphLib/graph.h" #include "../c/graphLib/planarityRelated/graphDrawPlanar.h" #include "../c/graphLib/homeomorphSearch/graphK23Search.h" #include "../c/graphLib/homeomorphSearch/graphK33Search.h" #include "../c/graphLib/homeomorphSearch/graphK4Search.h" +#include +#include #include "../c/graphLib/lowLevelUtils/appconst.h" #ifdef _OPENMP #include @@ -1702,6 +1706,46 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) #endif +/* decode_c_string_utf16.proto (used by decode_c_bytes) */ +static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { + int byteorder = 0; + return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); +} +static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) { + int byteorder = -1; + return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); +} +static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) { + int byteorder = 1; + return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); +} + +/* decode_c_bytes.proto (used by decode_bytes) */ +static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( + const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, + const char* encoding, const char* errors, + PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); + +/* decode_bytes.proto */ +static CYTHON_INLINE PyObject* __Pyx_decode_bytes( + PyObject* string, Py_ssize_t start, Py_ssize_t stop, + const char* encoding, const char* errors, + PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { + char* as_c_string; + Py_ssize_t size; +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + as_c_string = PyBytes_AS_STRING(string); + size = PyBytes_GET_SIZE(string); +#else + if (PyBytes_AsStringAndSize(string, &as_c_string, &size) < 0) { + return NULL; + } +#endif + return __Pyx_decode_c_bytes( + as_c_string, size, + start, stop, encoding, errors, decode_func); +} + /* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); @@ -1957,9 +2001,108 @@ static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, l /* PyValueError_Check.proto */ #define __Pyx_PyExc_ValueError_Check(obj) __Pyx_TypeCheck(obj, PyExc_ValueError) +/* GetTopmostException.proto (used by SaveResetException) */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); +#endif + +/* SaveResetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +#else +#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) +#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) +#endif + +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + +/* GetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* SwapException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); +#endif + /* PyUnicode_Unicode.proto */ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj); +/* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* GetBuiltinName.proto (used by GetModuleGlobalName) */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* PyDictVersioning.proto (used by GetModuleGlobalName) */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); +#else +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); +#endif + +/* GetModuleGlobalName.proto */ +#if CYTHON_USE_DICT_VERSIONS +#define __Pyx_GetModuleGlobalName(var, name) do {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_mstate_global->__pyx_d))) ?\ + (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ + __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ + PY_UINT64_T __pyx_dict_version;\ + PyObject *__pyx_dict_cached_value;\ + (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); +#else +#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) +#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); +#endif + +/* decode_c_string.proto */ +static CYTHON_INLINE PyObject* __Pyx_decode_c_string( + const char* cstring, Py_ssize_t start, Py_ssize_t stop, + const char* encoding, const char* errors, + PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); + /* PyTypeError_Check.proto */ #define __Pyx_PyExc_TypeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_TypeError) @@ -2001,17 +2144,6 @@ CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k); #define __Pyx_DelItemOnTypeDict(tp, k) __Pyx__DelItemOnTypeDict((PyTypeObject*)tp, k) -/* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); -#else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) -#endif - -/* PyObjectGetAttrStrNoError.proto (used by SetupReduce) */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); - /* SetupReduce.proto */ static int __Pyx_setup_reduce(PyObject* type_obj); @@ -2148,32 +2280,6 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, PyObject *module, PyObject *globals, PyObject* code); -/* PyDictVersioning.proto (used by CLineInTraceback) */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) -#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ - (version_var) = __PYX_GET_DICT_VERSION(dict);\ - (cache_var) = (value); -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ - (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\ - } else {\ - (VAR) = __pyx_dict_cached_value = (LOOKUP);\ - __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ - }\ -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); -#else -#define __PYX_GET_DICT_VERSION(dict) (0) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); -#endif - /* CLineInTraceback.proto (used by AddTraceback) */ #if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); @@ -2345,6 +2451,10 @@ static int __Pyx_State_RemoveModule(void*); /* Module declarations from "planarity.full.cgraphLib" */ +/* Module declarations from "libc.string" */ + +/* Module declarations from "libc.stdlib" */ + /* Module declarations from "planarity.full.cappconst" */ /* Module declarations from "planarity.full.graph" */ @@ -2359,43 +2469,48 @@ int __pyx_module_is_main_planarity__full__graph = 0; /* #### Code section: string_decls ### */ static const char __pyx_k_Cython_wrapper_for_the_Edge_Add[] = "\nCython wrapper for the Edge Addition Planarity Suite Graph Library\n\nWraps a graphP struct using a Cython class and wraps functions and macros that\noperate over graphP structs.\n"; /* #### Code section: decls ### */ +static PyObject *__pyx_pf_9planarity_4full_5graph_gp_GetProjectVersionFull(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_2gp_GetLibPlanarityVersionFull(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static int __pyx_pf_9planarity_4full_5graph_5Graph___cinit__(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static void __pyx_pf_9planarity_4full_5graph_5Graph_2__dealloc__(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_4is_graph_NULL(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ -static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full_5graph_5Graph_6get_wrapper_for_graphP(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ -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_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_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 */ -static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full_5graph_5Graph_40gp_DupGraph(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_42gp_Read(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, PyObject *__pyx_v_infile_name); /* proto */ -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_44gp_Write(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, PyObject *__pyx_v_outfile_name, PyObject *__pyx_v_mode); /* proto */ -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetNeighborEdgeRecord(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_u, int __pyx_v_v); /* proto */ -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_48gp_GetVertexDegree(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ -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_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 */ -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_64gp_AttachK4Search(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_66gp_Embed(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_embedFlags); /* proto */ -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_68gp_TestEmbedResultIntegrity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_copy_of_orig_graph, int __pyx_v_embed_result); /* proto */ -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_70__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_72__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full_5graph_5Graph_4get_wrapper_for_graphP(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_6gp_IsEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_8gp_EdgeArrayStart(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_10gp_EdgeInUse(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_12gp_EdgeArraySize(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_14gp_EdgeInUseArraySize(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_16gp_GetFirstEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_18gp_GetNextEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_20gp_GetNeighbor(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_22gp_IsVertex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_24gp_GetFirstVertex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_26gp_GetLastVertex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_28gp_VertexInRangeAscending(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_30gp_GetN(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_32gp_InitGraph(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_n); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_34gp_ReinitializeGraph(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_36gp_CopyGraph(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_src_graph); /* proto */ +static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full_5graph_5Graph_38gp_DupGraph(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_40gp_Read(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, PyObject *__pyx_v_infile_name); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_42gp_Write(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, PyObject *__pyx_v_outfile_name, PyObject *__pyx_v_mode); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_44gp_FindEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_u, int __pyx_v_v); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetVertexDegree(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_48gp_GetEdgeCapacity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_50gp_EnsureEdgeCapacity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_new_edge_capacity); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_52gp_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_54gp_DeleteEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_56gp_ExtendWith_Planarity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_58gp_ExtendWith_DrawPlanar(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_60gp_DrawPlanar_RenderToFile(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, PyObject *__pyx_v_outfile_name); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_62gp_DrawPlanar_RenderToString(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_64gp_ExtendWith_Outerplanarity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_66gp_ExtendWith_K23Search(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_68gp_ExtendWith_K33Search(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_70gp_ExtendWith_K4Search(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_72gp_Embed(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_embedFlags); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_74gp_TestEmbedResultIntegrity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_copy_of_orig_graph, int __pyx_v_embed_result); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_76__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_78__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_tp_new_9planarity_4full_5graph_Graph(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ /* #### Code section: late_includes ### */ /* #### Code section: module_state ### */ @@ -2422,8 +2537,8 @@ typedef struct { __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items; __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_codeobj_tab[40]; + PyObject *__pyx_string_tab[226]; PyObject *__pyx_number_tab[1]; /* #### Code section: module_state_contents ### */ /* CommonTypesMetaclass.module_state_decls */ @@ -2466,210 +2581,231 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati #endif /* #### Code section: constant_name_defines ### */ #define __pyx_kp_u_ __pyx_string_tab[0] -#define __pyx_kp_u_Failed_to_attach_DrawPlanar_algo __pyx_string_tab[1] -#define __pyx_kp_u_Failed_to_attach_K23Search_algor __pyx_string_tab[2] -#define __pyx_kp_u_Failed_to_attach_K33Search_algor __pyx_string_tab[3] -#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_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_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] -#define __pyx_n_u_Graph_gp_GetVertexDegree __pyx_string_tab[77] -#define __pyx_n_u_Graph_gp_InitGraph __pyx_string_tab[78] -#define __pyx_n_u_Graph_gp_IsArc __pyx_string_tab[79] -#define __pyx_n_u_Graph_gp_IsVertex __pyx_string_tab[80] -#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_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_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_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] -#define __pyx_n_u_gp_GetVertexDegree __pyx_string_tab[126] -#define __pyx_n_u_gp_InitGraph __pyx_string_tab[127] -#define __pyx_n_u_gp_IsArc __pyx_string_tab[128] -#define __pyx_n_u_gp_IsVertex __pyx_string_tab[129] -#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_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_kp_u_Failed_to_convert_C_string_to_Py __pyx_string_tab[1] +#define __pyx_kp_u_Failed_to_extend_graph_with_Draw __pyx_string_tab[2] +#define __pyx_kp_u_Failed_to_extend_graph_with_K23S __pyx_string_tab[3] +#define __pyx_kp_u_Failed_to_extend_graph_with_K33S __pyx_string_tab[4] +#define __pyx_kp_u_Failed_to_extend_graph_with_K4Se __pyx_string_tab[5] +#define __pyx_kp_u_Failed_to_extend_graph_with_Oute __pyx_string_tab[6] +#define __pyx_kp_u_Failed_to_extend_graph_with_Plan __pyx_string_tab[7] +#define __pyx_kp_u_Failed_to_render_embedding_to_C __pyx_string_tab[8] +#define __pyx_kp_u_Failed_to_render_embedding_to_fi __pyx_string_tab[9] +#define __pyx_kp_u_Graph_is_not_initialized __pyx_string_tab[10] +#define __pyx_kp_u_Invalid_destination_graph_wrappe __pyx_string_tab[11] +#define __pyx_kp_u_Invalid_graph_format_specifier __pyx_string_tab[12] +#define __pyx_kp_u_Invalid_link_index_for_ulink __pyx_string_tab[13] +#define __pyx_kp_u_Invalid_link_index_for_vlink __pyx_string_tab[14] +#define __pyx_kp_u_Invalid_source_graph_wrapped_gra __pyx_string_tab[15] +#define __pyx_kp_u_None __pyx_string_tab[16] +#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[17] +#define __pyx_kp_u_Source_and_destination_graphs_mu __pyx_string_tab[18] +#define __pyx_kp_u_Source_graph_has_not_been_initia __pyx_string_tab[19] +#define __pyx_kp_u_Unable_to_add_edge_u_v __pyx_string_tab[20] +#define __pyx_kp_u_Unable_to_create_new_Graph_conta __pyx_string_tab[21] +#define __pyx_kp_u__2 __pyx_string_tab[22] +#define __pyx_kp_u__3 __pyx_string_tab[23] +#define __pyx_kp_u__4 __pyx_string_tab[24] +#define __pyx_kp_u__5 __pyx_string_tab[25] +#define __pyx_kp_u_add_note __pyx_string_tab[26] +#define __pyx_kp_u_and_vlink __pyx_string_tab[27] +#define __pyx_kp_u_disable __pyx_string_tab[28] +#define __pyx_kp_u_enable __pyx_string_tab[29] +#define __pyx_kp_u_failed __pyx_string_tab[30] +#define __pyx_kp_u_gc __pyx_string_tab[31] +#define __pyx_kp_u_gp_CopyGraph_failed __pyx_string_tab[32] +#define __pyx_kp_u_gp_DeleteEdge_failed_invalid_edg __pyx_string_tab[33] +#define __pyx_kp_u_gp_DupGraph_failed __pyx_string_tab[34] +#define __pyx_kp_u_gp_EdgeInUse_failed_invalid_edge __pyx_string_tab[35] +#define __pyx_kp_u_gp_EnsureEdgeCapacity_failed_to __pyx_string_tab[36] +#define __pyx_kp_u_gp_GetFirstEdge_failed_invalid_v __pyx_string_tab[37] +#define __pyx_kp_u_gp_GetNeighbor_failed_invalid_ed __pyx_string_tab[38] +#define __pyx_kp_u_gp_GetNextEdge_failed_invalid_ed __pyx_string_tab[39] +#define __pyx_kp_u_gp_InitGraph_failed __pyx_string_tab[40] +#define __pyx_kp_u_gp_New_failed __pyx_string_tab[41] +#define __pyx_kp_u_gp_Read_failed __pyx_string_tab[42] +#define __pyx_kp_u_gp_Write_of_graph_to __pyx_string_tab[43] +#define __pyx_kp_u_is_not_a_valid_vertex_label __pyx_string_tab[44] +#define __pyx_kp_u_is_not_one_of_gam __pyx_string_tab[45] +#define __pyx_kp_u_isenabled __pyx_string_tab[46] +#define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[47] +#define __pyx_kp_u_planarity_full_graph_pyx __pyx_string_tab[48] +#define __pyx_kp_u_stringsource __pyx_string_tab[49] +#define __pyx_kp_u_with_ulink __pyx_string_tab[50] +#define __pyx_n_u_EMBEDFLAGS_DRAWPLANAR __pyx_string_tab[51] +#define __pyx_n_u_EMBEDFLAGS_OUTERPLANAR __pyx_string_tab[52] +#define __pyx_n_u_EMBEDFLAGS_PLANAR __pyx_string_tab[53] +#define __pyx_n_u_EMBEDFLAGS_SEARCHFORK23 __pyx_string_tab[54] +#define __pyx_n_u_EMBEDFLAGS_SEARCHFORK33 __pyx_string_tab[55] +#define __pyx_n_u_EMBEDFLAGS_SEARCHFORK4 __pyx_string_tab[56] +#define __pyx_n_u_FileName __pyx_string_tab[57] +#define __pyx_n_u_Graph __pyx_string_tab[58] +#define __pyx_n_u_Graph___reduce_cython __pyx_string_tab[59] +#define __pyx_n_u_Graph___setstate_cython __pyx_string_tab[60] +#define __pyx_n_u_Graph_get_wrapper_for_graphP __pyx_string_tab[61] +#define __pyx_n_u_Graph_gp_AddEdge __pyx_string_tab[62] +#define __pyx_n_u_Graph_gp_CopyGraph __pyx_string_tab[63] +#define __pyx_n_u_Graph_gp_DeleteEdge __pyx_string_tab[64] +#define __pyx_n_u_Graph_gp_DrawPlanar_RenderToFile __pyx_string_tab[65] +#define __pyx_n_u_Graph_gp_DrawPlanar_RenderToStri __pyx_string_tab[66] +#define __pyx_n_u_Graph_gp_DupGraph __pyx_string_tab[67] +#define __pyx_n_u_Graph_gp_EdgeArraySize __pyx_string_tab[68] +#define __pyx_n_u_Graph_gp_EdgeArrayStart __pyx_string_tab[69] +#define __pyx_n_u_Graph_gp_EdgeInUse __pyx_string_tab[70] +#define __pyx_n_u_Graph_gp_EdgeInUseArraySize __pyx_string_tab[71] +#define __pyx_n_u_Graph_gp_Embed __pyx_string_tab[72] +#define __pyx_n_u_Graph_gp_EnsureEdgeCapacity __pyx_string_tab[73] +#define __pyx_n_u_Graph_gp_ExtendWith_DrawPlanar __pyx_string_tab[74] +#define __pyx_n_u_Graph_gp_ExtendWith_K23Search __pyx_string_tab[75] +#define __pyx_n_u_Graph_gp_ExtendWith_K33Search __pyx_string_tab[76] +#define __pyx_n_u_Graph_gp_ExtendWith_K4Search __pyx_string_tab[77] +#define __pyx_n_u_Graph_gp_ExtendWith_Outerplanari __pyx_string_tab[78] +#define __pyx_n_u_Graph_gp_ExtendWith_Planarity __pyx_string_tab[79] +#define __pyx_n_u_Graph_gp_FindEdge __pyx_string_tab[80] +#define __pyx_n_u_Graph_gp_GetEdgeCapacity __pyx_string_tab[81] +#define __pyx_n_u_Graph_gp_GetFirstEdge __pyx_string_tab[82] +#define __pyx_n_u_Graph_gp_GetFirstVertex __pyx_string_tab[83] +#define __pyx_n_u_Graph_gp_GetLastVertex __pyx_string_tab[84] +#define __pyx_n_u_Graph_gp_GetN __pyx_string_tab[85] +#define __pyx_n_u_Graph_gp_GetNeighbor __pyx_string_tab[86] +#define __pyx_n_u_Graph_gp_GetNextEdge __pyx_string_tab[87] +#define __pyx_n_u_Graph_gp_GetVertexDegree __pyx_string_tab[88] +#define __pyx_n_u_Graph_gp_InitGraph __pyx_string_tab[89] +#define __pyx_n_u_Graph_gp_IsEdge __pyx_string_tab[90] +#define __pyx_n_u_Graph_gp_IsVertex __pyx_string_tab[91] +#define __pyx_n_u_Graph_gp_Read __pyx_string_tab[92] +#define __pyx_n_u_Graph_gp_ReinitializeGraph __pyx_string_tab[93] +#define __pyx_n_u_Graph_gp_TestEmbedResultIntegrit __pyx_string_tab[94] +#define __pyx_n_u_Graph_gp_VertexInRangeAscending __pyx_string_tab[95] +#define __pyx_n_u_Graph_gp_Write __pyx_string_tab[96] +#define __pyx_n_u_NIL __pyx_string_tab[97] +#define __pyx_n_u_NONEMBEDDABLE __pyx_string_tab[98] +#define __pyx_n_u_NOTOK __pyx_string_tab[99] +#define __pyx_n_u_OK __pyx_string_tab[100] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[101] +#define __pyx_n_u_a __pyx_string_tab[102] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[103] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[104] +#define __pyx_n_u_copy_of_orig_graph __pyx_string_tab[105] +#define __pyx_n_u_e __pyx_string_tab[106] +#define __pyx_n_u_embedFlags __pyx_string_tab[107] +#define __pyx_n_u_embed_result __pyx_string_tab[108] +#define __pyx_n_u_encoded __pyx_string_tab[109] +#define __pyx_n_u_encoded_version __pyx_string_tab[110] +#define __pyx_n_u_func __pyx_string_tab[111] +#define __pyx_n_u_g __pyx_string_tab[112] +#define __pyx_n_u_get_wrapper_for_graphP __pyx_string_tab[113] +#define __pyx_n_u_getstate __pyx_string_tab[114] +#define __pyx_n_u_gp_AddEdge __pyx_string_tab[115] +#define __pyx_n_u_gp_CopyGraph __pyx_string_tab[116] +#define __pyx_n_u_gp_DeleteEdge __pyx_string_tab[117] +#define __pyx_n_u_gp_DrawPlanar_RenderToFile __pyx_string_tab[118] +#define __pyx_n_u_gp_DrawPlanar_RenderToString __pyx_string_tab[119] +#define __pyx_n_u_gp_DupGraph __pyx_string_tab[120] +#define __pyx_n_u_gp_EdgeArraySize __pyx_string_tab[121] +#define __pyx_n_u_gp_EdgeArrayStart __pyx_string_tab[122] +#define __pyx_n_u_gp_EdgeInUse __pyx_string_tab[123] +#define __pyx_n_u_gp_EdgeInUseArraySize __pyx_string_tab[124] +#define __pyx_n_u_gp_Embed __pyx_string_tab[125] +#define __pyx_n_u_gp_EnsureEdgeCapacity __pyx_string_tab[126] +#define __pyx_n_u_gp_ExtendWith_DrawPlanar __pyx_string_tab[127] +#define __pyx_n_u_gp_ExtendWith_K23Search __pyx_string_tab[128] +#define __pyx_n_u_gp_ExtendWith_K33Search __pyx_string_tab[129] +#define __pyx_n_u_gp_ExtendWith_K4Search __pyx_string_tab[130] +#define __pyx_n_u_gp_ExtendWith_Outerplanarity __pyx_string_tab[131] +#define __pyx_n_u_gp_ExtendWith_Planarity __pyx_string_tab[132] +#define __pyx_n_u_gp_FindEdge __pyx_string_tab[133] +#define __pyx_n_u_gp_GetEdgeCapacity __pyx_string_tab[134] +#define __pyx_n_u_gp_GetFirstEdge __pyx_string_tab[135] +#define __pyx_n_u_gp_GetFirstVertex __pyx_string_tab[136] +#define __pyx_n_u_gp_GetLastVertex __pyx_string_tab[137] +#define __pyx_n_u_gp_GetLibPlanarityVersionFull __pyx_string_tab[138] +#define __pyx_n_u_gp_GetN __pyx_string_tab[139] +#define __pyx_n_u_gp_GetNeighbor __pyx_string_tab[140] +#define __pyx_n_u_gp_GetNextEdge __pyx_string_tab[141] +#define __pyx_n_u_gp_GetProjectVersionFull __pyx_string_tab[142] +#define __pyx_n_u_gp_GetVertexDegree __pyx_string_tab[143] +#define __pyx_n_u_gp_InitGraph __pyx_string_tab[144] +#define __pyx_n_u_gp_IsEdge __pyx_string_tab[145] +#define __pyx_n_u_gp_IsVertex __pyx_string_tab[146] +#define __pyx_n_u_gp_Read __pyx_string_tab[147] +#define __pyx_n_u_gp_ReinitializeGraph __pyx_string_tab[148] +#define __pyx_n_u_gp_TestEmbedResultIntegrity __pyx_string_tab[149] +#define __pyx_n_u_gp_VertexInRangeAscending __pyx_string_tab[150] +#define __pyx_n_u_gp_Write __pyx_string_tab[151] +#define __pyx_n_u_infile_name __pyx_string_tab[152] +#define __pyx_n_u_int __pyx_string_tab[153] +#define __pyx_n_u_is_coroutine __pyx_string_tab[154] +#define __pyx_n_u_items __pyx_string_tab[155] +#define __pyx_n_u_m __pyx_string_tab[156] +#define __pyx_n_u_main __pyx_string_tab[157] +#define __pyx_n_u_mode __pyx_string_tab[158] +#define __pyx_n_u_mode_code __pyx_string_tab[159] +#define __pyx_n_u_module __pyx_string_tab[160] +#define __pyx_n_u_n __pyx_string_tab[161] +#define __pyx_n_u_name __pyx_string_tab[162] +#define __pyx_n_u_new_edge_capacity __pyx_string_tab[163] +#define __pyx_n_u_new_graph __pyx_string_tab[164] +#define __pyx_n_u_new_wrapper __pyx_string_tab[165] +#define __pyx_n_u_outfile_name __pyx_string_tab[166] +#define __pyx_n_u_planarity_full_graph __pyx_string_tab[167] +#define __pyx_n_u_pop __pyx_string_tab[168] +#define __pyx_n_u_pyx_state __pyx_string_tab[169] +#define __pyx_n_u_qualname __pyx_string_tab[170] +#define __pyx_n_u_reduce __pyx_string_tab[171] +#define __pyx_n_u_reduce_cython __pyx_string_tab[172] +#define __pyx_n_u_reduce_ex __pyx_string_tab[173] +#define __pyx_n_u_renditionString __pyx_string_tab[174] +#define __pyx_n_u_return __pyx_string_tab[175] +#define __pyx_n_u_self __pyx_string_tab[176] +#define __pyx_n_u_set_name __pyx_string_tab[177] +#define __pyx_n_u_setdefault __pyx_string_tab[178] +#define __pyx_n_u_setstate __pyx_string_tab[179] +#define __pyx_n_u_setstate_cython __pyx_string_tab[180] +#define __pyx_n_u_src_graph __pyx_string_tab[181] +#define __pyx_n_u_src_graph_uninit_error __pyx_string_tab[182] +#define __pyx_n_u_string_conversion_error __pyx_string_tab[183] +#define __pyx_n_u_test __pyx_string_tab[184] +#define __pyx_n_u_theFileName __pyx_string_tab[185] +#define __pyx_n_u_theGraph_dup __pyx_string_tab[186] +#define __pyx_n_u_u __pyx_string_tab[187] +#define __pyx_n_u_ulink __pyx_string_tab[188] +#define __pyx_n_u_v __pyx_string_tab[189] +#define __pyx_n_u_values __pyx_string_tab[190] +#define __pyx_n_u_vlink __pyx_string_tab[191] +#define __pyx_kp_b_iso88591_4_Q_aq_Q __pyx_string_tab[192] +#define __pyx_kp_b_iso88591_A_1D __pyx_string_tab[193] +#define __pyx_kp_b_iso88591_A_1D_L_aq __pyx_string_tab[194] +#define __pyx_kp_b_iso88591_A_1_l_a_aq __pyx_string_tab[195] +#define __pyx_kp_b_iso88591_A_4_NlZ_a_1 __pyx_string_tab[196] +#define __pyx_kp_b_iso88591_A_4_Q_a_y_3a_j_q_A_4xs_Yha_A_M_l __pyx_string_tab[197] +#define __pyx_kp_b_iso88591_A_4q __pyx_string_tab[198] +#define __pyx_kp_b_iso88591_A_4t_Qa_a_8_at_q __pyx_string_tab[199] +#define __pyx_kp_b_iso88591_A_4t_Qa_a_Qa_Qd_a __pyx_string_tab[200] +#define __pyx_kp_b_iso88591_A_4t_Qa_a_q_q_L __pyx_string_tab[201] +#define __pyx_kp_b_iso88591_A_4t_q_a_B_1 __pyx_string_tab[202] +#define __pyx_kp_b_iso88591_A_4t_q_as_1_1D_A __pyx_string_tab[203] +#define __pyx_kp_b_iso88591_A_4t_q_as_1_4t_q_as_1_AT_S __pyx_string_tab[204] +#define __pyx_kp_b_iso88591_A_6_Bd_1_a_1_6_Bd_1_a_1_Kq_L_7_W __pyx_string_tab[205] +#define __pyx_kp_b_iso88591_A_AT_aq __pyx_string_tab[206] +#define __pyx_kp_b_iso88591_A_M_l_aq __pyx_string_tab[207] +#define __pyx_kp_b_iso88591_A_Q_1_l_CTTWWX_aq_A_a __pyx_string_tab[208] +#define __pyx_kp_b_iso88591_A_Qd_l_aq __pyx_string_tab[209] +#define __pyx_kp_b_iso88591_A_Y_0_S_E_A_m5_1_4q_A_31A_q_IQd __pyx_string_tab[210] +#define __pyx_kp_b_iso88591_A_a __pyx_string_tab[211] +#define __pyx_kp_b_iso88591_A_at1 __pyx_string_tab[212] +#define __pyx_kp_b_iso88591_A_at1_2 __pyx_string_tab[213] +#define __pyx_kp_b_iso88591_A_c_s_q_L __pyx_string_tab[214] +#define __pyx_kp_b_iso88591_A_q_A_HAT_Z_1_aq __pyx_string_tab[215] +#define __pyx_kp_b_iso88591_A_q_q_L_YZ_a_EQa __pyx_string_tab[216] +#define __pyx_kp_b_iso88591_A_s_A_r_d_q_L __pyx_string_tab[217] +#define __pyx_kp_b_iso88591_A_s_A_s_t1_l __pyx_string_tab[218] +#define __pyx_kp_b_iso88591_C1 __pyx_string_tab[219] +#define __pyx_kp_b_iso88591_H __pyx_string_tab[220] +#define __pyx_kp_b_iso88591_Q __pyx_string_tab[221] +#define __pyx_kp_b_iso88591_Q_6l_4q_1_Qa_uA_S_Qa_9Ks_Qay_a __pyx_string_tab[222] +#define __pyx_kp_b_iso88591_YYZ_4AT_EWWccd __pyx_string_tab[223] +#define __pyx_kp_b_iso88591_a_k_A_Qa_A_q __pyx_string_tab[224] +#define __pyx_kp_b_iso88591_l __pyx_string_tab[225] #define __pyx_int_0 __pyx_number_tab[0] /* #### Code section: module_state_clear ### */ #if CYTHON_USE_MODULE_STATE @@ -2687,8 +2823,8 @@ static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { #endif 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<40; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<226; ++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 */ @@ -2714,8 +2850,8 @@ static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode); 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<40; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<226; ++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 */ @@ -2730,7 +2866,169 @@ return 0; #endif /* #### Code section: module_code ### */ -/* "planarity/full/graph.pyx":27 +/* "planarity/full/graph.pyx":28 + * + * + * def gp_GetProjectVersionFull(): # <<<<<<<<<<<<<< + * cdef bytes encoded_version = cgraphLib.gp_GetProjectVersionFull() + * return encoded_version.decode('utf-8') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_9planarity_4full_5graph_1gp_GetProjectVersionFull(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_gp_GetProjectVersionFull, "gp_GetProjectVersionFull()"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_1gp_GetProjectVersionFull = {"gp_GetProjectVersionFull", (PyCFunction)__pyx_pw_9planarity_4full_5graph_1gp_GetProjectVersionFull, METH_NOARGS, __pyx_doc_9planarity_4full_5graph_gp_GetProjectVersionFull}; +static PyObject *__pyx_pw_9planarity_4full_5graph_1gp_GetProjectVersionFull(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("gp_GetProjectVersionFull (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_9planarity_4full_5graph_gp_GetProjectVersionFull(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9planarity_4full_5graph_gp_GetProjectVersionFull(CYTHON_UNUSED PyObject *__pyx_self) { + PyObject *__pyx_v_encoded_version = 0; + 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_GetProjectVersionFull", 0); + + /* "planarity/full/graph.pyx":29 + * + * def gp_GetProjectVersionFull(): + * cdef bytes encoded_version = cgraphLib.gp_GetProjectVersionFull() # <<<<<<<<<<<<<< + * return encoded_version.decode('utf-8') + * +*/ + __pyx_t_1 = __Pyx_PyBytes_FromString(gp_GetProjectVersionFull()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_encoded_version = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "planarity/full/graph.pyx":30 + * def gp_GetProjectVersionFull(): + * cdef bytes encoded_version = cgraphLib.gp_GetProjectVersionFull() + * return encoded_version.decode('utf-8') # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_decode_bytes(__pyx_v_encoded_version, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "planarity/full/graph.pyx":28 + * + * + * def gp_GetProjectVersionFull(): # <<<<<<<<<<<<<< + * cdef bytes encoded_version = cgraphLib.gp_GetProjectVersionFull() + * return encoded_version.decode('utf-8') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("planarity.full.graph.gp_GetProjectVersionFull", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_encoded_version); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "planarity/full/graph.pyx":33 + * + * + * def gp_GetLibPlanarityVersionFull(): # <<<<<<<<<<<<<< + * cdef bytes encoded_version = cgraphLib.gp_GetLibPlanarityVersionFull() + * return encoded_version.decode('utf-8') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_9planarity_4full_5graph_3gp_GetLibPlanarityVersionFull(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_2gp_GetLibPlanarityVersionFull, "gp_GetLibPlanarityVersionFull()"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_3gp_GetLibPlanarityVersionFull = {"gp_GetLibPlanarityVersionFull", (PyCFunction)__pyx_pw_9planarity_4full_5graph_3gp_GetLibPlanarityVersionFull, METH_NOARGS, __pyx_doc_9planarity_4full_5graph_2gp_GetLibPlanarityVersionFull}; +static PyObject *__pyx_pw_9planarity_4full_5graph_3gp_GetLibPlanarityVersionFull(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("gp_GetLibPlanarityVersionFull (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_9planarity_4full_5graph_2gp_GetLibPlanarityVersionFull(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9planarity_4full_5graph_2gp_GetLibPlanarityVersionFull(CYTHON_UNUSED PyObject *__pyx_self) { + PyObject *__pyx_v_encoded_version = 0; + 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_GetLibPlanarityVersionFull", 0); + + /* "planarity/full/graph.pyx":34 + * + * def gp_GetLibPlanarityVersionFull(): + * cdef bytes encoded_version = cgraphLib.gp_GetLibPlanarityVersionFull() # <<<<<<<<<<<<<< + * return encoded_version.decode('utf-8') + * +*/ + __pyx_t_1 = __Pyx_PyBytes_FromString(gp_GetLibPlanarityVersionFull()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_encoded_version = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "planarity/full/graph.pyx":35 + * def gp_GetLibPlanarityVersionFull(): + * cdef bytes encoded_version = cgraphLib.gp_GetLibPlanarityVersionFull() + * return encoded_version.decode('utf-8') # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_decode_bytes(__pyx_v_encoded_version, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "planarity/full/graph.pyx":33 + * + * + * def gp_GetLibPlanarityVersionFull(): # <<<<<<<<<<<<<< + * cdef bytes encoded_version = cgraphLib.gp_GetLibPlanarityVersionFull() + * return encoded_version.decode('utf-8') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("planarity.full.graph.gp_GetLibPlanarityVersionFull", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_encoded_version); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "planarity/full/graph.pyx":39 * * cdef class Graph: * def __cinit__(self): # <<<<<<<<<<<<<< @@ -2775,7 +3073,7 @@ static int __pyx_pf_9planarity_4full_5graph_5Graph___cinit__(struct __pyx_obj_9p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "planarity/full/graph.pyx":29 + /* "planarity/full/graph.pyx":41 * def __cinit__(self): * global global_id_count * self._theGraph = cgraphLib.gp_New() # <<<<<<<<<<<<<< @@ -2784,7 +3082,7 @@ static int __pyx_pf_9planarity_4full_5graph_5Graph___cinit__(struct __pyx_obj_9p */ __pyx_v_self->_theGraph = gp_New(); - /* "planarity/full/graph.pyx":30 + /* "planarity/full/graph.pyx":42 * global global_id_count * self._theGraph = cgraphLib.gp_New() * if self._theGraph == NULL: # <<<<<<<<<<<<<< @@ -2794,7 +3092,7 @@ static int __pyx_pf_9planarity_4full_5graph_5Graph___cinit__(struct __pyx_obj_9p __pyx_t_1 = (__pyx_v_self->_theGraph == NULL); if (unlikely(__pyx_t_1)) { - /* "planarity/full/graph.pyx":31 + /* "planarity/full/graph.pyx":43 * self._theGraph = cgraphLib.gp_New() * if self._theGraph == NULL: * raise MemoryError("gp_New() failed.") # <<<<<<<<<<<<<< @@ -2807,14 +3105,14 @@ static int __pyx_pf_9planarity_4full_5graph_5Graph___cinit__(struct __pyx_obj_9p PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_gp_New_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, 31, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __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, 31, __pyx_L1_error) + __PYX_ERR(0, 43, __pyx_L1_error) - /* "planarity/full/graph.pyx":30 + /* "planarity/full/graph.pyx":42 * global global_id_count * self._theGraph = cgraphLib.gp_New() * if self._theGraph == NULL: # <<<<<<<<<<<<<< @@ -2823,7 +3121,7 @@ static int __pyx_pf_9planarity_4full_5graph_5Graph___cinit__(struct __pyx_obj_9p */ } - /* "planarity/full/graph.pyx":32 + /* "planarity/full/graph.pyx":44 * if self._theGraph == NULL: * raise MemoryError("gp_New() failed.") * self.owns_graphP = True # <<<<<<<<<<<<<< @@ -2832,7 +3130,7 @@ static int __pyx_pf_9planarity_4full_5graph_5Graph___cinit__(struct __pyx_obj_9p */ __pyx_v_self->owns_graphP = 1; - /* "planarity/full/graph.pyx":27 + /* "planarity/full/graph.pyx":39 * * cdef class Graph: * def __cinit__(self): # <<<<<<<<<<<<<< @@ -2853,7 +3151,7 @@ static int __pyx_pf_9planarity_4full_5graph_5Graph___cinit__(struct __pyx_obj_9p return __pyx_r; } -/* "planarity/full/graph.pyx":34 +/* "planarity/full/graph.pyx":46 * self.owns_graphP = True * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -2878,7 +3176,7 @@ static void __pyx_pf_9planarity_4full_5graph_5Graph_2__dealloc__(struct __pyx_ob int __pyx_t_1; int __pyx_t_2; - /* "planarity/full/graph.pyx":35 + /* "planarity/full/graph.pyx":47 * * def __dealloc__(self): * if self._theGraph != NULL and self.owns_graphP: # <<<<<<<<<<<<<< @@ -2895,16 +3193,16 @@ static void __pyx_pf_9planarity_4full_5graph_5Graph_2__dealloc__(struct __pyx_ob __pyx_L4_bool_binop_done:; if (__pyx_t_1) { - /* "planarity/full/graph.pyx":36 + /* "planarity/full/graph.pyx":48 * def __dealloc__(self): * if self._theGraph != NULL and self.owns_graphP: * cgraphLib.gp_Free(&self._theGraph) # <<<<<<<<<<<<<< * - * def is_graph_NULL(self): + * def get_wrapper_for_graphP(self) -> Graph: */ gp_Free((&__pyx_v_self->_theGraph)); - /* "planarity/full/graph.pyx":35 + /* "planarity/full/graph.pyx":47 * * def __dealloc__(self): * if self._theGraph != NULL and self.owns_graphP: # <<<<<<<<<<<<<< @@ -2913,7 +3211,7 @@ static void __pyx_pf_9planarity_4full_5graph_5Graph_2__dealloc__(struct __pyx_ob */ } - /* "planarity/full/graph.pyx":34 + /* "planarity/full/graph.pyx":46 * self.owns_graphP = True * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -2924,25 +3222,25 @@ static void __pyx_pf_9planarity_4full_5graph_5Graph_2__dealloc__(struct __pyx_ob /* function exit code */ } -/* "planarity/full/graph.pyx":38 +/* "planarity/full/graph.pyx":50 * cgraphLib.gp_Free(&self._theGraph) * - * def is_graph_NULL(self): # <<<<<<<<<<<<<< - * return self._theGraph == NULL + * def get_wrapper_for_graphP(self) -> Graph: # <<<<<<<<<<<<<< + * cdef Graph new_wrapper = Graph() * */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_5is_graph_NULL(PyObject *__pyx_v_self, +static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pw_9planarity_4full_5graph_5Graph_5get_wrapper_for_graphP(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_4is_graph_NULL, "Graph.is_graph_NULL(self)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_5is_graph_NULL = {"is_graph_NULL", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_5is_graph_NULL, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_4is_graph_NULL}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_5is_graph_NULL(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_4get_wrapper_for_graphP, "Graph.get_wrapper_for_graphP(self) -> Graph"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_5get_wrapper_for_graphP = {"get_wrapper_for_graphP", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_5get_wrapper_for_graphP, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_4get_wrapper_for_graphP}; +static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pw_9planarity_4full_5graph_5Graph_5get_wrapper_for_graphP(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -2953,9 +3251,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("is_graph_NULL (wrapper)", 0); + __Pyx_RefNannySetupContext("get_wrapper_for_graphP (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -2964,145 +3262,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("is_graph_NULL", 1, 0, 0, __pyx_nargs); return NULL; } + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_wrapper_for_graphP", 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("is_graph_NULL", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_4is_graph_NULL(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_wrapper_for_graphP", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_4get_wrapper_for_graphP(((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_4is_graph_NULL(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { - PyObject *__pyx_r = NULL; +static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full_5graph_5Graph_4get_wrapper_for_graphP(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { + struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_new_wrapper = 0; + 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_t_4; + graphP __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_graph_NULL", 0); + __Pyx_RefNannySetupContext("get_wrapper_for_graphP", 0); - /* "planarity/full/graph.pyx":39 - * - * def is_graph_NULL(self): - * return self._theGraph == NULL # <<<<<<<<<<<<<< + /* "planarity/full/graph.pyx":51 * * def get_wrapper_for_graphP(self) -> Graph: + * cdef Graph new_wrapper = Graph() # <<<<<<<<<<<<<< + * + * if new_wrapper._theGraph != NULL: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->_theGraph == NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_callargs+__pyx_t_3, (1-__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, 51, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_new_wrapper = ((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - /* "planarity/full/graph.pyx":38 - * cgraphLib.gp_Free(&self._theGraph) - * - * def is_graph_NULL(self): # <<<<<<<<<<<<<< - * return self._theGraph == NULL - * -*/ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("planarity.full.graph.Graph.is_graph_NULL", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "planarity/full/graph.pyx":41 - * return self._theGraph == NULL - * - * def get_wrapper_for_graphP(self) -> Graph: # <<<<<<<<<<<<<< - * cdef Graph new_wrapper = Graph() - * -*/ - -/* Python wrapper */ -static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pw_9planarity_4full_5graph_5Graph_7get_wrapper_for_graphP(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_6get_wrapper_for_graphP, "Graph.get_wrapper_for_graphP(self) -> Graph"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_7get_wrapper_for_graphP = {"get_wrapper_for_graphP", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_7get_wrapper_for_graphP, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_6get_wrapper_for_graphP}; -static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pw_9planarity_4full_5graph_5Graph_7get_wrapper_for_graphP(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; - struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_wrapper_for_graphP (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("get_wrapper_for_graphP", 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_wrapper_for_graphP", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_6get_wrapper_for_graphP(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full_5graph_5Graph_6get_wrapper_for_graphP(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { - struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_new_wrapper = 0; - 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_t_4; - graphP __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_wrapper_for_graphP", 0); - - /* "planarity/full/graph.pyx":42 - * - * def get_wrapper_for_graphP(self) -> Graph: - * cdef Graph new_wrapper = Graph() # <<<<<<<<<<<<<< - * - * if new_wrapper._theGraph != NULL: -*/ - __pyx_t_2 = NULL; - __pyx_t_3 = 1; - { - PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; - __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_callargs+__pyx_t_3, (1-__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, 42, __pyx_L1_error) - __Pyx_GOTREF((PyObject *)__pyx_t_1); - } - __pyx_v_new_wrapper = ((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "planarity/full/graph.pyx":44 - * cdef Graph new_wrapper = Graph() + /* "planarity/full/graph.pyx":53 + * cdef Graph new_wrapper = Graph() * * if new_wrapper._theGraph != NULL: # <<<<<<<<<<<<<< * cgraphLib.gp_Free(&new_wrapper._theGraph) @@ -3111,7 +3316,7 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full __pyx_t_4 = (__pyx_v_new_wrapper->_theGraph != NULL); if (__pyx_t_4) { - /* "planarity/full/graph.pyx":45 + /* "planarity/full/graph.pyx":54 * * if new_wrapper._theGraph != NULL: * cgraphLib.gp_Free(&new_wrapper._theGraph) # <<<<<<<<<<<<<< @@ -3120,7 +3325,7 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full */ gp_Free((&__pyx_v_new_wrapper->_theGraph)); - /* "planarity/full/graph.pyx":44 + /* "planarity/full/graph.pyx":53 * cdef Graph new_wrapper = Graph() * * if new_wrapper._theGraph != NULL: # <<<<<<<<<<<<<< @@ -3129,7 +3334,7 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full */ } - /* "planarity/full/graph.pyx":46 + /* "planarity/full/graph.pyx":55 * if new_wrapper._theGraph != NULL: * cgraphLib.gp_Free(&new_wrapper._theGraph) * new_wrapper._theGraph = self._theGraph # <<<<<<<<<<<<<< @@ -3139,7 +3344,7 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full __pyx_t_5 = __pyx_v_self->_theGraph; __pyx_v_new_wrapper->_theGraph = __pyx_t_5; - /* "planarity/full/graph.pyx":48 + /* "planarity/full/graph.pyx":57 * new_wrapper._theGraph = self._theGraph * * new_wrapper.owns_graphP = False # <<<<<<<<<<<<<< @@ -3148,20 +3353,20 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full */ __pyx_v_new_wrapper->owns_graphP = 0; - /* "planarity/full/graph.pyx":49 + /* "planarity/full/graph.pyx":58 * * new_wrapper.owns_graphP = False * return new_wrapper # <<<<<<<<<<<<<< * - * def gp_IsArc(self, int e): + * def gp_IsEdge(self, int e): */ __Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_new_wrapper); __pyx_r = __pyx_v_new_wrapper; goto __pyx_L0; - /* "planarity/full/graph.pyx":41 - * return self._theGraph == NULL + /* "planarity/full/graph.pyx":50 + * cgraphLib.gp_Free(&self._theGraph) * * def get_wrapper_for_graphP(self) -> Graph: # <<<<<<<<<<<<<< * cdef Graph new_wrapper = Graph() @@ -3181,25 +3386,25 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full return __pyx_r; } -/* "planarity/full/graph.pyx":51 +/* "planarity/full/graph.pyx":60 * return new_wrapper * - * def gp_IsArc(self, int e): # <<<<<<<<<<<<<< + * def gp_IsEdge(self, int e): # <<<<<<<<<<<<<< * return ( - * (e >= self.gp_GetFirstEdge()) and + * (e >= self.gp_EdgeArrayStart()) and */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_9gp_IsArc(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_7gp_IsEdge(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_8gp_IsArc, "Graph.gp_IsArc(self, int e)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_9gp_IsArc = {"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}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_9gp_IsArc(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_6gp_IsEdge, "Graph.gp_IsEdge(self, int e)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_7gp_IsEdge = {"gp_IsEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_7gp_IsEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_6gp_IsEdge}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_7gp_IsEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -3217,7 +3422,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("gp_IsArc (wrapper)", 0); + __Pyx_RefNannySetupContext("gp_IsEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -3229,43 +3434,43 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { 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, 51, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 60, __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, 51, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 60, __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_IsArc", 0) < (0)) __PYX_ERR(0, 51, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_IsEdge", 0) < (0)) __PYX_ERR(0, 60, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_IsArc", 1, 1, 1, i); __PYX_ERR(0, 51, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_IsEdge", 1, 1, 1, i); __PYX_ERR(0, 60, __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, 51, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 60, __pyx_L3_error) } - __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 51, __pyx_L3_error) + __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("gp_IsArc", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 51, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("gp_IsEdge", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 60, __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_IsArc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_8gp_IsArc(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_6gp_IsEdge(((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) { @@ -3275,7 +3480,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_8gp_IsArc(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_6gp_IsEdge(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; @@ -3288,40 +3493,40 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_8gp_IsArc(struct __pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("gp_IsArc", 0); + __Pyx_RefNannySetupContext("gp_IsEdge", 0); - /* "planarity/full/graph.pyx":52 + /* "planarity/full/graph.pyx":61 * - * def gp_IsArc(self, int e): + * def gp_IsEdge(self, int e): * return ( # <<<<<<<<<<<<<< - * (e >= self.gp_GetFirstEdge()) and - * (e < self.gp_EdgeIndexBound()) and + * (e >= self.gp_EdgeArrayStart()) and + * (e < self.gp_EdgeArraySize()) and */ __Pyx_XDECREF(__pyx_r); - /* "planarity/full/graph.pyx":53 - * def gp_IsArc(self, int e): + /* "planarity/full/graph.pyx":62 + * def gp_IsEdge(self, int e): * return ( - * (e >= self.gp_GetFirstEdge()) and # <<<<<<<<<<<<<< - * (e < self.gp_EdgeIndexBound()) and - * cgraphLib.gp_IsArc(e) + * (e >= self.gp_EdgeArrayStart()) and # <<<<<<<<<<<<<< + * (e < self.gp_EdgeArraySize()) and + * cgraphLib.gp_IsEdge(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_t_2 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; - __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_GetFirstEdge, __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_EdgeArrayStart, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } - __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 53, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 62, __pyx_L1_error) if (__pyx_t_6) { __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { @@ -3331,29 +3536,29 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_8gp_IsArc(struct __pyx_ goto __pyx_L3_bool_binop_done; } - /* "planarity/full/graph.pyx":54 + /* "planarity/full/graph.pyx":63 * return ( - * (e >= self.gp_GetFirstEdge()) and - * (e < self.gp_EdgeIndexBound()) and # <<<<<<<<<<<<<< - * cgraphLib.gp_IsArc(e) + * (e >= self.gp_EdgeArrayStart()) and + * (e < self.gp_EdgeArraySize()) and # <<<<<<<<<<<<<< + * cgraphLib.gp_IsEdge(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) + __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __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) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } - __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 63, __pyx_L1_error) if (__pyx_t_6) { __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { @@ -3363,15 +3568,15 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_8gp_IsArc(struct __pyx_ goto __pyx_L3_bool_binop_done; } - /* "planarity/full/graph.pyx":55 - * (e >= self.gp_GetFirstEdge()) and - * (e < self.gp_EdgeIndexBound()) and - * cgraphLib.gp_IsArc(e) # <<<<<<<<<<<<<< + /* "planarity/full/graph.pyx":64 + * (e >= self.gp_EdgeArrayStart()) and + * (e < self.gp_EdgeArraySize()) and + * cgraphLib.gp_IsEdge(self._theGraph, e) # <<<<<<<<<<<<<< * ) * */ - __pyx_t_7 = gp_IsArc(__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_t_7 = gp_IsEdge(__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, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __pyx_t_2; __pyx_t_2 = 0; @@ -3380,12 +3585,12 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_8gp_IsArc(struct __pyx_ __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/full/graph.pyx":51 + /* "planarity/full/graph.pyx":60 * return new_wrapper * - * def gp_IsArc(self, int e): # <<<<<<<<<<<<<< + * def gp_IsEdge(self, int e): # <<<<<<<<<<<<<< * return ( - * (e >= self.gp_GetFirstEdge()) and + * (e >= self.gp_EdgeArrayStart()) and */ /* function exit code */ @@ -3394,7 +3599,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_8gp_IsArc(struct __pyx_ __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsArc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3402,25 +3607,25 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_8gp_IsArc(struct __pyx_ return __pyx_r; } -/* "planarity/full/graph.pyx":58 +/* "planarity/full/graph.pyx":67 * ) * - * def gp_GetFirstEdge(self): # <<<<<<<<<<<<<< - * return cgraphLib.gp_GetFirstEdge(self._theGraph) + * def gp_EdgeArrayStart(self): # <<<<<<<<<<<<<< + * return cgraphLib.gp_EdgeArrayStart(self._theGraph) * */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_11gp_GetFirstEdge(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_9gp_EdgeArrayStart(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_10gp_GetFirstEdge, "Graph.gp_GetFirstEdge(self)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_11gp_GetFirstEdge = {"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}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_11gp_GetFirstEdge(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_8gp_EdgeArrayStart, "Graph.gp_EdgeArrayStart(self)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_9gp_EdgeArrayStart = {"gp_EdgeArrayStart", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_9gp_EdgeArrayStart, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_8gp_EdgeArrayStart}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_9gp_EdgeArrayStart(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -3433,7 +3638,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("gp_GetFirstEdge (wrapper)", 0); + __Pyx_RefNannySetupContext("gp_EdgeArrayStart (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -3442,52 +3647,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_GetFirstEdge", 1, 0, 0, __pyx_nargs); return NULL; } + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_EdgeArrayStart", 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_GetFirstEdge", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_10gp_GetFirstEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_EdgeArrayStart", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_8gp_EdgeArrayStart(((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_10gp_GetFirstEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_8gp_EdgeArrayStart(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_GetFirstEdge", 0); + __Pyx_RefNannySetupContext("gp_EdgeArrayStart", 0); - /* "planarity/full/graph.pyx":59 + /* "planarity/full/graph.pyx":68 * - * def gp_GetFirstEdge(self): - * return cgraphLib.gp_GetFirstEdge(self._theGraph) # <<<<<<<<<<<<<< + * def gp_EdgeArrayStart(self): + * return cgraphLib.gp_EdgeArrayStart(self._theGraph) # <<<<<<<<<<<<<< * * def gp_EdgeInUse(self, int e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyLong_From_int(gp_GetFirstEdge(__pyx_v_self->_theGraph)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_int(gp_EdgeArrayStart(__pyx_v_self->_theGraph)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/full/graph.pyx":58 + /* "planarity/full/graph.pyx":67 * ) * - * def gp_GetFirstEdge(self): # <<<<<<<<<<<<<< - * return cgraphLib.gp_GetFirstEdge(self._theGraph) + * def gp_EdgeArrayStart(self): # <<<<<<<<<<<<<< + * return cgraphLib.gp_EdgeArrayStart(self._theGraph) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetFirstEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_EdgeArrayStart", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3495,25 +3700,25 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_10gp_GetFirstEdge(struc return __pyx_r; } -/* "planarity/full/graph.pyx":61 - * return cgraphLib.gp_GetFirstEdge(self._theGraph) +/* "planarity/full/graph.pyx":70 + * return cgraphLib.gp_EdgeArrayStart(self._theGraph) * * def gp_EdgeInUse(self, int e): # <<<<<<<<<<<<<< - * if not self.gp_IsArc(e): + * if not self.gp_IsEdge(e): * raise RuntimeError( */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_13gp_EdgeInUse(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_11gp_EdgeInUse(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_12gp_EdgeInUse, "Graph.gp_EdgeInUse(self, int e)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_13gp_EdgeInUse = {"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}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_13gp_EdgeInUse(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_10gp_EdgeInUse, "Graph.gp_EdgeInUse(self, int e)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_11gp_EdgeInUse = {"gp_EdgeInUse", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_11gp_EdgeInUse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_10gp_EdgeInUse}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_11gp_EdgeInUse(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -3543,32 +3748,32 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { 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, 61, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 70, __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, 61, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 70, __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_EdgeInUse", 0) < (0)) __PYX_ERR(0, 61, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_EdgeInUse", 0) < (0)) __PYX_ERR(0, 70, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_EdgeInUse", 1, 1, 1, i); __PYX_ERR(0, 61, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_EdgeInUse", 1, 1, 1, i); __PYX_ERR(0, 70, __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, 61, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 70, __pyx_L3_error) } - __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 61, __pyx_L3_error) + __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 70, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("gp_EdgeInUse", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 61, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("gp_EdgeInUse", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 70, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3579,7 +3784,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_12gp_EdgeInUse(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_10gp_EdgeInUse(((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) { @@ -3589,7 +3794,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_12gp_EdgeInUse(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_10gp_EdgeInUse(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; @@ -3605,54 +3810,54 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_12gp_EdgeInUse(struct _ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_EdgeInUse", 0); - /* "planarity/full/graph.pyx":62 + /* "planarity/full/graph.pyx":71 * * def gp_EdgeInUse(self, int e): - * if not self.gp_IsArc(e): # <<<<<<<<<<<<<< + * if not self.gp_IsEdge(e): # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_EdgeInUse() failed: invalid edge index '{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, 62, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; - __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_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsEdge, __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, 62, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __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, 62, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 71, __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":63 + /* "planarity/full/graph.pyx":72 * def gp_EdgeInUse(self, int e): - * if not self.gp_IsArc(e): + * if not self.gp_IsEdge(e): * raise RuntimeError( # <<<<<<<<<<<<<< * f"gp_EdgeInUse() failed: invalid edge index '{e}'." * ) */ __pyx_t_3 = NULL; - /* "planarity/full/graph.pyx":64 - * if not self.gp_IsArc(e): + /* "planarity/full/graph.pyx":73 + * if not self.gp_IsEdge(e): * raise RuntimeError( * f"gp_EdgeInUse() failed: invalid edge index '{e}'." # <<<<<<<<<<<<<< * ) * */ - __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_gp_EdgeInUse_failed_invalid_edge; __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, 43 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 2, 127); - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 64, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; @@ -3661,41 +3866,41 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_12gp_EdgeInUse(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, 63, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __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, 63, __pyx_L1_error) + __PYX_ERR(0, 72, __pyx_L1_error) - /* "planarity/full/graph.pyx":62 + /* "planarity/full/graph.pyx":71 * * def gp_EdgeInUse(self, int e): - * if not self.gp_IsArc(e): # <<<<<<<<<<<<<< + * if not self.gp_IsEdge(e): # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_EdgeInUse() failed: invalid edge index '{e}'." */ } - /* "planarity/full/graph.pyx":67 + /* "planarity/full/graph.pyx":76 * ) * * 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) + __pyx_t_1 = __Pyx_PyLong_From_int(gp_EdgeInUse(__pyx_v_self->_theGraph, __pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/full/graph.pyx":61 - * return cgraphLib.gp_GetFirstEdge(self._theGraph) + /* "planarity/full/graph.pyx":70 + * return cgraphLib.gp_EdgeArrayStart(self._theGraph) * * def gp_EdgeInUse(self, int e): # <<<<<<<<<<<<<< - * if not self.gp_IsArc(e): + * if not self.gp_IsEdge(e): * raise RuntimeError( */ @@ -3713,25 +3918,25 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_12gp_EdgeInUse(struct _ return __pyx_r; } -/* "planarity/full/graph.pyx":69 +/* "planarity/full/graph.pyx":78 * 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_13gp_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_12gp_EdgeArraySize, "Graph.gp_EdgeArraySize(self)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_13gp_EdgeArraySize = {"gp_EdgeArraySize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_13gp_EdgeArraySize, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_12gp_EdgeArraySize}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_13gp_EdgeArraySize(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -3744,7 +3949,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,52 +3958,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_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_12gp_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_12gp_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 + /* "planarity/full/graph.pyx":79 * - * 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, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/full/graph.pyx":69 + /* "planarity/full/graph.pyx":78 * 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); @@ -3806,25 +4011,25 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_14gp_EdgeIndexBound(str return __pyx_r; } -/* "planarity/full/graph.pyx":72 - * return cgraphLib.gp_EdgeIndexBound(self._theGraph) +/* "planarity/full/graph.pyx":81 + * 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_15gp_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_14gp_EdgeInUseArraySize, "Graph.gp_EdgeInUseArraySize(self)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_15gp_EdgeInUseArraySize = {"gp_EdgeInUseArraySize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_15gp_EdgeInUseArraySize, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_14gp_EdgeInUseArraySize}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_15gp_EdgeInUseArraySize(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -3837,7 +4042,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 +4051,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_14gp_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_14gp_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 + /* "planarity/full/graph.pyx":82 * - * 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): + * def gp_GetFirstEdge(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, 82, __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) + /* "planarity/full/graph.pyx":81 + * 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); @@ -3899,25 +4104,25 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_16gp_EdgeInUseIndexBoun return __pyx_r; } -/* "planarity/full/graph.pyx":75 - * return cgraphLib.gp_EdgeInUseIndexBound(self._theGraph) +/* "planarity/full/graph.pyx":84 + * return cgraphLib.gp_EdgeInUseArraySize(self._theGraph) * - * def gp_GetFirstArc(self, int v): # <<<<<<<<<<<<<< + * def gp_GetFirstEdge(self, int v): # <<<<<<<<<<<<<< * if not self.gp_IsVertex(v): * raise RuntimeError( */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_19gp_GetFirstArc(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_17gp_GetFirstEdge(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_18gp_GetFirstArc, "Graph.gp_GetFirstArc(self, int v)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_19gp_GetFirstArc = {"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}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_19gp_GetFirstArc(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_16gp_GetFirstEdge, "Graph.gp_GetFirstEdge(self, int v)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_17gp_GetFirstEdge = {"gp_GetFirstEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_17gp_GetFirstEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_16gp_GetFirstEdge}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_17gp_GetFirstEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -3935,7 +4140,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("gp_GetFirstArc (wrapper)", 0); + __Pyx_RefNannySetupContext("gp_GetFirstEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -3947,43 +4152,43 @@ 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, 75, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 84, __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, 75, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 84, __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_GetFirstArc", 0) < (0)) __PYX_ERR(0, 75, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetFirstEdge", 0) < (0)) __PYX_ERR(0, 84, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetFirstArc", 1, 1, 1, i); __PYX_ERR(0, 75, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetFirstEdge", 1, 1, 1, i); __PYX_ERR(0, 84, __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, 75, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 84, __pyx_L3_error) } - __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 75, __pyx_L3_error) + __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 84, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("gp_GetFirstArc", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 75, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("gp_GetFirstEdge", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 84, __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_GetFirstArc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetFirstEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_18gp_GetFirstArc(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_16gp_GetFirstEdge(((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) { @@ -3993,7 +4198,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_18gp_GetFirstArc(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_16gp_GetFirstEdge(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; @@ -4007,18 +4212,18 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_18gp_GetFirstArc(struct int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("gp_GetFirstArc", 0); + __Pyx_RefNannySetupContext("gp_GetFirstEdge", 0); - /* "planarity/full/graph.pyx":76 + /* "planarity/full/graph.pyx":85 * - * def gp_GetFirstArc(self, int v): + * def gp_GetFirstEdge(self, int v): * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< * raise RuntimeError( - * f"gp_GetFirstArc() failed: invalid vertex intex '{v}'." + * f"gp_GetFirstEdge() failed: invalid vertex intex '{v}'." */ __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, 76, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { @@ -4026,37 +4231,37 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_18gp_GetFirstArc(struct __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, 76, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __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, 76, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 85, __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":77 - * def gp_GetFirstArc(self, int v): + /* "planarity/full/graph.pyx":86 + * def gp_GetFirstEdge(self, int v): * if not self.gp_IsVertex(v): * raise RuntimeError( # <<<<<<<<<<<<<< - * f"gp_GetFirstArc() failed: invalid vertex intex '{v}'." + * f"gp_GetFirstEdge() failed: invalid vertex intex '{v}'." * ) */ __pyx_t_3 = NULL; - /* "planarity/full/graph.pyx":78 + /* "planarity/full/graph.pyx":87 * if not self.gp_IsVertex(v): * raise RuntimeError( - * f"gp_GetFirstArc() failed: invalid vertex intex '{v}'." # <<<<<<<<<<<<<< + * f"gp_GetFirstEdge() failed: invalid vertex intex '{v}'." # <<<<<<<<<<<<<< * ) * */ - __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_gp_GetFirstArc_failed_invalid_ve; + __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_gp_GetFirstEdge_failed_invalid_v; __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, 47 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 2, 127); - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 48 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 2, 127); + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; @@ -4065,40 +4270,40 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_18gp_GetFirstArc(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, 77, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __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, 77, __pyx_L1_error) + __PYX_ERR(0, 86, __pyx_L1_error) - /* "planarity/full/graph.pyx":76 + /* "planarity/full/graph.pyx":85 * - * def gp_GetFirstArc(self, int v): + * def gp_GetFirstEdge(self, int v): * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< * raise RuntimeError( - * f"gp_GetFirstArc() failed: invalid vertex intex '{v}'." + * f"gp_GetFirstEdge() failed: invalid vertex intex '{v}'." */ } - /* "planarity/full/graph.pyx":81 + /* "planarity/full/graph.pyx":90 * ) * - * return cgraphLib.gp_GetFirstArc(self._theGraph, v) # <<<<<<<<<<<<<< + * return cgraphLib.gp_GetFirstEdge(self._theGraph, v) # <<<<<<<<<<<<<< * - * def gp_GetNextArc(self, int e): + * def gp_GetNextEdge(self, int e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyLong_From_int(gp_GetFirstArc(__pyx_v_self->_theGraph, __pyx_v_v)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_int(gp_GetFirstEdge(__pyx_v_self->_theGraph, __pyx_v_v)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/full/graph.pyx":75 - * return cgraphLib.gp_EdgeInUseIndexBound(self._theGraph) + /* "planarity/full/graph.pyx":84 + * return cgraphLib.gp_EdgeInUseArraySize(self._theGraph) * - * def gp_GetFirstArc(self, int v): # <<<<<<<<<<<<<< + * def gp_GetFirstEdge(self, int v): # <<<<<<<<<<<<<< * if not self.gp_IsVertex(v): * raise RuntimeError( */ @@ -4109,7 +4314,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_18gp_GetFirstArc(struct __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetFirstArc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetFirstEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4117,25 +4322,25 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_18gp_GetFirstArc(struct return __pyx_r; } -/* "planarity/full/graph.pyx":83 - * return cgraphLib.gp_GetFirstArc(self._theGraph, v) +/* "planarity/full/graph.pyx":92 + * return cgraphLib.gp_GetFirstEdge(self._theGraph, v) * - * def gp_GetNextArc(self, int e): # <<<<<<<<<<<<<< - * if not self.gp_IsArc(e): + * def gp_GetNextEdge(self, int e): # <<<<<<<<<<<<<< + * if not self.gp_IsEdge(e): * raise RuntimeError( */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_21gp_GetNextArc(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_19gp_GetNextEdge(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_20gp_GetNextArc, "Graph.gp_GetNextArc(self, int e)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_21gp_GetNextArc = {"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}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_21gp_GetNextArc(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_18gp_GetNextEdge, "Graph.gp_GetNextEdge(self, int e)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_19gp_GetNextEdge = {"gp_GetNextEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_19gp_GetNextEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_18gp_GetNextEdge}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_19gp_GetNextEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -4153,7 +4358,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("gp_GetNextArc (wrapper)", 0); + __Pyx_RefNannySetupContext("gp_GetNextEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -4165,43 +4370,43 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { 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, 83, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 92, __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, 83, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 92, __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_GetNextArc", 0) < (0)) __PYX_ERR(0, 83, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetNextEdge", 0) < (0)) __PYX_ERR(0, 92, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetNextArc", 1, 1, 1, i); __PYX_ERR(0, 83, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetNextEdge", 1, 1, 1, i); __PYX_ERR(0, 92, __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, 83, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 92, __pyx_L3_error) } - __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L3_error) + __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 92, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("gp_GetNextArc", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 83, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("gp_GetNextEdge", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 92, __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_GetNextArc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetNextEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_20gp_GetNextArc(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_18gp_GetNextEdge(((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) { @@ -4211,7 +4416,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_20gp_GetNextArc(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_18gp_GetNextEdge(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; @@ -4225,56 +4430,56 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_20gp_GetNextArc(struct int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("gp_GetNextArc", 0); + __Pyx_RefNannySetupContext("gp_GetNextEdge", 0); - /* "planarity/full/graph.pyx":84 + /* "planarity/full/graph.pyx":93 * - * def gp_GetNextArc(self, int e): - * if not self.gp_IsArc(e): # <<<<<<<<<<<<<< + * def gp_GetNextEdge(self, int e): + * if not self.gp_IsEdge(e): # <<<<<<<<<<<<<< * raise RuntimeError( - * f"gp_GetNextArc() failed: invalid edge index '{e}'." + * f"gp_GetNextEdge() failed: invalid edge index '{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, 84, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; - __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_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsEdge, __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, 84, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __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, 84, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 93, __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":85 - * def gp_GetNextArc(self, int e): - * if not self.gp_IsArc(e): + /* "planarity/full/graph.pyx":94 + * def gp_GetNextEdge(self, int e): + * if not self.gp_IsEdge(e): * raise RuntimeError( # <<<<<<<<<<<<<< - * f"gp_GetNextArc() failed: invalid edge index '{e}'." + * f"gp_GetNextEdge() failed: invalid edge index '{e}'." * ) */ __pyx_t_3 = NULL; - /* "planarity/full/graph.pyx":86 - * if not self.gp_IsArc(e): + /* "planarity/full/graph.pyx":95 + * if not self.gp_IsEdge(e): * raise RuntimeError( - * f"gp_GetNextArc() failed: invalid edge index '{e}'." # <<<<<<<<<<<<<< + * f"gp_GetNextEdge() failed: invalid edge index '{e}'." # <<<<<<<<<<<<<< * ) * */ - __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_gp_GetNextArc_failed_invalid_edg; + __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_gp_GetNextEdge_failed_invalid_ed; __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, 44 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 2, 127); - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 45 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 2, 127); + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; @@ -4283,41 +4488,41 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_20gp_GetNextArc(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, 85, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __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, 85, __pyx_L1_error) + __PYX_ERR(0, 94, __pyx_L1_error) - /* "planarity/full/graph.pyx":84 + /* "planarity/full/graph.pyx":93 * - * def gp_GetNextArc(self, int e): - * if not self.gp_IsArc(e): # <<<<<<<<<<<<<< + * def gp_GetNextEdge(self, int e): + * if not self.gp_IsEdge(e): # <<<<<<<<<<<<<< * raise RuntimeError( - * f"gp_GetNextArc() failed: invalid edge index '{e}'." + * f"gp_GetNextEdge() failed: invalid edge index '{e}'." */ } - /* "planarity/full/graph.pyx":89 + /* "planarity/full/graph.pyx":98 * ) * - * return cgraphLib.gp_GetNextArc(self._theGraph, e) # <<<<<<<<<<<<<< + * return cgraphLib.gp_GetNextEdge(self._theGraph, e) # <<<<<<<<<<<<<< * * def gp_GetNeighbor(self, int e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyLong_From_int(gp_GetNextArc(__pyx_v_self->_theGraph, __pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_int(gp_GetNextEdge(__pyx_v_self->_theGraph, __pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/full/graph.pyx":83 - * return cgraphLib.gp_GetFirstArc(self._theGraph, v) + /* "planarity/full/graph.pyx":92 + * return cgraphLib.gp_GetFirstEdge(self._theGraph, v) * - * def gp_GetNextArc(self, int e): # <<<<<<<<<<<<<< - * if not self.gp_IsArc(e): + * def gp_GetNextEdge(self, int e): # <<<<<<<<<<<<<< + * if not self.gp_IsEdge(e): * raise RuntimeError( */ @@ -4327,7 +4532,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_20gp_GetNextArc(struct __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetNextArc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetNextEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4335,25 +4540,25 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_20gp_GetNextArc(struct return __pyx_r; } -/* "planarity/full/graph.pyx":91 - * return cgraphLib.gp_GetNextArc(self._theGraph, e) +/* "planarity/full/graph.pyx":100 + * return cgraphLib.gp_GetNextEdge(self._theGraph, e) * * def gp_GetNeighbor(self, int e): # <<<<<<<<<<<<<< - * if not self.gp_IsArc(e): + * if not self.gp_IsEdge(e): * raise RuntimeError( */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_23gp_GetNeighbor(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_21gp_GetNeighbor(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_22gp_GetNeighbor, "Graph.gp_GetNeighbor(self, int e)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_23gp_GetNeighbor = {"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}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_23gp_GetNeighbor(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_20gp_GetNeighbor, "Graph.gp_GetNeighbor(self, int e)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_21gp_GetNeighbor = {"gp_GetNeighbor", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_21gp_GetNeighbor, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_20gp_GetNeighbor}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_21gp_GetNeighbor(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -4383,32 +4588,32 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { 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, 91, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 100, __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, 91, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 100, __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_GetNeighbor", 0) < (0)) __PYX_ERR(0, 91, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetNeighbor", 0) < (0)) __PYX_ERR(0, 100, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetNeighbor", 1, 1, 1, i); __PYX_ERR(0, 91, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetNeighbor", 1, 1, 1, i); __PYX_ERR(0, 100, __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, 91, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 100, __pyx_L3_error) } - __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L3_error) + __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("gp_GetNeighbor", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 91, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("gp_GetNeighbor", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 100, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4419,7 +4624,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_22gp_GetNeighbor(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_20gp_GetNeighbor(((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) { @@ -4429,7 +4634,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_22gp_GetNeighbor(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_20gp_GetNeighbor(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; @@ -4445,54 +4650,54 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_22gp_GetNeighbor(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetNeighbor", 0); - /* "planarity/full/graph.pyx":92 + /* "planarity/full/graph.pyx":101 * * def gp_GetNeighbor(self, int e): - * if not self.gp_IsArc(e): # <<<<<<<<<<<<<< + * if not self.gp_IsEdge(e): # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_GetNeighbor() failed: invalid edge index '{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, 92, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; - __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_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsEdge, __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, 92, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __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, 92, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 101, __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":93 + /* "planarity/full/graph.pyx":102 * def gp_GetNeighbor(self, int e): - * if not self.gp_IsArc(e): + * if not self.gp_IsEdge(e): * raise RuntimeError( # <<<<<<<<<<<<<< * f"gp_GetNeighbor() failed: invalid edge index '{e}'." * ) */ __pyx_t_3 = NULL; - /* "planarity/full/graph.pyx":94 - * if not self.gp_IsArc(e): + /* "planarity/full/graph.pyx":103 + * if not self.gp_IsEdge(e): * raise RuntimeError( * f"gp_GetNeighbor() failed: invalid edge index '{e}'." # <<<<<<<<<<<<<< * ) * */ - __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_gp_GetNeighbor_failed_invalid_ed; __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, 45 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 2, 127); - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 94, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; @@ -4501,23 +4706,23 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_22gp_GetNeighbor(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, 93, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __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, 93, __pyx_L1_error) + __PYX_ERR(0, 102, __pyx_L1_error) - /* "planarity/full/graph.pyx":92 + /* "planarity/full/graph.pyx":101 * * def gp_GetNeighbor(self, int e): - * if not self.gp_IsArc(e): # <<<<<<<<<<<<<< + * if not self.gp_IsEdge(e): # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_GetNeighbor() failed: invalid edge index '{e}'." */ } - /* "planarity/full/graph.pyx":97 + /* "planarity/full/graph.pyx":106 * ) * * return cgraphLib.gp_GetNeighbor(self._theGraph, e) # <<<<<<<<<<<<<< @@ -4525,17 +4730,17 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_22gp_GetNeighbor(struct * def gp_IsVertex(self, int v): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyLong_From_int(gp_GetNeighbor(__pyx_v_self->_theGraph, __pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_int(gp_GetNeighbor(__pyx_v_self->_theGraph, __pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/full/graph.pyx":91 - * return cgraphLib.gp_GetNextArc(self._theGraph, e) + /* "planarity/full/graph.pyx":100 + * return cgraphLib.gp_GetNextEdge(self._theGraph, e) * * def gp_GetNeighbor(self, int e): # <<<<<<<<<<<<<< - * if not self.gp_IsArc(e): + * if not self.gp_IsEdge(e): * raise RuntimeError( */ @@ -4553,7 +4758,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_22gp_GetNeighbor(struct return __pyx_r; } -/* "planarity/full/graph.pyx":99 +/* "planarity/full/graph.pyx":108 * return cgraphLib.gp_GetNeighbor(self._theGraph, e) * * def gp_IsVertex(self, int v): # <<<<<<<<<<<<<< @@ -4562,16 +4767,16 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_22gp_GetNeighbor(struct */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_25gp_IsVertex(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_23gp_IsVertex(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_24gp_IsVertex, "Graph.gp_IsVertex(self, int v)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_25gp_IsVertex = {"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}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_25gp_IsVertex(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_22gp_IsVertex, "Graph.gp_IsVertex(self, int v)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_23gp_IsVertex = {"gp_IsVertex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_23gp_IsVertex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_22gp_IsVertex}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_23gp_IsVertex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -4601,32 +4806,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, 99, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 108, __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, 99, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 108, __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_IsVertex", 0) < (0)) __PYX_ERR(0, 99, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_IsVertex", 0) < (0)) __PYX_ERR(0, 108, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_IsVertex", 1, 1, 1, i); __PYX_ERR(0, 99, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_IsVertex", 1, 1, 1, i); __PYX_ERR(0, 108, __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, 99, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 108, __pyx_L3_error) } - __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 99, __pyx_L3_error) + __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("gp_IsVertex", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 99, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("gp_IsVertex", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 108, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4637,7 +4842,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_24gp_IsVertex(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_22gp_IsVertex(((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) { @@ -4647,7 +4852,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_24gp_IsVertex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_22gp_IsVertex(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; @@ -4662,7 +4867,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_24gp_IsVertex(struct __ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_IsVertex", 0); - /* "planarity/full/graph.pyx":100 + /* "planarity/full/graph.pyx":109 * * def gp_IsVertex(self, int v): * return ( # <<<<<<<<<<<<<< @@ -4671,14 +4876,14 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_24gp_IsVertex(struct __ */ __Pyx_XDECREF(__pyx_r); - /* "planarity/full/graph.pyx":101 + /* "planarity/full/graph.pyx":110 * def gp_IsVertex(self, int v): * 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_t_2 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_4); @@ -4687,13 +4892,13 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_24gp_IsVertex(struct __ PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_GetFirstVertex, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } - __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 101, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 110, __pyx_L1_error) if (__pyx_t_6) { __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { @@ -4703,14 +4908,14 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_24gp_IsVertex(struct __ goto __pyx_L3_bool_binop_done; } - /* "planarity/full/graph.pyx":102 + /* "planarity/full/graph.pyx":111 * 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) + __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); @@ -4719,13 +4924,13 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_24gp_IsVertex(struct __ PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_GetLastVertex, __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, 102, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } - __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 102, __pyx_L1_error) + __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 102, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 111, __pyx_L1_error) if (__pyx_t_6) { __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { @@ -4735,15 +4940,15 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_24gp_IsVertex(struct __ goto __pyx_L3_bool_binop_done; } - /* "planarity/full/graph.pyx":103 + /* "planarity/full/graph.pyx":112 * (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_2 = __Pyx_PyLong_From_int(__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error) + __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, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __pyx_t_2; __pyx_t_2 = 0; @@ -4752,7 +4957,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_24gp_IsVertex(struct __ __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/full/graph.pyx":99 + /* "planarity/full/graph.pyx":108 * return cgraphLib.gp_GetNeighbor(self._theGraph, e) * * def gp_IsVertex(self, int v): # <<<<<<<<<<<<<< @@ -4774,7 +4979,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_24gp_IsVertex(struct __ return __pyx_r; } -/* "planarity/full/graph.pyx":106 +/* "planarity/full/graph.pyx":115 * ) * * def gp_GetFirstVertex(self): # <<<<<<<<<<<<<< @@ -4783,16 +4988,16 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_24gp_IsVertex(struct __ */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_27gp_GetFirstVertex(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_25gp_GetFirstVertex(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_26gp_GetFirstVertex, "Graph.gp_GetFirstVertex(self)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_27gp_GetFirstVertex = {"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}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_27gp_GetFirstVertex(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_24gp_GetFirstVertex, "Graph.gp_GetFirstVertex(self)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_25gp_GetFirstVertex = {"gp_GetFirstVertex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_25gp_GetFirstVertex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_24gp_GetFirstVertex}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_25gp_GetFirstVertex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -4818,14 +5023,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("gp_GetFirstVertex", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_26gp_GetFirstVertex(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_24gp_GetFirstVertex(((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_26gp_GetFirstVertex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_24gp_GetFirstVertex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4834,7 +5039,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_26gp_GetFirstVertex(str int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetFirstVertex", 0); - /* "planarity/full/graph.pyx":107 + /* "planarity/full/graph.pyx":116 * * def gp_GetFirstVertex(self): * return cgraphLib.gp_GetFirstVertex(self._theGraph) # <<<<<<<<<<<<<< @@ -4842,13 +5047,13 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_26gp_GetFirstVertex(str * def gp_GetLastVertex(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyLong_From_int(gp_GetFirstVertex(__pyx_v_self->_theGraph)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_int(gp_GetFirstVertex(__pyx_v_self->_theGraph)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/full/graph.pyx":106 + /* "planarity/full/graph.pyx":115 * ) * * def gp_GetFirstVertex(self): # <<<<<<<<<<<<<< @@ -4867,7 +5072,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_26gp_GetFirstVertex(str return __pyx_r; } -/* "planarity/full/graph.pyx":109 +/* "planarity/full/graph.pyx":118 * return cgraphLib.gp_GetFirstVertex(self._theGraph) * * def gp_GetLastVertex(self): # <<<<<<<<<<<<<< @@ -4876,16 +5081,16 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_26gp_GetFirstVertex(str */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_29gp_GetLastVertex(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_27gp_GetLastVertex(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_28gp_GetLastVertex, "Graph.gp_GetLastVertex(self)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_29gp_GetLastVertex = {"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}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_29gp_GetLastVertex(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_26gp_GetLastVertex, "Graph.gp_GetLastVertex(self)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_27gp_GetLastVertex = {"gp_GetLastVertex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_27gp_GetLastVertex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_26gp_GetLastVertex}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_27gp_GetLastVertex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -4911,14 +5116,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("gp_GetLastVertex", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_28gp_GetLastVertex(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_26gp_GetLastVertex(((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_28gp_GetLastVertex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_26gp_GetLastVertex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4927,21 +5132,21 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_28gp_GetLastVertex(stru int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetLastVertex", 0); - /* "planarity/full/graph.pyx":110 + /* "planarity/full/graph.pyx":119 * * 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) + __pyx_t_1 = __Pyx_PyLong_From_int(gp_GetLastVertex(__pyx_v_self->_theGraph)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/full/graph.pyx":109 + /* "planarity/full/graph.pyx":118 * return cgraphLib.gp_GetFirstVertex(self._theGraph) * * def gp_GetLastVertex(self): # <<<<<<<<<<<<<< @@ -4960,25 +5165,25 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_28gp_GetLastVertex(stru return __pyx_r; } -/* "planarity/full/graph.pyx":112 +/* "planarity/full/graph.pyx":121 * 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_29gp_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_28gp_VertexInRangeAscending, "Graph.gp_VertexInRangeAscending(self, int v)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_29gp_VertexInRangeAscending = {"gp_VertexInRangeAscending", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_29gp_VertexInRangeAscending, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_28gp_VertexInRangeAscending}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_29gp_VertexInRangeAscending(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -4996,7 +5201,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); @@ -5008,43 +5213,43 @@ 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, 112, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 121, __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, 112, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 121, __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_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, 121, __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, 121, __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, 112, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 121, __pyx_L3_error) } - __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 112, __pyx_L3_error) + __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L3_error) } 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, 121, __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_28gp_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 +5259,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_28gp_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,25 +5272,25 @@ 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 + /* "planarity/full/graph.pyx":122 * - * 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): + /* "planarity/full/graph.pyx":123 + * 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) + __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_4); @@ -5094,13 +5299,13 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_30gp_VertexInRange(stru PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_GetFirstVertex, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 114, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } - __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 123, __pyx_L1_error) if (__pyx_t_6) { __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { @@ -5110,15 +5315,15 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_30gp_VertexInRange(stru goto __pyx_L3_bool_binop_done; } - /* "planarity/full/graph.pyx":115 + /* "planarity/full/graph.pyx":124 * 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_4 = __Pyx_PyLong_From_int(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 115, __pyx_L1_error) + __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, 124, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = __pyx_t_4; __pyx_t_4 = 0; @@ -5127,10 +5332,10 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_30gp_VertexInRange(stru __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/full/graph.pyx":112 + /* "planarity/full/graph.pyx":121 * 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 +5346,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); @@ -5149,25 +5354,25 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_30gp_VertexInRange(stru return __pyx_r; } -/* "planarity/full/graph.pyx":118 +/* "planarity/full/graph.pyx":127 * ) * - * 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_31gp_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_30gp_GetN, "Graph.gp_GetN(self) -> int\n\nReturns the number of vertices in the graph."); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_31gp_GetN = {"gp_GetN", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_31gp_GetN, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_30gp_GetN}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_31gp_GetN(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -5180,7 +5385,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 +5394,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_30gp_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_30gp_GetN(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -5210,24 +5415,24 @@ 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 + /* "planarity/full/graph.pyx":131 * 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)) { - /* "planarity/full/graph.pyx":123 + /* "planarity/full/graph.pyx":132 * """ * 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; @@ -5235,41 +5440,41 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_32gp_getN(struct __pyx_ PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Graph_is_not_initialized}; __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, 123, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __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, 123, __pyx_L1_error) + __PYX_ERR(0, 132, __pyx_L1_error) - /* "planarity/full/graph.pyx":122 + /* "planarity/full/graph.pyx":131 * Returns the number of vertices in the graph. * """ * 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":134 * 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, 134, __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, 134, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; - /* "planarity/full/graph.pyx":118 + /* "planarity/full/graph.pyx":127 * ) * - * def gp_getN(self)-> int: # <<<<<<<<<<<<<< + * def gp_GetN(self)-> int: # <<<<<<<<<<<<<< * """ * Returns the number of vertices in the graph. */ @@ -5278,7 +5483,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 +5491,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":136 + * return cgraphLib.gp_GetN(self._theGraph) * * def gp_InitGraph(self, int n): # <<<<<<<<<<<<<< * if cgraphLib.gp_InitGraph(self._theGraph, n) != cappconst.OK: @@ -5295,16 +5500,16 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_32gp_getN(struct __pyx_ */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_35gp_InitGraph(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_33gp_InitGraph(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_34gp_InitGraph, "Graph.gp_InitGraph(self, int n)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_35gp_InitGraph = {"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}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_35gp_InitGraph(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_32gp_InitGraph, "Graph.gp_InitGraph(self, int n)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_33gp_InitGraph = {"gp_InitGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_33gp_InitGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_32gp_InitGraph}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_33gp_InitGraph(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -5334,32 +5539,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, 136, __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, 136, __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, 136, __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, 136, __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, 136, __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, 136, __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, 136, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -5370,7 +5575,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_34gp_InitGraph(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_n); + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_32gp_InitGraph(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_n); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { @@ -5380,7 +5585,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_34gp_InitGraph(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_n) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_32gp_InitGraph(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_n) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -5392,7 +5597,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":137 * * def gp_InitGraph(self, int n): * if cgraphLib.gp_InitGraph(self._theGraph, n) != cappconst.OK: # <<<<<<<<<<<<<< @@ -5402,7 +5607,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":138 * def gp_InitGraph(self, int n): * if cgraphLib.gp_InitGraph(self._theGraph, n) != cappconst.OK: * raise RuntimeError(f"gp_InitGraph() failed.") # <<<<<<<<<<<<<< @@ -5415,14 +5620,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, 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, 128, __pyx_L1_error) + __PYX_ERR(0, 138, __pyx_L1_error) - /* "planarity/full/graph.pyx":127 + /* "planarity/full/graph.pyx":137 * * def gp_InitGraph(self, int n): * if cgraphLib.gp_InitGraph(self._theGraph, n) != cappconst.OK: # <<<<<<<<<<<<<< @@ -5431,8 +5636,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":136 + * return cgraphLib.gp_GetN(self._theGraph) * * def gp_InitGraph(self, int n): # <<<<<<<<<<<<<< * if cgraphLib.gp_InitGraph(self._theGraph, n) != cappconst.OK: @@ -5453,7 +5658,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_34gp_InitGraph(struct _ return __pyx_r; } -/* "planarity/full/graph.pyx":130 +/* "planarity/full/graph.pyx":140 * raise RuntimeError(f"gp_InitGraph() failed.") * * def gp_ReinitializeGraph(self): # <<<<<<<<<<<<<< @@ -5462,16 +5667,16 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_34gp_InitGraph(struct _ */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_37gp_ReinitializeGraph(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_35gp_ReinitializeGraph(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_36gp_ReinitializeGraph, "Graph.gp_ReinitializeGraph(self)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_37gp_ReinitializeGraph = {"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}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_37gp_ReinitializeGraph(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_34gp_ReinitializeGraph, "Graph.gp_ReinitializeGraph(self)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_35gp_ReinitializeGraph = {"gp_ReinitializeGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_35gp_ReinitializeGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_34gp_ReinitializeGraph}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_35gp_ReinitializeGraph(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -5497,19 +5702,19 @@ 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("gp_ReinitializeGraph", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_36gp_ReinitializeGraph(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_34gp_ReinitializeGraph(((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_36gp_ReinitializeGraph(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_34gp_ReinitializeGraph(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_ReinitializeGraph", 0); - /* "planarity/full/graph.pyx":131 + /* "planarity/full/graph.pyx":141 * * def gp_ReinitializeGraph(self): * cgraphLib.gp_ReinitializeGraph(self._theGraph) # <<<<<<<<<<<<<< @@ -5518,7 +5723,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":140 * raise RuntimeError(f"gp_InitGraph() failed.") * * def gp_ReinitializeGraph(self): # <<<<<<<<<<<<<< @@ -5533,7 +5738,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_36gp_ReinitializeGraph( return __pyx_r; } -/* "planarity/full/graph.pyx":133 +/* "planarity/full/graph.pyx":143 * cgraphLib.gp_ReinitializeGraph(self._theGraph) * * def gp_CopyGraph(self, Graph src_graph): # <<<<<<<<<<<<<< @@ -5542,16 +5747,16 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_36gp_ReinitializeGraph( */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_39gp_CopyGraph(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_37gp_CopyGraph(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_38gp_CopyGraph, "Graph.gp_CopyGraph(self, Graph src_graph)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_39gp_CopyGraph = {"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}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_39gp_CopyGraph(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_36gp_CopyGraph, "Graph.gp_CopyGraph(self, Graph src_graph)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_37gp_CopyGraph = {"gp_CopyGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_37gp_CopyGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_36gp_CopyGraph}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_37gp_CopyGraph(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -5581,32 +5786,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, 143, __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, 143, __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, 143, __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, 143, __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, 143, __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, 143, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -5617,8 +5822,8 @@ 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) - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_38gp_CopyGraph(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_src_graph); + 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, 143, __pyx_L1_error) + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_36gp_CopyGraph(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_src_graph); /* function exit code */ goto __pyx_L0; @@ -5637,93 +5842,265 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -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) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_36gp_CopyGraph(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_src_graph) { + PyObject *__pyx_v_src_graph_uninit_error = NULL; 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_t_5; + PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_t_12; + char const *__pyx_t_13; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + PyObject *__pyx_t_16 = NULL; + PyObject *__pyx_t_17 = NULL; + PyObject *__pyx_t_18 = NULL; + PyObject *__pyx_t_19 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_CopyGraph", 0); - /* "planarity/full/graph.pyx":136 + /* "planarity/full/graph.pyx":146 * # 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: # <<<<<<<<<<<<<< - * raise ValueError( - * "Source graph either has not been allocated or not been " + * if self._theGraph == NULL: # <<<<<<<<<<<<<< + * raise RuntimeError( + * "Invalid destination graph: wrapped graphP is NULL." */ - __pyx_t_3 = ((PyObject *)__pyx_v_src_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, 136, __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_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_src_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, 136, __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_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = __pyx_t_5; - __pyx_L4_bool_binop_done:; + __pyx_t_1 = (__pyx_v_self->_theGraph == NULL); if (unlikely(__pyx_t_1)) { - /* "planarity/full/graph.pyx":137 + /* "planarity/full/graph.pyx":147 * # the Graph wrapper that is passed in as the srcGraph - * 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._theGraph == NULL: + * raise RuntimeError( # <<<<<<<<<<<<<< + * "Invalid destination graph: wrapped graphP is NULL." + * ) */ __pyx_t_3 = NULL; __pyx_t_4 = 1; { - 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)); + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Invalid_destination_graph_wrappe}; + __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, 137, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 147, __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, 147, __pyx_L1_error) - /* "planarity/full/graph.pyx":136 + /* "planarity/full/graph.pyx":146 * # 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 self._theGraph == NULL: # <<<<<<<<<<<<<< + * raise RuntimeError( + * "Invalid destination graph: wrapped graphP is NULL." +*/ + } + + /* "planarity/full/graph.pyx":151 + * ) + * + * try: # <<<<<<<<<<<<<< + * if src_graph.gp_GetN() == 0: + * raise ValueError("Source graph has not been initialized.") +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + /*try:*/ { + + /* "planarity/full/graph.pyx":152 + * + * try: + * if src_graph.gp_GetN() == 0: # <<<<<<<<<<<<<< + * raise ValueError("Source graph has not been initialized.") + * except RuntimeError as src_graph_uninit_error: +*/ + __pyx_t_3 = ((PyObject *)__pyx_v_src_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, 152, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_1 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 152, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__pyx_t_1)) { + + /* "planarity/full/graph.pyx":153 + * try: + * if src_graph.gp_GetN() == 0: + * raise ValueError("Source graph has not been initialized.") # <<<<<<<<<<<<<< + * except RuntimeError as src_graph_uninit_error: + * raise ValueError( +*/ + __pyx_t_3 = NULL; + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Source_graph_has_not_been_initia}; + __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, 153, __pyx_L4_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, 153, __pyx_L4_error) + + /* "planarity/full/graph.pyx":152 + * + * try: + * if src_graph.gp_GetN() == 0: # <<<<<<<<<<<<<< + * raise ValueError("Source graph has not been initialized.") + * except RuntimeError as src_graph_uninit_error: +*/ + } + + /* "planarity/full/graph.pyx":151 + * ) + * + * try: # <<<<<<<<<<<<<< + * if src_graph.gp_GetN() == 0: + * raise ValueError("Source graph has not been initialized.") +*/ + } + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "planarity/full/graph.pyx":154 + * if src_graph.gp_GetN() == 0: + * raise ValueError("Source graph has not been initialized.") + * except RuntimeError as src_graph_uninit_error: # <<<<<<<<<<<<<< + * raise ValueError( + * "Invalid source graph: wrapped graphP is NULL." +*/ + __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_RuntimeError)))); + if (__pyx_t_8) { + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_CopyGraph", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_9) < 0) __PYX_ERR(0, 154, __pyx_L6_except_error) + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_INCREF(__pyx_t_3); + __pyx_v_src_graph_uninit_error = __pyx_t_3; + /*try:*/ { + + /* "planarity/full/graph.pyx":155 + * raise ValueError("Source graph has not been initialized.") + * except RuntimeError as src_graph_uninit_error: + * raise ValueError( # <<<<<<<<<<<<<< + * "Invalid source graph: wrapped graphP is NULL." + * ) from src_graph_uninit_error +*/ + __pyx_t_11 = NULL; + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_mstate_global->__pyx_kp_u_Invalid_source_graph_wrapped_gra}; + __pyx_t_10 = __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_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 155, __pyx_L16_error) + __Pyx_GOTREF(__pyx_t_10); + } + + /* "planarity/full/graph.pyx":157 * raise ValueError( - * "Source graph either has not been allocated or not been " + * "Invalid source graph: wrapped graphP is NULL." + * ) from src_graph_uninit_error # <<<<<<<<<<<<<< + * + * if self.gp_GetN() != src_graph.gp_GetN(): */ + __Pyx_Raise(__pyx_t_10, 0, 0, __pyx_v_src_graph_uninit_error); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __PYX_ERR(0, 155, __pyx_L16_error) + } + + /* "planarity/full/graph.pyx":154 + * if src_graph.gp_GetN() == 0: + * raise ValueError("Source graph has not been initialized.") + * except RuntimeError as src_graph_uninit_error: # <<<<<<<<<<<<<< + * raise ValueError( + * "Invalid source graph: wrapped graphP is NULL." +*/ + /*finally:*/ { + __pyx_L16_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19); + if ( unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16); + __Pyx_XGOTREF(__pyx_t_14); + __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_t_8 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_13 = __pyx_filename; + { + __Pyx_DECREF(__pyx_v_src_graph_uninit_error); __pyx_v_src_graph_uninit_error = 0; + } + __Pyx_XGIVEREF(__pyx_t_17); + __Pyx_XGIVEREF(__pyx_t_18); + __Pyx_XGIVEREF(__pyx_t_19); + __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19); + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_XGIVEREF(__pyx_t_15); + __Pyx_XGIVEREF(__pyx_t_16); + __Pyx_ErrRestore(__pyx_t_14, __pyx_t_15, __pyx_t_16); + __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; + __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_13; + goto __pyx_L6_except_error; + } + } + } + goto __pyx_L6_except_error; + + /* "planarity/full/graph.pyx":151 + * ) + * + * try: # <<<<<<<<<<<<<< + * if src_graph.gp_GetN() == 0: + * raise ValueError("Source graph has not been initialized.") +*/ + __pyx_L6_except_error:; + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); + goto __pyx_L1_error; + __pyx_L9_try_end:; } - /* "planarity/full/graph.pyx":140 - * "Source graph either has not been allocated or not been " - * "initialized.") - * if self.gp_getN() != src_graph.gp_getN(): # <<<<<<<<<<<<<< + /* "planarity/full/graph.pyx":159 + * ) from src_graph_uninit_error + * + * if self.gp_GetN() != src_graph.gp_GetN(): # <<<<<<<<<<<<<< * raise ValueError( * "Source and destination graphs must have the same order " */ @@ -5732,31 +6109,31 @@ 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_9 = __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) - __Pyx_GOTREF(__pyx_t_2); + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); } - __pyx_t_6 = ((PyObject *)__pyx_v_src_graph); - __Pyx_INCREF(__pyx_t_6); + __pyx_t_2 = ((PyObject *)__pyx_v_src_graph); + __Pyx_INCREF(__pyx_t_2); __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_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 140, __pyx_L1_error) + PyObject *__pyx_callargs[2] = {__pyx_t_2, 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_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 159, __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_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_RichCompare(__pyx_t_9, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 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_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_1)) { - /* "planarity/full/graph.pyx":141 - * "initialized.") - * if self.gp_getN() != src_graph.gp_getN(): + /* "planarity/full/graph.pyx":160 + * + * if self.gp_GetN() != src_graph.gp_GetN(): * raise ValueError( # <<<<<<<<<<<<<< * "Source and destination graphs must have the same order " * "to copy graphP struct.") @@ -5765,27 +6142,27 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_38gp_CopyGraph(struct _ __pyx_t_4 = 1; { 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_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_6)) __PYX_ERR(0, 141, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); } - __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_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 160, __pyx_L1_error) - /* "planarity/full/graph.pyx":140 - * "Source graph either has not been allocated or not been " - * "initialized.") - * if self.gp_getN() != src_graph.gp_getN(): # <<<<<<<<<<<<<< + /* "planarity/full/graph.pyx":159 + * ) from src_graph_uninit_error + * + * if self.gp_GetN() != src_graph.gp_GetN(): # <<<<<<<<<<<<<< * raise ValueError( * "Source and destination graphs must have the same order " */ } - /* "planarity/full/graph.pyx":144 - * "Source and destination graphs must have the same order " + /* "planarity/full/graph.pyx":164 * "to copy graphP struct.") + * * if cgraphLib.gp_CopyGraph(self._theGraph, src_graph._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< * raise RuntimeError(f"gp_CopyGraph() failed.") * @@ -5793,8 +6170,8 @@ 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 - * "to copy graphP struct.") + /* "planarity/full/graph.pyx":165 + * * if cgraphLib.gp_CopyGraph(self._theGraph, src_graph._theGraph) != cappconst.OK: * raise RuntimeError(f"gp_CopyGraph() failed.") # <<<<<<<<<<<<<< * @@ -5804,25 +6181,25 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_38gp_CopyGraph(struct _ __pyx_t_4 = 1; { 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_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_6)) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); } - __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_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 165, __pyx_L1_error) - /* "planarity/full/graph.pyx":144 - * "Source and destination graphs must have the same order " + /* "planarity/full/graph.pyx":164 * "to copy graphP struct.") + * * if cgraphLib.gp_CopyGraph(self._theGraph, src_graph._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< * raise RuntimeError(f"gp_CopyGraph() failed.") * */ } - /* "planarity/full/graph.pyx":133 + /* "planarity/full/graph.pyx":143 * cgraphLib.gp_ReinitializeGraph(self._theGraph) * * def gp_CopyGraph(self, Graph src_graph): # <<<<<<<<<<<<<< @@ -5836,16 +6213,19 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_38gp_CopyGraph(struct _ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_CopyGraph", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_src_graph_uninit_error); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "planarity/full/graph.pyx":147 +/* "planarity/full/graph.pyx":167 * raise RuntimeError(f"gp_CopyGraph() failed.") * * def gp_DupGraph(self) -> Graph: # <<<<<<<<<<<<<< @@ -5854,16 +6234,16 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_38gp_CopyGraph(struct _ */ /* Python wrapper */ -static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pw_9planarity_4full_5graph_5Graph_41gp_DupGraph(PyObject *__pyx_v_self, +static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pw_9planarity_4full_5graph_5Graph_39gp_DupGraph(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_40gp_DupGraph, "Graph.gp_DupGraph(self) -> Graph"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_41gp_DupGraph = {"gp_DupGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_41gp_DupGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_40gp_DupGraph}; -static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pw_9planarity_4full_5graph_5Graph_41gp_DupGraph(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_38gp_DupGraph, "Graph.gp_DupGraph(self) -> Graph"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_39gp_DupGraph = {"gp_DupGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_39gp_DupGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_38gp_DupGraph}; +static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pw_9planarity_4full_5graph_5Graph_39gp_DupGraph(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -5889,14 +6269,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("gp_DupGraph", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_40gp_DupGraph(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_38gp_DupGraph(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full_5graph_5Graph_40gp_DupGraph(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { +static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full_5graph_5Graph_38gp_DupGraph(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { graphP __pyx_v_theGraph_dup; struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_new_graph = 0; struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_r = NULL; @@ -5910,7 +6290,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":168 * * def gp_DupGraph(self) -> Graph: * cdef cgraphLib.graphP theGraph_dup = cgraphLib.gp_DupGraph(self._theGraph) # <<<<<<<<<<<<<< @@ -5919,7 +6299,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":169 * def gp_DupGraph(self) -> Graph: * cdef cgraphLib.graphP theGraph_dup = cgraphLib.gp_DupGraph(self._theGraph) * if theGraph_dup == NULL: # <<<<<<<<<<<<<< @@ -5929,7 +6309,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":170 * cdef cgraphLib.graphP theGraph_dup = cgraphLib.gp_DupGraph(self._theGraph) * if theGraph_dup == NULL: * raise MemoryError("gp_DupGraph() failed.") # <<<<<<<<<<<<<< @@ -5942,14 +6322,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, 170, __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, 170, __pyx_L1_error) - /* "planarity/full/graph.pyx":149 + /* "planarity/full/graph.pyx":169 * def gp_DupGraph(self) -> Graph: * cdef cgraphLib.graphP theGraph_dup = cgraphLib.gp_DupGraph(self._theGraph) * if theGraph_dup == NULL: # <<<<<<<<<<<<<< @@ -5958,7 +6338,7 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full */ } - /* "planarity/full/graph.pyx":152 + /* "planarity/full/graph.pyx":172 * raise MemoryError("gp_DupGraph() failed.") * * cdef Graph new_graph = Graph() # <<<<<<<<<<<<<< @@ -5971,13 +6351,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, 172, __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":173 * * cdef Graph new_graph = Graph() * if new_graph is None: # <<<<<<<<<<<<<< @@ -5987,7 +6367,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":174 * cdef Graph new_graph = Graph() * if new_graph is None: * raise MemoryError("Unable to create new Graph container for duplicate.") # <<<<<<<<<<<<<< @@ -6000,14 +6380,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, 174, __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, 174, __pyx_L1_error) - /* "planarity/full/graph.pyx":153 + /* "planarity/full/graph.pyx":173 * * cdef Graph new_graph = Graph() * if new_graph is None: # <<<<<<<<<<<<<< @@ -6016,7 +6396,7 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full */ } - /* "planarity/full/graph.pyx":156 + /* "planarity/full/graph.pyx":176 * raise MemoryError("Unable to create new Graph container for duplicate.") * * if new_graph._theGraph != NULL: # <<<<<<<<<<<<<< @@ -6026,7 +6406,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":177 * * if new_graph._theGraph != NULL: * cgraphLib.gp_Free(&new_graph._theGraph) # <<<<<<<<<<<<<< @@ -6035,7 +6415,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":176 * raise MemoryError("Unable to create new Graph container for duplicate.") * * if new_graph._theGraph != NULL: # <<<<<<<<<<<<<< @@ -6044,7 +6424,7 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full */ } - /* "planarity/full/graph.pyx":159 + /* "planarity/full/graph.pyx":179 * cgraphLib.gp_Free(&new_graph._theGraph) * * new_graph._theGraph = theGraph_dup # <<<<<<<<<<<<<< @@ -6053,7 +6433,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":180 * * new_graph._theGraph = theGraph_dup * new_graph.owns_graphP = True # <<<<<<<<<<<<<< @@ -6062,7 +6442,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":182 * new_graph.owns_graphP = True * * return new_graph # <<<<<<<<<<<<<< @@ -6074,7 +6454,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":167 * raise RuntimeError(f"gp_CopyGraph() failed.") * * def gp_DupGraph(self) -> Graph: # <<<<<<<<<<<<<< @@ -6095,7 +6475,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":184 * return new_graph * * def gp_Read(self, str infile_name): # <<<<<<<<<<<<<< @@ -6104,16 +6484,16 @@ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_43gp_Read(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_41gp_Read(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_42gp_Read, "Graph.gp_Read(self, str infile_name)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_43gp_Read = {"gp_Read", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_43gp_Read, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_42gp_Read}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_43gp_Read(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_40gp_Read, "Graph.gp_Read(self, str infile_name)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_41gp_Read = {"gp_Read", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_41gp_Read, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_40gp_Read}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_41gp_Read(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -6143,32 +6523,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, 184, __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, 184, __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, 184, __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, 184, __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, 184, __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, 184, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -6179,8 +6559,8 @@ 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) - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_42gp_Read(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__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, 184, __pyx_L1_error) + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_40gp_Read(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_infile_name); /* function exit code */ goto __pyx_L0; @@ -6199,7 +6579,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_42gp_Read(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, PyObject *__pyx_v_infile_name) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_40gp_Read(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, PyObject *__pyx_v_infile_name) { PyObject *__pyx_v_encoded = 0; char const *__pyx_v_FileName; PyObject *__pyx_r = NULL; @@ -6214,7 +6594,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":186 * 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 +6603,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, 186, __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, 186, __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":187 * # 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, 187, __pyx_L1_error) __pyx_v_FileName = __pyx_t_2; - /* "planarity/full/graph.pyx":169 + /* "planarity/full/graph.pyx":189 * cdef const char *FileName = encoded * * if cgraphLib.gp_Read(self._theGraph, FileName) != cappconst.OK: # <<<<<<<<<<<<<< @@ -6250,7 +6630,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":190 * * if cgraphLib.gp_Read(self._theGraph, FileName) != cappconst.OK: * raise RuntimeError(f"gp_Read() failed.") # <<<<<<<<<<<<<< @@ -6263,14 +6643,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, 190, __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, 190, __pyx_L1_error) - /* "planarity/full/graph.pyx":169 + /* "planarity/full/graph.pyx":189 * cdef const char *FileName = encoded * * if cgraphLib.gp_Read(self._theGraph, FileName) != cappconst.OK: # <<<<<<<<<<<<<< @@ -6279,7 +6659,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_42gp_Read(struct __pyx_ */ } - /* "planarity/full/graph.pyx":164 + /* "planarity/full/graph.pyx":184 * return new_graph * * def gp_Read(self, str infile_name): # <<<<<<<<<<<<<< @@ -6302,7 +6682,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":192 * raise RuntimeError(f"gp_Read() failed.") * * def gp_Write(self, str outfile_name, str mode): # <<<<<<<<<<<<<< @@ -6311,16 +6691,16 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_42gp_Read(struct __pyx_ */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_45gp_Write(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_43gp_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_5graph_5Graph_44gp_Write, "Graph.gp_Write(self, str outfile_name, str mode)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_45gp_Write = {"gp_Write", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_45gp_Write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_44gp_Write}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_45gp_Write(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_42gp_Write, "Graph.gp_Write(self, str outfile_name, str mode)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_43gp_Write = {"gp_Write", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_43gp_Write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_42gp_Write}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_43gp_Write(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -6351,39 +6731,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, 192, __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, 192, __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, 192, __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, 192, __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, 192, __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, 192, __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, 192, __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, 192, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -6394,9 +6774,9 @@ 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) - __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); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_outfile_name), (&PyUnicode_Type), 1, "outfile_name", 1))) __PYX_ERR(0, 192, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mode), (&PyUnicode_Type), 1, "mode", 1))) __PYX_ERR(0, 192, __pyx_L1_error) + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_42gp_Write(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_outfile_name, __pyx_v_mode); /* function exit code */ goto __pyx_L0; @@ -6415,10 +6795,10 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_44gp_Write(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, PyObject *__pyx_v_outfile_name, PyObject *__pyx_v_mode) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_42gp_Write(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, PyObject *__pyx_v_outfile_name, PyObject *__pyx_v_mode) { PyObject *__pyx_v_mode_code = NULL; PyObject *__pyx_v_encoded = 0; - char const *__pyx_v_FileName; + char const *__pyx_v_theFileName; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -6437,52 +6817,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":193 * * 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, 193, __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, 193, __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":194 * 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, 194, __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, 194, __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":195 * 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, 195, __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, 195, __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":196 * else (cgraphLib.WRITE_ADJMATRIX if mode == "m" * else (cgraphLib.WRITE_G6 if mode == "g" * else None))) # <<<<<<<<<<<<<< @@ -6501,18 +6881,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":197 * 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, 197, __pyx_L1_error) __pyx_t_4 = (!__pyx_t_2); if (unlikely(__pyx_t_4)) { - /* "planarity/full/graph.pyx":178 + /* "planarity/full/graph.pyx":198 * else None))) * if not mode_code: * raise ValueError( # <<<<<<<<<<<<<< @@ -6521,20 +6901,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":199 * 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, 199, __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, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_9 = 1; @@ -6543,14 +6923,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, 198, __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, 198, __pyx_L1_error) - /* "planarity/full/graph.pyx":177 + /* "planarity/full/graph.pyx":197 * else (cgraphLib.WRITE_G6 if mode == "g" * else None))) * if not mode_code: # <<<<<<<<<<<<<< @@ -6559,66 +6939,66 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_44gp_Write(struct __pyx */ } - /* "planarity/full/graph.pyx":184 + /* "planarity/full/graph.pyx":204 * * # 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 + * cdef const char *theFileName = encoded * */ 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, 204, __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, 204, __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":205 * # 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 # <<<<<<<<<<<<<< + * cdef const char *theFileName = encoded # <<<<<<<<<<<<<< * - * if cgraphLib.gp_Write(self._theGraph, FileName, mode_code) != cappconst.OK: + * if cgraphLib.gp_Write(self._theGraph, theFileName, 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_v_FileName = __pyx_t_10; + __pyx_t_10 = __Pyx_PyBytes_AsString(__pyx_v_encoded); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_v_theFileName = __pyx_t_10; - /* "planarity/full/graph.pyx":187 - * cdef const char *FileName = encoded + /* "planarity/full/graph.pyx":207 + * cdef const char *theFileName = encoded * - * if cgraphLib.gp_Write(self._theGraph, FileName, mode_code) != cappconst.OK: # <<<<<<<<<<<<<< + * if cgraphLib.gp_Write(self._theGraph, theFileName, 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_4 = (gp_Write(__pyx_v_self->_theGraph, __pyx_v_FileName, __pyx_t_11) != OK); + __pyx_t_11 = __Pyx_PyLong_As_int(__pyx_v_mode_code); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_t_4 = (gp_Write(__pyx_v_self->_theGraph, __pyx_v_theFileName, __pyx_t_11) != OK); if (unlikely(__pyx_t_4)) { - /* "planarity/full/graph.pyx":188 + /* "planarity/full/graph.pyx":208 * - * if cgraphLib.gp_Write(self._theGraph, FileName, mode_code) != cappconst.OK: + * if cgraphLib.gp_Write(self._theGraph, theFileName, mode_code) != cappconst.OK: * raise RuntimeError( # <<<<<<<<<<<<<< * f"gp_Write() of graph to '{outfile_name}' failed." * ) */ __pyx_t_7 = NULL; - /* "planarity/full/graph.pyx":189 - * if cgraphLib.gp_Write(self._theGraph, FileName, mode_code) != cappconst.OK: + /* "planarity/full/graph.pyx":209 + * if cgraphLib.gp_Write(self._theGraph, theFileName, 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, 209, __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, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_9 = 1; @@ -6627,23 +7007,23 @@ 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, 208, __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, 208, __pyx_L1_error) - /* "planarity/full/graph.pyx":187 - * cdef const char *FileName = encoded + /* "planarity/full/graph.pyx":207 + * cdef const char *theFileName = encoded * - * if cgraphLib.gp_Write(self._theGraph, FileName, mode_code) != cappconst.OK: # <<<<<<<<<<<<<< + * if cgraphLib.gp_Write(self._theGraph, theFileName, mode_code) != cappconst.OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_Write() of graph to '{outfile_name}' failed." */ } - /* "planarity/full/graph.pyx":172 + /* "planarity/full/graph.pyx":192 * raise RuntimeError(f"gp_Read() failed.") * * def gp_Write(self, str outfile_name, str mode): # <<<<<<<<<<<<<< @@ -6669,25 +7049,25 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_44gp_Write(struct __pyx return __pyx_r; } -/* "planarity/full/graph.pyx":192 +/* "planarity/full/graph.pyx":212 * ) * - * def gp_GetNeighborEdgeRecord(self, int u, int v): # <<<<<<<<<<<<<< + * def gp_FindEdge(self, int u, int v): # <<<<<<<<<<<<<< * if not self.gp_IsVertex(u): * raise RuntimeError(f"'{u}' is not a valid vertex label.") */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_47gp_GetNeighborEdgeRecord(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_45gp_FindEdge(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_46gp_GetNeighborEdgeRecord, "Graph.gp_GetNeighborEdgeRecord(self, int u, int v)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_47gp_GetNeighborEdgeRecord = {"gp_GetNeighborEdgeRecord", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_47gp_GetNeighborEdgeRecord, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_46gp_GetNeighborEdgeRecord}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_47gp_GetNeighborEdgeRecord(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_44gp_FindEdge, "Graph.gp_FindEdge(self, int u, int v)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_45gp_FindEdge = {"gp_FindEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_45gp_FindEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_44gp_FindEdge}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_45gp_FindEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -6706,7 +7086,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("gp_GetNeighborEdgeRecord (wrapper)", 0); + __Pyx_RefNannySetupContext("gp_FindEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -6718,50 +7098,50 @@ 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, 212, __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, 212, __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, 212, __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_FindEdge", 0) < (0)) __PYX_ERR(0, 212, __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_FindEdge", 1, 2, 2, i); __PYX_ERR(0, 212, __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, 212, __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, 212, __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, 212, __pyx_L3_error) + __pyx_v_v = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 212, __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_FindEdge", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 212, __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_GetNeighborEdgeRecord", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_FindEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetNeighborEdgeRecord(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_u, __pyx_v_v); + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_44gp_FindEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_u, __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) { @@ -6771,7 +7151,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetNeighborEdgeRecord(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_u, int __pyx_v_v) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_44gp_FindEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_u, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -6785,18 +7165,18 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetNeighborEdgeRec int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("gp_GetNeighborEdgeRecord", 0); + __Pyx_RefNannySetupContext("gp_FindEdge", 0); - /* "planarity/full/graph.pyx":193 + /* "planarity/full/graph.pyx":213 * - * def gp_GetNeighborEdgeRecord(self, int u, int v): + * def gp_FindEdge(self, int u, int v): * if not self.gp_IsVertex(u): # <<<<<<<<<<<<<< * raise RuntimeError(f"'{u}' is not a valid vertex label.") * if not self.gp_IsVertex(v): */ __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, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { @@ -6804,29 +7184,29 @@ 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, 213, __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, 213, __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 - * def gp_GetNeighborEdgeRecord(self, int u, int v): + /* "planarity/full/graph.pyx":214 + * def gp_FindEdge(self, int u, int v): * if not self.gp_IsVertex(u): * 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.") */ __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, 214, __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, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; @@ -6835,23 +7215,23 @@ 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, 214, __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, 214, __pyx_L1_error) - /* "planarity/full/graph.pyx":193 + /* "planarity/full/graph.pyx":213 * - * def gp_GetNeighborEdgeRecord(self, int u, int v): + * def gp_FindEdge(self, int u, int v): * if not self.gp_IsVertex(u): # <<<<<<<<<<<<<< * raise RuntimeError(f"'{u}' is not a valid vertex label.") * if not self.gp_IsVertex(v): */ } - /* "planarity/full/graph.pyx":195 + /* "planarity/full/graph.pyx":215 * if not self.gp_IsVertex(u): * raise RuntimeError(f"'{u}' is not a valid vertex label.") * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< @@ -6860,7 +7240,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, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { @@ -6868,29 +7248,29 @@ 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, 215, __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, 215, __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":216 * 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.") # <<<<<<<<<<<<<< * - * return cgraphLib.gp_GetNeighborEdgeRecord(self._theGraph, u, v) + * return cgraphLib.gp_FindEdge(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, 216, __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, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_4 = 1; @@ -6899,14 +7279,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, 216, __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, 216, __pyx_L1_error) - /* "planarity/full/graph.pyx":195 + /* "planarity/full/graph.pyx":215 * if not self.gp_IsVertex(u): * raise RuntimeError(f"'{u}' is not a valid vertex label.") * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< @@ -6915,24 +7295,24 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetNeighborEdgeRec */ } - /* "planarity/full/graph.pyx":198 + /* "planarity/full/graph.pyx":218 * raise RuntimeError(f"'{v}' is not a valid vertex label.") * - * return cgraphLib.gp_GetNeighborEdgeRecord(self._theGraph, u, v) # <<<<<<<<<<<<<< + * return cgraphLib.gp_FindEdge(self._theGraph, u, v) # <<<<<<<<<<<<<< * * 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_FindEdge(__pyx_v_self->_theGraph, __pyx_v_u, __pyx_v_v)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __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":212 * ) * - * def gp_GetNeighborEdgeRecord(self, int u, int v): # <<<<<<<<<<<<<< + * def gp_FindEdge(self, int u, int v): # <<<<<<<<<<<<<< * if not self.gp_IsVertex(u): * raise RuntimeError(f"'{u}' is not a valid vertex label.") */ @@ -6943,7 +7323,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetNeighborEdgeRec __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetNeighborEdgeRecord", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_FindEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6951,8 +7331,8 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetNeighborEdgeRec return __pyx_r; } -/* "planarity/full/graph.pyx":200 - * return cgraphLib.gp_GetNeighborEdgeRecord(self._theGraph, u, v) +/* "planarity/full/graph.pyx":220 + * return cgraphLib.gp_FindEdge(self._theGraph, u, v) * * def gp_GetVertexDegree(self, int v): # <<<<<<<<<<<<<< * if not self.gp_IsVertex(v): @@ -6960,16 +7340,16 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetNeighborEdgeRec */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_49gp_GetVertexDegree(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_47gp_GetVertexDegree(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_48gp_GetVertexDegree, "Graph.gp_GetVertexDegree(self, int v)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_49gp_GetVertexDegree = {"gp_GetVertexDegree", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_49gp_GetVertexDegree, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_48gp_GetVertexDegree}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_49gp_GetVertexDegree(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_46gp_GetVertexDegree, "Graph.gp_GetVertexDegree(self, int v)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_47gp_GetVertexDegree = {"gp_GetVertexDegree", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_47gp_GetVertexDegree, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_46gp_GetVertexDegree}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_47gp_GetVertexDegree(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -6999,32 +7379,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, 220, __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, 220, __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, 220, __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, 220, __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, 220, __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, 220, __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, 220, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -7035,7 +7415,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_48gp_GetVertexDegree(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetVertexDegree(((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) { @@ -7045,7 +7425,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_48gp_GetVertexDegree(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_GetVertexDegree(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; @@ -7061,7 +7441,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":221 * * def gp_GetVertexDegree(self, int v): * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< @@ -7070,7 +7450,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, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { @@ -7078,15 +7458,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, 221, __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, 221, __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":222 * def gp_GetVertexDegree(self, int v): * if not self.gp_IsVertex(v): * raise RuntimeError(f"'{v}' is not a valid vertex label.") # <<<<<<<<<<<<<< @@ -7094,13 +7474,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, 222, __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, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; @@ -7109,14 +7489,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, 222, __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, 222, __pyx_L1_error) - /* "planarity/full/graph.pyx":201 + /* "planarity/full/graph.pyx":221 * * def gp_GetVertexDegree(self, int v): * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< @@ -7125,22 +7505,22 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_48gp_GetVertexDegree(st */ } - /* "planarity/full/graph.pyx":204 + /* "planarity/full/graph.pyx":224 * raise RuntimeError(f"'{v}' is not a valid vertex label.") * * return cgraphLib.gp_GetVertexDegree(self._theGraph, v) # <<<<<<<<<<<<<< * - * def gp_GetArcCapacity(self): + * def gp_GetEdgeCapacity(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, 224, __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 - * return cgraphLib.gp_GetNeighborEdgeRecord(self._theGraph, u, v) + /* "planarity/full/graph.pyx":220 + * return cgraphLib.gp_FindEdge(self._theGraph, u, v) * * def gp_GetVertexDegree(self, int v): # <<<<<<<<<<<<<< * if not self.gp_IsVertex(v): @@ -7161,25 +7541,25 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_48gp_GetVertexDegree(st return __pyx_r; } -/* "planarity/full/graph.pyx":206 +/* "planarity/full/graph.pyx":226 * return cgraphLib.gp_GetVertexDegree(self._theGraph, v) * - * def gp_GetArcCapacity(self): # <<<<<<<<<<<<<< - * return cgraphLib.gp_GetArcCapacity(self._theGraph) + * def gp_GetEdgeCapacity(self): # <<<<<<<<<<<<<< + * return cgraphLib.gp_GetEdgeCapacity(self._theGraph) * */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_51gp_GetArcCapacity(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_49gp_GetEdgeCapacity(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_50gp_GetArcCapacity, "Graph.gp_GetArcCapacity(self)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_51gp_GetArcCapacity = {"gp_GetArcCapacity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_51gp_GetArcCapacity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_50gp_GetArcCapacity}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_51gp_GetArcCapacity(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_48gp_GetEdgeCapacity, "Graph.gp_GetEdgeCapacity(self)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_49gp_GetEdgeCapacity = {"gp_GetEdgeCapacity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_49gp_GetEdgeCapacity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_48gp_GetEdgeCapacity}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_49gp_GetEdgeCapacity(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -7192,7 +7572,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("gp_GetArcCapacity (wrapper)", 0); + __Pyx_RefNannySetupContext("gp_GetEdgeCapacity (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -7201,52 +7581,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_GetArcCapacity", 1, 0, 0, __pyx_nargs); return NULL; } + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_GetEdgeCapacity", 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_GetArcCapacity", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_50gp_GetArcCapacity(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_GetEdgeCapacity", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_48gp_GetEdgeCapacity(((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_50gp_GetArcCapacity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_48gp_GetEdgeCapacity(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_GetArcCapacity", 0); + __Pyx_RefNannySetupContext("gp_GetEdgeCapacity", 0); - /* "planarity/full/graph.pyx":207 + /* "planarity/full/graph.pyx":227 * - * def gp_GetArcCapacity(self): - * return cgraphLib.gp_GetArcCapacity(self._theGraph) # <<<<<<<<<<<<<< + * def gp_GetEdgeCapacity(self): + * return cgraphLib.gp_GetEdgeCapacity(self._theGraph) # <<<<<<<<<<<<<< * - * def gp_EnsureArcCapacity(self, int new_arc_capacity): + * def gp_EnsureEdgeCapacity(self, int new_edge_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_GetEdgeCapacity(__pyx_v_self->_theGraph)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __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":226 * return cgraphLib.gp_GetVertexDegree(self._theGraph, v) * - * def gp_GetArcCapacity(self): # <<<<<<<<<<<<<< - * return cgraphLib.gp_GetArcCapacity(self._theGraph) + * def gp_GetEdgeCapacity(self): # <<<<<<<<<<<<<< + * return cgraphLib.gp_GetEdgeCapacity(self._theGraph) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetArcCapacity", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetEdgeCapacity", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -7254,32 +7634,32 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_50gp_GetArcCapacity(str return __pyx_r; } -/* "planarity/full/graph.pyx":209 - * return cgraphLib.gp_GetArcCapacity(self._theGraph) +/* "planarity/full/graph.pyx":229 + * return cgraphLib.gp_GetEdgeCapacity(self._theGraph) * - * def gp_EnsureArcCapacity(self, int new_arc_capacity): # <<<<<<<<<<<<<< - * if cgraphLib.gp_EnsureArcCapacity(self._theGraph, new_arc_capacity) != cappconst.OK: + * def gp_EnsureEdgeCapacity(self, int new_edge_capacity): # <<<<<<<<<<<<<< + * if cgraphLib.gp_EnsureEdgeCapacity(self._theGraph, new_edge_capacity) != cappconst.OK: * raise RuntimeError( */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_53gp_EnsureArcCapacity(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_51gp_EnsureEdgeCapacity(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_52gp_EnsureArcCapacity, "Graph.gp_EnsureArcCapacity(self, int new_arc_capacity)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_53gp_EnsureArcCapacity = {"gp_EnsureArcCapacity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_53gp_EnsureArcCapacity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_52gp_EnsureArcCapacity}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_53gp_EnsureArcCapacity(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_50gp_EnsureEdgeCapacity, "Graph.gp_EnsureEdgeCapacity(self, int new_edge_capacity)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_51gp_EnsureEdgeCapacity = {"gp_EnsureEdgeCapacity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_51gp_EnsureEdgeCapacity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_50gp_EnsureEdgeCapacity}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_51gp_EnsureEdgeCapacity(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 ) { - int __pyx_v_new_arc_capacity; + int __pyx_v_new_edge_capacity; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif @@ -7290,7 +7670,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("gp_EnsureArcCapacity (wrapper)", 0); + __Pyx_RefNannySetupContext("gp_EnsureEdgeCapacity (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -7300,45 +7680,45 @@ 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_new_arc_capacity,0}; + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_new_edge_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, 229, __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, 229, __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_EnsureEdgeCapacity", 0) < (0)) __PYX_ERR(0, 229, __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_EnsureEdgeCapacity", 1, 1, 1, i); __PYX_ERR(0, 229, __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, 229, __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_edge_capacity = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_new_edge_capacity == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 229, __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_EnsureEdgeCapacity", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 229, __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_EnsureArcCapacity", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_EnsureEdgeCapacity", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_52gp_EnsureArcCapacity(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_new_arc_capacity); + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_50gp_EnsureEdgeCapacity(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_new_edge_capacity); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { @@ -7348,7 +7728,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -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) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_50gp_EnsureEdgeCapacity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_new_edge_capacity) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -7361,49 +7741,49 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_52gp_EnsureArcCapacity( int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("gp_EnsureArcCapacity", 0); + __Pyx_RefNannySetupContext("gp_EnsureEdgeCapacity", 0); - /* "planarity/full/graph.pyx":210 + /* "planarity/full/graph.pyx":230 * - * def gp_EnsureArcCapacity(self, int new_arc_capacity): - * if cgraphLib.gp_EnsureArcCapacity(self._theGraph, new_arc_capacity) != cappconst.OK: # <<<<<<<<<<<<<< + * def gp_EnsureEdgeCapacity(self, int new_edge_capacity): + * if cgraphLib.gp_EnsureEdgeCapacity(self._theGraph, new_edge_capacity) != cappconst.OK: # <<<<<<<<<<<<<< * raise RuntimeError( - * "gp_EnsureArcCapacity() failed to set capacity to " + * "gp_EnsureEdgeCapacity() failed to set edge capacity to " */ - __pyx_t_1 = (gp_EnsureArcCapacity(__pyx_v_self->_theGraph, __pyx_v_new_arc_capacity) != OK); + __pyx_t_1 = (gp_EnsureEdgeCapacity(__pyx_v_self->_theGraph, __pyx_v_new_edge_capacity) != OK); if (unlikely(__pyx_t_1)) { - /* "planarity/full/graph.pyx":211 - * def gp_EnsureArcCapacity(self, int new_arc_capacity): - * if cgraphLib.gp_EnsureArcCapacity(self._theGraph, new_arc_capacity) != cappconst.OK: + /* "planarity/full/graph.pyx":231 + * def gp_EnsureEdgeCapacity(self, int new_edge_capacity): + * if cgraphLib.gp_EnsureEdgeCapacity(self._theGraph, new_edge_capacity) != cappconst.OK: * raise RuntimeError( # <<<<<<<<<<<<<< - * "gp_EnsureArcCapacity() failed to set capacity to " - * f"{new_arc_capacity}.") + * "gp_EnsureEdgeCapacity() failed to set edge capacity to " + * f"{new_edge_capacity}.") */ __pyx_t_3 = NULL; - /* "planarity/full/graph.pyx":213 + /* "planarity/full/graph.pyx":233 * raise RuntimeError( - * "gp_EnsureArcCapacity() failed to set capacity to " - * f"{new_arc_capacity}.") # <<<<<<<<<<<<<< + * "gp_EnsureEdgeCapacity() failed to set edge capacity to " + * f"{new_edge_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_edge_capacity, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 233, __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[0] = __pyx_mstate_global->__pyx_kp_u_gp_EnsureEdgeCapacity_failed_to; __pyx_t_5[1] = __pyx_t_4; __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u__3; - /* "planarity/full/graph.pyx":212 - * if cgraphLib.gp_EnsureArcCapacity(self._theGraph, new_arc_capacity) != cappconst.OK: + /* "planarity/full/graph.pyx":232 + * if cgraphLib.gp_EnsureEdgeCapacity(self._theGraph, new_edge_capacity) != cappconst.OK: * raise RuntimeError( - * "gp_EnsureArcCapacity() failed to set capacity to " # <<<<<<<<<<<<<< - * f"{new_arc_capacity}.") + * "gp_EnsureEdgeCapacity() failed to set edge capacity to " # <<<<<<<<<<<<<< + * f"{new_edge_capacity}.") * */ - __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) + __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, 55 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 1, 127); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_7 = 1; @@ -7412,27 +7792,27 @@ 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, 231, __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, 231, __pyx_L1_error) - /* "planarity/full/graph.pyx":210 + /* "planarity/full/graph.pyx":230 * - * def gp_EnsureArcCapacity(self, int new_arc_capacity): - * if cgraphLib.gp_EnsureArcCapacity(self._theGraph, new_arc_capacity) != cappconst.OK: # <<<<<<<<<<<<<< + * def gp_EnsureEdgeCapacity(self, int new_edge_capacity): + * if cgraphLib.gp_EnsureEdgeCapacity(self._theGraph, new_edge_capacity) != cappconst.OK: # <<<<<<<<<<<<<< * raise RuntimeError( - * "gp_EnsureArcCapacity() failed to set capacity to " + * "gp_EnsureEdgeCapacity() failed to set edge capacity to " */ } - /* "planarity/full/graph.pyx":209 - * return cgraphLib.gp_GetArcCapacity(self._theGraph) + /* "planarity/full/graph.pyx":229 + * return cgraphLib.gp_GetEdgeCapacity(self._theGraph) * - * def gp_EnsureArcCapacity(self, int new_arc_capacity): # <<<<<<<<<<<<<< - * if cgraphLib.gp_EnsureArcCapacity(self._theGraph, new_arc_capacity) != cappconst.OK: + * def gp_EnsureEdgeCapacity(self, int new_edge_capacity): # <<<<<<<<<<<<<< + * if cgraphLib.gp_EnsureEdgeCapacity(self._theGraph, new_edge_capacity) != cappconst.OK: * raise RuntimeError( */ @@ -7444,7 +7824,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_52gp_EnsureArcCapacity( __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("planarity.full.graph.Graph.gp_EnsureArcCapacity", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_EnsureEdgeCapacity", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -7452,8 +7832,8 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_52gp_EnsureArcCapacity( return __pyx_r; } -/* "planarity/full/graph.pyx":215 - * f"{new_arc_capacity}.") +/* "planarity/full/graph.pyx":235 + * f"{new_edge_capacity}.") * * def gp_AddEdge(self, int u, int ulink, int v, int vlink): # <<<<<<<<<<<<<< * if ulink != 0 and ulink != 1: @@ -7461,16 +7841,16 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_52gp_EnsureArcCapacity( */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_55gp_AddEdge(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_53gp_AddEdge(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_54gp_AddEdge, "Graph.gp_AddEdge(self, int u, int ulink, int v, int vlink)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_55gp_AddEdge = {"gp_AddEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_55gp_AddEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_54gp_AddEdge}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_55gp_AddEdge(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_52gp_AddEdge, "Graph.gp_AddEdge(self, int u, int ulink, int v, int vlink)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_53gp_AddEdge = {"gp_AddEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_53gp_AddEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_52gp_AddEdge}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_53gp_AddEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -7503,53 +7883,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, 235, __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, 235, __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, 235, __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, 235, __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, 235, __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, 235, __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, 235, __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, 235, __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, 235, __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, 235, __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, 235, __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, 235, __pyx_L3_error) + __pyx_v_ulink = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_ulink == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 235, __pyx_L3_error) + __pyx_v_v = __Pyx_PyLong_As_int(values[2]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 235, __pyx_L3_error) + __pyx_v_vlink = __Pyx_PyLong_As_int(values[3]); if (unlikely((__pyx_v_vlink == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 235, __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, 235, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -7560,7 +7940,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_54gp_AddEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_u, __pyx_v_ulink, __pyx_v_v, __pyx_v_vlink); + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_52gp_AddEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_u, __pyx_v_ulink, __pyx_v_v, __pyx_v_vlink); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { @@ -7570,7 +7950,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -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) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_52gp_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) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -7589,7 +7969,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":236 * * def gp_AddEdge(self, int u, int ulink, int v, int vlink): * if ulink != 0 and ulink != 1: # <<<<<<<<<<<<<< @@ -7607,7 +7987,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":237 * def gp_AddEdge(self, int u, int ulink, int v, int vlink): * if ulink != 0 and ulink != 1: * raise RuntimeError( # <<<<<<<<<<<<<< @@ -7616,20 +7996,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":238 * 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, 238, __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, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_7 = 1; @@ -7638,14 +8018,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, 237, __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, 237, __pyx_L1_error) - /* "planarity/full/graph.pyx":216 + /* "planarity/full/graph.pyx":236 * * def gp_AddEdge(self, int u, int ulink, int v, int vlink): * if ulink != 0 and ulink != 1: # <<<<<<<<<<<<<< @@ -7654,7 +8034,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_AddEdge(struct __p */ } - /* "planarity/full/graph.pyx":220 + /* "planarity/full/graph.pyx":240 * f"Invalid link index for ulink: '{ulink}'." * ) * if vlink != 0 and vlink != 1: # <<<<<<<<<<<<<< @@ -7672,7 +8052,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":241 * ) * if vlink != 0 and vlink != 1: * raise RuntimeError( # <<<<<<<<<<<<<< @@ -7681,20 +8061,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":242 * 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, 242, __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, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = 1; @@ -7703,14 +8083,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, 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, 221, __pyx_L1_error) + __PYX_ERR(0, 241, __pyx_L1_error) - /* "planarity/full/graph.pyx":220 + /* "planarity/full/graph.pyx":240 * f"Invalid link index for ulink: '{ulink}'." * ) * if vlink != 0 and vlink != 1: # <<<<<<<<<<<<<< @@ -7719,7 +8099,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_AddEdge(struct __p */ } - /* "planarity/full/graph.pyx":224 + /* "planarity/full/graph.pyx":244 * f"Invalid link index for vlink: '{vlink}'." * ) * if cgraphLib.gp_AddEdge(self._theGraph, u, ulink, v, vlink) != cappconst.OK: # <<<<<<<<<<<<<< @@ -7729,7 +8109,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":245 * ) * if cgraphLib.gp_AddEdge(self._theGraph, u, ulink, v, vlink) != cappconst.OK: * raise RuntimeError( # <<<<<<<<<<<<<< @@ -7738,28 +8118,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":246 * 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, 246, __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, 246, __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, 246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - /* "planarity/full/graph.pyx":227 + /* "planarity/full/graph.pyx":247 * 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, 247, __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 +8151,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":246 * 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 +8159,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, 246, __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 +8171,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, 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, 225, __pyx_L1_error) + __PYX_ERR(0, 245, __pyx_L1_error) - /* "planarity/full/graph.pyx":224 + /* "planarity/full/graph.pyx":244 * f"Invalid link index for vlink: '{vlink}'." * ) * if cgraphLib.gp_AddEdge(self._theGraph, u, ulink, v, vlink) != cappconst.OK: # <<<<<<<<<<<<<< @@ -7807,8 +8187,8 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_AddEdge(struct __p */ } - /* "planarity/full/graph.pyx":215 - * f"{new_arc_capacity}.") + /* "planarity/full/graph.pyx":235 + * f"{new_edge_capacity}.") * * def gp_AddEdge(self, int u, int ulink, int v, int vlink): # <<<<<<<<<<<<<< * if ulink != 0 and ulink != 1: @@ -7834,25 +8214,25 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_AddEdge(struct __p return __pyx_r; } -/* "planarity/full/graph.pyx":230 +/* "planarity/full/graph.pyx":250 * ) * - * def gp_DeleteEdge(self, int e, int nextLink): # <<<<<<<<<<<<<< - * if not self.gp_IsArc(e): + * def gp_DeleteEdge(self, int e): # <<<<<<<<<<<<<< + * if not self.gp_IsEdge(e): * raise RuntimeError( */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_57gp_DeleteEdge(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_55gp_DeleteEdge(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_56gp_DeleteEdge, "Graph.gp_DeleteEdge(self, int e, int nextLink)"); -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, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_54gp_DeleteEdge, "Graph.gp_DeleteEdge(self, int e)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_55gp_DeleteEdge = {"gp_DeleteEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_55gp_DeleteEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_54gp_DeleteEdge}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_55gp_DeleteEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -7860,12 +8240,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 +8260,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, 250, __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, 250, __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, 250, __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, 250, __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, 250, __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, 250, __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, 250, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -7926,189 +8298,963 @@ 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_54gp_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) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_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; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7[3]; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("gp_DeleteEdge", 0); + + /* "planarity/full/graph.pyx":251 + * + * def gp_DeleteEdge(self, int e): + * if not self.gp_IsEdge(e): # <<<<<<<<<<<<<< + * raise RuntimeError( + * f"gp_DeleteEdge() failed: invalid edge '{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, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsEdge, __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, 251, __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, 251, __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":252 + * def gp_DeleteEdge(self, int e): + * if not self.gp_IsEdge(e): + * raise RuntimeError( # <<<<<<<<<<<<<< + * f"gp_DeleteEdge() failed: invalid edge '{e}'." + * ) +*/ + __pyx_t_3 = NULL; + + /* "planarity/full/graph.pyx":253 + * if not self.gp_IsEdge(e): + * raise RuntimeError( + * f"gp_DeleteEdge() failed: invalid edge '{e}'." # <<<<<<<<<<<<<< + * ) + * +*/ + __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_gp_DeleteEdge_failed_invalid_edg; + __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, 38 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 2, 127); + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_8}; + __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, 252, __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, 252, __pyx_L1_error) + + /* "planarity/full/graph.pyx":251 + * + * def gp_DeleteEdge(self, int e): + * if not self.gp_IsEdge(e): # <<<<<<<<<<<<<< + * raise RuntimeError( + * f"gp_DeleteEdge() failed: invalid edge '{e}'." +*/ + } + + /* "planarity/full/graph.pyx":256 + * ) + * + * return cgraphLib.gp_DeleteEdge(self._theGraph, e) # <<<<<<<<<<<<<< + * + * def gp_ExtendWith_Planarity(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(gp_DeleteEdge(__pyx_v_self->_theGraph, __pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "planarity/full/graph.pyx":250 + * ) + * + * def gp_DeleteEdge(self, int e): # <<<<<<<<<<<<<< + * if not self.gp_IsEdge(e): + * raise RuntimeError( +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DeleteEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "planarity/full/graph.pyx":258 + * return cgraphLib.gp_DeleteEdge(self._theGraph, e) + * + * def gp_ExtendWith_Planarity(self): # <<<<<<<<<<<<<< + * if cgraphLib.gp_ExtendWith_Planarity(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with Planarity structures.") +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_57gp_ExtendWith_Planarity(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_56gp_ExtendWith_Planarity, "Graph.gp_ExtendWith_Planarity(self)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_57gp_ExtendWith_Planarity = {"gp_ExtendWith_Planarity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_57gp_ExtendWith_Planarity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_56gp_ExtendWith_Planarity}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_57gp_ExtendWith_Planarity(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("gp_ExtendWith_Planarity (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("gp_ExtendWith_Planarity", 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_ExtendWith_Planarity", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_56gp_ExtendWith_Planarity(((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_56gp_ExtendWith_Planarity(struct __pyx_obj_9planarity_4full_5graph_Graph *__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("gp_ExtendWith_Planarity", 0); + + /* "planarity/full/graph.pyx":259 + * + * def gp_ExtendWith_Planarity(self): + * if cgraphLib.gp_ExtendWith_Planarity(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< + * raise RuntimeError("Failed to extend graph with Planarity structures.") + * +*/ + __pyx_t_1 = (gp_ExtendWith_Planarity(__pyx_v_self->_theGraph) != OK); + if (unlikely(__pyx_t_1)) { + + /* "planarity/full/graph.pyx":260 + * def gp_ExtendWith_Planarity(self): + * if cgraphLib.gp_ExtendWith_Planarity(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with Planarity structures.") # <<<<<<<<<<<<<< + * + * def gp_ExtendWith_DrawPlanar(self): +*/ + __pyx_t_3 = NULL; + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Failed_to_extend_graph_with_Plan}; + __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, 260, __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, 260, __pyx_L1_error) + + /* "planarity/full/graph.pyx":259 + * + * def gp_ExtendWith_Planarity(self): + * if cgraphLib.gp_ExtendWith_Planarity(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< + * raise RuntimeError("Failed to extend graph with Planarity structures.") + * +*/ + } + + /* "planarity/full/graph.pyx":258 + * return cgraphLib.gp_DeleteEdge(self._theGraph, e) + * + * def gp_ExtendWith_Planarity(self): # <<<<<<<<<<<<<< + * if cgraphLib.gp_ExtendWith_Planarity(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with Planarity structures.") +*/ + + /* 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.graph.Graph.gp_ExtendWith_Planarity", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "planarity/full/graph.pyx":262 + * raise RuntimeError("Failed to extend graph with Planarity structures.") + * + * def gp_ExtendWith_DrawPlanar(self): # <<<<<<<<<<<<<< + * if cgraphLib.gp_ExtendWith_DrawPlanar(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with DrawPlanar structures.") +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_59gp_ExtendWith_DrawPlanar(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_58gp_ExtendWith_DrawPlanar, "Graph.gp_ExtendWith_DrawPlanar(self)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_59gp_ExtendWith_DrawPlanar = {"gp_ExtendWith_DrawPlanar", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_59gp_ExtendWith_DrawPlanar, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_58gp_ExtendWith_DrawPlanar}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_59gp_ExtendWith_DrawPlanar(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("gp_ExtendWith_DrawPlanar (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("gp_ExtendWith_DrawPlanar", 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_ExtendWith_DrawPlanar", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_58gp_ExtendWith_DrawPlanar(((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_58gp_ExtendWith_DrawPlanar(struct __pyx_obj_9planarity_4full_5graph_Graph *__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("gp_ExtendWith_DrawPlanar", 0); + + /* "planarity/full/graph.pyx":263 + * + * def gp_ExtendWith_DrawPlanar(self): + * if cgraphLib.gp_ExtendWith_DrawPlanar(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< + * raise RuntimeError("Failed to extend graph with DrawPlanar structures.") + * +*/ + __pyx_t_1 = (gp_ExtendWith_DrawPlanar(__pyx_v_self->_theGraph) != OK); + if (unlikely(__pyx_t_1)) { + + /* "planarity/full/graph.pyx":264 + * def gp_ExtendWith_DrawPlanar(self): + * if cgraphLib.gp_ExtendWith_DrawPlanar(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with DrawPlanar structures.") # <<<<<<<<<<<<<< + * + * def gp_DrawPlanar_RenderToFile(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_Failed_to_extend_graph_with_Draw}; + __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, 264, __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, 264, __pyx_L1_error) + + /* "planarity/full/graph.pyx":263 + * + * def gp_ExtendWith_DrawPlanar(self): + * if cgraphLib.gp_ExtendWith_DrawPlanar(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< + * raise RuntimeError("Failed to extend graph with DrawPlanar structures.") + * +*/ + } + + /* "planarity/full/graph.pyx":262 + * raise RuntimeError("Failed to extend graph with Planarity structures.") + * + * def gp_ExtendWith_DrawPlanar(self): # <<<<<<<<<<<<<< + * if cgraphLib.gp_ExtendWith_DrawPlanar(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with DrawPlanar structures.") +*/ + + /* 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.graph.Graph.gp_ExtendWith_DrawPlanar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "planarity/full/graph.pyx":266 + * raise RuntimeError("Failed to extend graph with DrawPlanar structures.") + * + * def gp_DrawPlanar_RenderToFile(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_5graph_5Graph_61gp_DrawPlanar_RenderToFile(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_60gp_DrawPlanar_RenderToFile, "Graph.gp_DrawPlanar_RenderToFile(self, str outfile_name)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_61gp_DrawPlanar_RenderToFile = {"gp_DrawPlanar_RenderToFile", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_61gp_DrawPlanar_RenderToFile, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_60gp_DrawPlanar_RenderToFile}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_61gp_DrawPlanar_RenderToFile(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("gp_DrawPlanar_RenderToFile (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, 266, __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, 266, __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_DrawPlanar_RenderToFile", 0) < (0)) __PYX_ERR(0, 266, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_DrawPlanar_RenderToFile", 1, 1, 1, i); __PYX_ERR(0, 266, __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, 266, __pyx_L3_error) + } + __pyx_v_outfile_name = ((PyObject*)values[0]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("gp_DrawPlanar_RenderToFile", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 266, __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_DrawPlanar_RenderToFile", __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, 266, __pyx_L1_error) + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_60gp_DrawPlanar_RenderToFile(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__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_5graph_5Graph_60gp_DrawPlanar_RenderToFile(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, PyObject *__pyx_v_outfile_name) { + PyObject *__pyx_v_encoded = 0; + char const *__pyx_v_theFileName; + 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; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6[3]; + PyObject *__pyx_t_7 = NULL; + size_t __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("gp_DrawPlanar_RenderToFile", 0); + + /* "planarity/full/graph.pyx":268 + * def gp_DrawPlanar_RenderToFile(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 *theFileName = encoded + * +*/ + if (unlikely(__pyx_v_outfile_name == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); + __PYX_ERR(0, 268, __pyx_L1_error) + } + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_outfile_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_encoded = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "planarity/full/graph.pyx":269 + * # Convert Python str to UTF-8 encoded bytes, and then to const char * + * cdef bytes encoded = outfile_name.encode('utf-8') + * cdef const char *theFileName = encoded # <<<<<<<<<<<<<< + * + * if cgraphLib.gp_DrawPlanar_RenderToFile(self._theGraph, theFileName) != cappconst.OK: +*/ + __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_encoded); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 269, __pyx_L1_error) + __pyx_v_theFileName = __pyx_t_2; + + /* "planarity/full/graph.pyx":271 + * cdef const char *theFileName = encoded + * + * if cgraphLib.gp_DrawPlanar_RenderToFile(self._theGraph, theFileName) != cappconst.OK: # <<<<<<<<<<<<<< + * raise RuntimeError(f"Failed to render embedding to file '{outfile_name}'.") + * +*/ + __pyx_t_3 = (gp_DrawPlanar_RenderToFile(__pyx_v_self->_theGraph, __pyx_v_theFileName) != OK); + if (unlikely(__pyx_t_3)) { + + /* "planarity/full/graph.pyx":272 + * + * if cgraphLib.gp_DrawPlanar_RenderToFile(self._theGraph, theFileName) != cappconst.OK: + * raise RuntimeError(f"Failed to render embedding to file '{outfile_name}'.") # <<<<<<<<<<<<<< + * + * def gp_DrawPlanar_RenderToString(self): +*/ + __pyx_t_4 = NULL; + __pyx_t_5 = __Pyx_PyUnicode_Unicode(__pyx_v_outfile_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 272, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_Failed_to_render_embedding_to_fi; + __pyx_t_6[1] = __pyx_t_5; + __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u_; + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 36 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 2, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5)); + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 272, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __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, 272, __pyx_L1_error) + + /* "planarity/full/graph.pyx":271 + * cdef const char *theFileName = encoded + * + * if cgraphLib.gp_DrawPlanar_RenderToFile(self._theGraph, theFileName) != cappconst.OK: # <<<<<<<<<<<<<< + * raise RuntimeError(f"Failed to render embedding to file '{outfile_name}'.") + * +*/ + } + + /* "planarity/full/graph.pyx":266 + * raise RuntimeError("Failed to extend graph with DrawPlanar structures.") + * + * def gp_DrawPlanar_RenderToFile(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_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DrawPlanar_RenderToFile", __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/graph.pyx":274 + * raise RuntimeError(f"Failed to render embedding to file '{outfile_name}'.") + * + * def gp_DrawPlanar_RenderToString(self): # <<<<<<<<<<<<<< + * cdef char* renditionString = NULL + * if cgraphLib.gp_DrawPlanar_RenderToString(self._theGraph, &renditionString) != OK: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_63gp_DrawPlanar_RenderToString(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_62gp_DrawPlanar_RenderToString, "Graph.gp_DrawPlanar_RenderToString(self)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_63gp_DrawPlanar_RenderToString = {"gp_DrawPlanar_RenderToString", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_63gp_DrawPlanar_RenderToString, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_62gp_DrawPlanar_RenderToString}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_63gp_DrawPlanar_RenderToString(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("gp_DrawPlanar_RenderToString (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("gp_DrawPlanar_RenderToString", 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_DrawPlanar_RenderToString", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_62gp_DrawPlanar_RenderToString(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ - 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_RefNannyFinishContext(); 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_62gp_DrawPlanar_RenderToString(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { + char *__pyx_v_renditionString; + PyObject *__pyx_v_string_conversion_error = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - size_t __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - PyObject *__pyx_t_7[3]; + int __pyx_t_4; + size_t __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_t_13; + char const *__pyx_t_14; + PyObject *__pyx_t_15 = NULL; + PyObject *__pyx_t_16 = NULL; + PyObject *__pyx_t_17 = NULL; + PyObject *__pyx_t_18 = NULL; + PyObject *__pyx_t_19 = NULL; + PyObject *__pyx_t_20 = NULL; + char const *__pyx_t_21; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("gp_DeleteEdge", 0); + __Pyx_RefNannySetupContext("gp_DrawPlanar_RenderToString", 0); - /* "planarity/full/graph.pyx":231 + /* "planarity/full/graph.pyx":275 * - * def gp_DeleteEdge(self, int e, int nextLink): - * if not self.gp_IsArc(e): # <<<<<<<<<<<<<< - * raise RuntimeError( - * f"gp_DeleteEdge() failed: invalid arc '{e}'." + * def gp_DrawPlanar_RenderToString(self): + * cdef char* renditionString = NULL # <<<<<<<<<<<<<< + * if cgraphLib.gp_DrawPlanar_RenderToString(self._theGraph, &renditionString) != OK: + * raise RuntimeError(f"Failed to render embedding to C string.") */ - __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_GOTREF(__pyx_t_3); - __pyx_t_4 = 0; - { - PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; - __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) - __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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = (!__pyx_t_5); - if (unlikely(__pyx_t_6)) { + __pyx_v_renditionString = NULL; - /* "planarity/full/graph.pyx":232 - * def gp_DeleteEdge(self, int e, int nextLink): - * if not self.gp_IsArc(e): - * raise RuntimeError( # <<<<<<<<<<<<<< - * f"gp_DeleteEdge() failed: invalid arc '{e}'." - * ) + /* "planarity/full/graph.pyx":276 + * def gp_DrawPlanar_RenderToString(self): + * cdef char* renditionString = NULL + * if cgraphLib.gp_DrawPlanar_RenderToString(self._theGraph, &renditionString) != OK: # <<<<<<<<<<<<<< + * raise RuntimeError(f"Failed to render embedding to C string.") + * */ - __pyx_t_3 = NULL; + __pyx_t_1 = __Pyx_PyLong_From_int(gp_DrawPlanar_RenderToString(__pyx_v_self->_theGraph, (&__pyx_v_renditionString))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 276, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 276, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 276, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 276, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(__pyx_t_4)) { - /* "planarity/full/graph.pyx":233 - * if not self.gp_IsArc(e): - * raise RuntimeError( - * f"gp_DeleteEdge() failed: invalid arc '{e}'." # <<<<<<<<<<<<<< - * ) - * if nextLink != 0 and nextLink != 1: + /* "planarity/full/graph.pyx":277 + * cdef char* renditionString = NULL + * if cgraphLib.gp_DrawPlanar_RenderToString(self._theGraph, &renditionString) != OK: + * raise RuntimeError(f"Failed to render embedding to C string.") # <<<<<<<<<<<<<< + * + * try: */ - __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_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) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = 1; + __pyx_t_2 = NULL; + __pyx_t_5 = 1; { - PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_8}; - __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) - __Pyx_GOTREF(__pyx_t_1); + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Failed_to_render_embedding_to_C}; + __pyx_t_3 = __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_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 277, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); } - __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_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 277, __pyx_L1_error) - /* "planarity/full/graph.pyx":231 + /* "planarity/full/graph.pyx":276 + * def gp_DrawPlanar_RenderToString(self): + * cdef char* renditionString = NULL + * if cgraphLib.gp_DrawPlanar_RenderToString(self._theGraph, &renditionString) != OK: # <<<<<<<<<<<<<< + * raise RuntimeError(f"Failed to render embedding to C string.") * - * def gp_DeleteEdge(self, int e, int nextLink): - * 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: # <<<<<<<<<<<<<< + /* "planarity/full/graph.pyx":279 + * raise RuntimeError(f"Failed to render embedding to C string.") + * + * try: # <<<<<<<<<<<<<< + * return renditionString.decode('ascii') + * except Exception as string_conversion_error: +*/ + /*try:*/ { + { + __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/graph.pyx":280 + * + * try: + * return renditionString.decode('ascii') # <<<<<<<<<<<<<< + * except Exception as string_conversion_error: * 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)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_9 = __Pyx_ssize_strlen(__pyx_v_renditionString); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 280, __pyx_L7_error) + __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_renditionString, 0, __pyx_t_9, NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 280, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L11_try_return; - /* "planarity/full/graph.pyx":236 - * ) - * if nextLink != 0 and nextLink != 1: - * raise RuntimeError( # <<<<<<<<<<<<<< - * f"Invalid link index for nextLink: '{nextLink}'." - * ) + /* "planarity/full/graph.pyx":279 + * raise RuntimeError(f"Failed to render embedding to C string.") + * + * try: # <<<<<<<<<<<<<< + * return renditionString.decode('ascii') + * except Exception as string_conversion_error: */ - __pyx_t_8 = NULL; + } + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":237 - * if nextLink != 0 and nextLink != 1: + /* "planarity/full/graph.pyx":281 + * try: + * return renditionString.decode('ascii') + * except Exception as string_conversion_error: # <<<<<<<<<<<<<< * 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) + * "Failed to convert C string to Python string." +*/ + __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_10) { + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DrawPlanar_RenderToString", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 281, __pyx_L9_except_error) + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_string_conversion_error = __pyx_t_2; + /*try:*/ { + + /* "planarity/full/graph.pyx":282 + * return renditionString.decode('ascii') + * except Exception as string_conversion_error: + * raise RuntimeError( # <<<<<<<<<<<<<< + * "Failed to convert C string to Python string." + * ) from string_conversion_error +*/ + __pyx_t_12 = NULL; + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_mstate_global->__pyx_kp_u_Failed_to_convert_C_string_to_Py}; + __pyx_t_11 = __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_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 282, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_11); + } - /* "planarity/full/graph.pyx":235 - * f"gp_DeleteEdge() failed: invalid arc '{e}'." - * ) - * if nextLink != 0 and nextLink != 1: # <<<<<<<<<<<<<< + /* "planarity/full/graph.pyx":284 * raise RuntimeError( - * f"Invalid link index for nextLink: '{nextLink}'." -*/ + * "Failed to convert C string to Python string." + * ) from string_conversion_error # <<<<<<<<<<<<<< + * finally: + * free(renditionString) +*/ + __Pyx_Raise(__pyx_t_11, 0, 0, __pyx_v_string_conversion_error); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __PYX_ERR(0, 282, __pyx_L18_error) + } + + /* "planarity/full/graph.pyx":281 + * try: + * return renditionString.decode('ascii') + * except Exception as string_conversion_error: # <<<<<<<<<<<<<< + * raise RuntimeError( + * "Failed to convert C string to Python string." +*/ + /*finally:*/ { + __pyx_L18_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_10 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename; + { + __Pyx_DECREF(__pyx_v_string_conversion_error); __pyx_v_string_conversion_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_10; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14; + goto __pyx_L9_except_error; + } + } + } + goto __pyx_L9_except_error; + + /* "planarity/full/graph.pyx":279 + * raise RuntimeError(f"Failed to render embedding to C string.") + * + * try: # <<<<<<<<<<<<<< + * return renditionString.decode('ascii') + * except Exception as string_conversion_error: +*/ + __pyx_L9_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_L5_error; + __pyx_L11_try_return:; + __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_L4_return; + } } - /* "planarity/full/graph.pyx":240 - * ) - * - * return cgraphLib.gp_DeleteEdge(self._theGraph, e, nextLink) # <<<<<<<<<<<<<< - * - * 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_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + /* "planarity/full/graph.pyx":286 + * ) from string_conversion_error + * finally: + * free(renditionString) # <<<<<<<<<<<<<< + * + * def gp_ExtendWith_Outerplanarity(self): +*/ + /*finally:*/ { + __pyx_L5_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_ExceptionSwap(&__pyx_t_20, &__pyx_t_19, &__pyx_t_18); + if ( unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_20); + __Pyx_XGOTREF(__pyx_t_19); + __Pyx_XGOTREF(__pyx_t_18); + __pyx_t_13 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_21 = __pyx_filename; + { + free(__pyx_v_renditionString); + } + __Pyx_XGIVEREF(__pyx_t_20); + __Pyx_XGIVEREF(__pyx_t_19); + __Pyx_XGIVEREF(__pyx_t_18); + __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_19, __pyx_t_18); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_ErrRestore(__pyx_t_8, __pyx_t_7, __pyx_t_6); + __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0; + __pyx_lineno = __pyx_t_13; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_21; + goto __pyx_L1_error; + } + __pyx_L4_return: { + __pyx_t_18 = __pyx_r; + __pyx_r = 0; + free(__pyx_v_renditionString); + __pyx_r = __pyx_t_18; + __pyx_t_18 = 0; + goto __pyx_L0; + } + } - /* "planarity/full/graph.pyx":230 - * ) + /* "planarity/full/graph.pyx":274 + * raise RuntimeError(f"Failed to render embedding to file '{outfile_name}'.") * - * def gp_DeleteEdge(self, int e, int nextLink): # <<<<<<<<<<<<<< - * if not self.gp_IsArc(e): - * raise RuntimeError( + * def gp_DrawPlanar_RenderToString(self): # <<<<<<<<<<<<<< + * cdef char* renditionString = NULL + * if cgraphLib.gp_DrawPlanar_RenderToString(self._theGraph, &renditionString) != OK: */ /* function exit code */ @@ -8116,34 +9262,36 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_56gp_DeleteEdge(struct __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DeleteEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DrawPlanar_RenderToString", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_string_conversion_error); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "planarity/full/graph.pyx":242 - * return cgraphLib.gp_DeleteEdge(self._theGraph, e, nextLink) +/* "planarity/full/graph.pyx":288 + * free(renditionString) * - * def gp_AttachDrawPlanar(self): # <<<<<<<<<<<<<< - * if cgraphLib.gp_AttachDrawPlanar(self._theGraph) != cappconst.OK: - * raise RuntimeError("Failed to attach DrawPlanar algorithm.") + * def gp_ExtendWith_Outerplanarity(self): # <<<<<<<<<<<<<< + * if cgraphLib.gp_ExtendWith_Outerplanarity(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with Outerplanarity structures.") */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_59gp_AttachDrawPlanar(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_65gp_ExtendWith_Outerplanarity(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_58gp_AttachDrawPlanar, "Graph.gp_AttachDrawPlanar(self)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_59gp_AttachDrawPlanar = {"gp_AttachDrawPlanar", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_59gp_AttachDrawPlanar, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_58gp_AttachDrawPlanar}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_59gp_AttachDrawPlanar(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_64gp_ExtendWith_Outerplanarity, "Graph.gp_ExtendWith_Outerplanarity(self)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_65gp_ExtendWith_Outerplanarity = {"gp_ExtendWith_Outerplanarity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_65gp_ExtendWith_Outerplanarity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_64gp_ExtendWith_Outerplanarity}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_65gp_ExtendWith_Outerplanarity(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -8156,7 +9304,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("gp_AttachDrawPlanar (wrapper)", 0); + __Pyx_RefNannySetupContext("gp_ExtendWith_Outerplanarity (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -8165,18 +9313,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_AttachDrawPlanar", 1, 0, 0, __pyx_nargs); return NULL; } + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_ExtendWith_Outerplanarity", 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_AttachDrawPlanar", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_58gp_AttachDrawPlanar(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_ExtendWith_Outerplanarity", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_64gp_ExtendWith_Outerplanarity(((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_58gp_AttachDrawPlanar(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_64gp_ExtendWith_Outerplanarity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -8186,53 +9334,53 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_58gp_AttachDrawPlanar(s int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("gp_AttachDrawPlanar", 0); + __Pyx_RefNannySetupContext("gp_ExtendWith_Outerplanarity", 0); - /* "planarity/full/graph.pyx":243 + /* "planarity/full/graph.pyx":289 * - * def gp_AttachDrawPlanar(self): - * if cgraphLib.gp_AttachDrawPlanar(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< - * raise RuntimeError("Failed to attach DrawPlanar algorithm.") + * def gp_ExtendWith_Outerplanarity(self): + * if cgraphLib.gp_ExtendWith_Outerplanarity(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< + * raise RuntimeError("Failed to extend graph with Outerplanarity structures.") * */ - __pyx_t_1 = (gp_AttachDrawPlanar(__pyx_v_self->_theGraph) != OK); + __pyx_t_1 = (gp_ExtendWith_Outerplanarity(__pyx_v_self->_theGraph) != OK); if (unlikely(__pyx_t_1)) { - /* "planarity/full/graph.pyx":244 - * def gp_AttachDrawPlanar(self): - * if cgraphLib.gp_AttachDrawPlanar(self._theGraph) != cappconst.OK: - * raise RuntimeError("Failed to attach DrawPlanar algorithm.") # <<<<<<<<<<<<<< + /* "planarity/full/graph.pyx":290 + * def gp_ExtendWith_Outerplanarity(self): + * if cgraphLib.gp_ExtendWith_Outerplanarity(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with Outerplanarity structures.") # <<<<<<<<<<<<<< * - * def gp_AttachK23Search(self): + * def gp_ExtendWith_K23Search(self): */ __pyx_t_3 = NULL; __pyx_t_4 = 1; { - PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Failed_to_attach_DrawPlanar_algo}; + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Failed_to_extend_graph_with_Oute}; __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, 290, __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, 290, __pyx_L1_error) - /* "planarity/full/graph.pyx":243 + /* "planarity/full/graph.pyx":289 * - * def gp_AttachDrawPlanar(self): - * if cgraphLib.gp_AttachDrawPlanar(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< - * raise RuntimeError("Failed to attach DrawPlanar algorithm.") + * def gp_ExtendWith_Outerplanarity(self): + * if cgraphLib.gp_ExtendWith_Outerplanarity(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< + * raise RuntimeError("Failed to extend graph with Outerplanarity structures.") * */ } - /* "planarity/full/graph.pyx":242 - * return cgraphLib.gp_DeleteEdge(self._theGraph, e, nextLink) + /* "planarity/full/graph.pyx":288 + * free(renditionString) * - * def gp_AttachDrawPlanar(self): # <<<<<<<<<<<<<< - * if cgraphLib.gp_AttachDrawPlanar(self._theGraph) != cappconst.OK: - * raise RuntimeError("Failed to attach DrawPlanar algorithm.") + * def gp_ExtendWith_Outerplanarity(self): # <<<<<<<<<<<<<< + * if cgraphLib.gp_ExtendWith_Outerplanarity(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with Outerplanarity structures.") */ /* function exit code */ @@ -8241,7 +9389,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_58gp_AttachDrawPlanar(s __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("planarity.full.graph.Graph.gp_AttachDrawPlanar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ExtendWith_Outerplanarity", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -8249,25 +9397,25 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_58gp_AttachDrawPlanar(s return __pyx_r; } -/* "planarity/full/graph.pyx":246 - * raise RuntimeError("Failed to attach DrawPlanar algorithm.") +/* "planarity/full/graph.pyx":292 + * raise RuntimeError("Failed to extend graph with Outerplanarity structures.") * - * def gp_AttachK23Search(self): # <<<<<<<<<<<<<< - * if cgraphLib.gp_AttachK23Search(self._theGraph) != cappconst.OK: - * raise RuntimeError("Failed to attach K23Search algorithm.") + * def gp_ExtendWith_K23Search(self): # <<<<<<<<<<<<<< + * if cgraphLib.gp_ExtendWith_K23Search(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with K23Search structures.") */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_61gp_AttachK23Search(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_67gp_ExtendWith_K23Search(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_60gp_AttachK23Search, "Graph.gp_AttachK23Search(self)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_61gp_AttachK23Search = {"gp_AttachK23Search", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_61gp_AttachK23Search, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_60gp_AttachK23Search}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_61gp_AttachK23Search(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_66gp_ExtendWith_K23Search, "Graph.gp_ExtendWith_K23Search(self)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_67gp_ExtendWith_K23Search = {"gp_ExtendWith_K23Search", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_67gp_ExtendWith_K23Search, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_66gp_ExtendWith_K23Search}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_67gp_ExtendWith_K23Search(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -8280,7 +9428,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("gp_AttachK23Search (wrapper)", 0); + __Pyx_RefNannySetupContext("gp_ExtendWith_K23Search (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -8289,18 +9437,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_AttachK23Search", 1, 0, 0, __pyx_nargs); return NULL; } + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_ExtendWith_K23Search", 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_AttachK23Search", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_60gp_AttachK23Search(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_ExtendWith_K23Search", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_66gp_ExtendWith_K23Search(((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_60gp_AttachK23Search(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_66gp_ExtendWith_K23Search(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -8310,53 +9458,53 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_60gp_AttachK23Search(st int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("gp_AttachK23Search", 0); + __Pyx_RefNannySetupContext("gp_ExtendWith_K23Search", 0); - /* "planarity/full/graph.pyx":247 + /* "planarity/full/graph.pyx":293 * - * def gp_AttachK23Search(self): - * if cgraphLib.gp_AttachK23Search(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< - * raise RuntimeError("Failed to attach K23Search algorithm.") + * def gp_ExtendWith_K23Search(self): + * if cgraphLib.gp_ExtendWith_K23Search(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< + * raise RuntimeError("Failed to extend graph with K23Search structures.") * */ - __pyx_t_1 = (gp_AttachK23Search(__pyx_v_self->_theGraph) != OK); + __pyx_t_1 = (gp_ExtendWith_K23Search(__pyx_v_self->_theGraph) != OK); if (unlikely(__pyx_t_1)) { - /* "planarity/full/graph.pyx":248 - * def gp_AttachK23Search(self): - * if cgraphLib.gp_AttachK23Search(self._theGraph) != cappconst.OK: - * raise RuntimeError("Failed to attach K23Search algorithm.") # <<<<<<<<<<<<<< + /* "planarity/full/graph.pyx":294 + * def gp_ExtendWith_K23Search(self): + * if cgraphLib.gp_ExtendWith_K23Search(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with K23Search structures.") # <<<<<<<<<<<<<< * - * def gp_AttachK33Search(self): + * def gp_ExtendWith_K33Search(self): */ __pyx_t_3 = NULL; __pyx_t_4 = 1; { - PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Failed_to_attach_K23Search_algor}; + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Failed_to_extend_graph_with_K23S}; __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, 294, __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, 294, __pyx_L1_error) - /* "planarity/full/graph.pyx":247 + /* "planarity/full/graph.pyx":293 * - * def gp_AttachK23Search(self): - * if cgraphLib.gp_AttachK23Search(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< - * raise RuntimeError("Failed to attach K23Search algorithm.") + * def gp_ExtendWith_K23Search(self): + * if cgraphLib.gp_ExtendWith_K23Search(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< + * raise RuntimeError("Failed to extend graph with K23Search structures.") * */ } - /* "planarity/full/graph.pyx":246 - * raise RuntimeError("Failed to attach DrawPlanar algorithm.") + /* "planarity/full/graph.pyx":292 + * raise RuntimeError("Failed to extend graph with Outerplanarity structures.") * - * def gp_AttachK23Search(self): # <<<<<<<<<<<<<< - * if cgraphLib.gp_AttachK23Search(self._theGraph) != cappconst.OK: - * raise RuntimeError("Failed to attach K23Search algorithm.") + * def gp_ExtendWith_K23Search(self): # <<<<<<<<<<<<<< + * if cgraphLib.gp_ExtendWith_K23Search(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with K23Search structures.") */ /* function exit code */ @@ -8365,7 +9513,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_60gp_AttachK23Search(st __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("planarity.full.graph.Graph.gp_AttachK23Search", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ExtendWith_K23Search", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -8373,25 +9521,25 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_60gp_AttachK23Search(st return __pyx_r; } -/* "planarity/full/graph.pyx":250 - * raise RuntimeError("Failed to attach K23Search algorithm.") +/* "planarity/full/graph.pyx":296 + * raise RuntimeError("Failed to extend graph with K23Search structures.") * - * def gp_AttachK33Search(self): # <<<<<<<<<<<<<< - * if cgraphLib.gp_AttachK33Search(self._theGraph) != cappconst.OK: - * raise RuntimeError("Failed to attach K33Search algorithm.") + * def gp_ExtendWith_K33Search(self): # <<<<<<<<<<<<<< + * if cgraphLib.gp_ExtendWith_K33Search(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with K33Search structures.") */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_63gp_AttachK33Search(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_69gp_ExtendWith_K33Search(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_62gp_AttachK33Search, "Graph.gp_AttachK33Search(self)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_63gp_AttachK33Search = {"gp_AttachK33Search", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_63gp_AttachK33Search, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_62gp_AttachK33Search}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_63gp_AttachK33Search(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_68gp_ExtendWith_K33Search, "Graph.gp_ExtendWith_K33Search(self)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_69gp_ExtendWith_K33Search = {"gp_ExtendWith_K33Search", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_69gp_ExtendWith_K33Search, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_68gp_ExtendWith_K33Search}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_69gp_ExtendWith_K33Search(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -8404,7 +9552,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("gp_AttachK33Search (wrapper)", 0); + __Pyx_RefNannySetupContext("gp_ExtendWith_K33Search (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -8413,18 +9561,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_AttachK33Search", 1, 0, 0, __pyx_nargs); return NULL; } + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_ExtendWith_K33Search", 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_AttachK33Search", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_62gp_AttachK33Search(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_ExtendWith_K33Search", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_68gp_ExtendWith_K33Search(((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_62gp_AttachK33Search(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_68gp_ExtendWith_K33Search(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -8434,53 +9582,53 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_62gp_AttachK33Search(st int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("gp_AttachK33Search", 0); + __Pyx_RefNannySetupContext("gp_ExtendWith_K33Search", 0); - /* "planarity/full/graph.pyx":251 + /* "planarity/full/graph.pyx":297 * - * def gp_AttachK33Search(self): - * if cgraphLib.gp_AttachK33Search(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< - * raise RuntimeError("Failed to attach K33Search algorithm.") + * def gp_ExtendWith_K33Search(self): + * if cgraphLib.gp_ExtendWith_K33Search(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< + * raise RuntimeError("Failed to extend graph with K33Search structures.") * */ - __pyx_t_1 = (gp_AttachK33Search(__pyx_v_self->_theGraph) != OK); + __pyx_t_1 = (gp_ExtendWith_K33Search(__pyx_v_self->_theGraph) != OK); if (unlikely(__pyx_t_1)) { - /* "planarity/full/graph.pyx":252 - * def gp_AttachK33Search(self): - * if cgraphLib.gp_AttachK33Search(self._theGraph) != cappconst.OK: - * raise RuntimeError("Failed to attach K33Search algorithm.") # <<<<<<<<<<<<<< + /* "planarity/full/graph.pyx":298 + * def gp_ExtendWith_K33Search(self): + * if cgraphLib.gp_ExtendWith_K33Search(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with K33Search structures.") # <<<<<<<<<<<<<< * - * def gp_AttachK4Search(self): + * def gp_ExtendWith_K4Search(self): */ __pyx_t_3 = NULL; __pyx_t_4 = 1; { - PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Failed_to_attach_K33Search_algor}; + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Failed_to_extend_graph_with_K33S}; __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, 298, __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, 298, __pyx_L1_error) - /* "planarity/full/graph.pyx":251 + /* "planarity/full/graph.pyx":297 * - * def gp_AttachK33Search(self): - * if cgraphLib.gp_AttachK33Search(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< - * raise RuntimeError("Failed to attach K33Search algorithm.") + * def gp_ExtendWith_K33Search(self): + * if cgraphLib.gp_ExtendWith_K33Search(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< + * raise RuntimeError("Failed to extend graph with K33Search structures.") * */ } - /* "planarity/full/graph.pyx":250 - * raise RuntimeError("Failed to attach K23Search algorithm.") + /* "planarity/full/graph.pyx":296 + * raise RuntimeError("Failed to extend graph with K23Search structures.") * - * def gp_AttachK33Search(self): # <<<<<<<<<<<<<< - * if cgraphLib.gp_AttachK33Search(self._theGraph) != cappconst.OK: - * raise RuntimeError("Failed to attach K33Search algorithm.") + * def gp_ExtendWith_K33Search(self): # <<<<<<<<<<<<<< + * if cgraphLib.gp_ExtendWith_K33Search(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with K33Search structures.") */ /* function exit code */ @@ -8489,7 +9637,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_62gp_AttachK33Search(st __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("planarity.full.graph.Graph.gp_AttachK33Search", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ExtendWith_K33Search", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -8497,25 +9645,25 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_62gp_AttachK33Search(st return __pyx_r; } -/* "planarity/full/graph.pyx":254 - * raise RuntimeError("Failed to attach K33Search algorithm.") +/* "planarity/full/graph.pyx":300 + * raise RuntimeError("Failed to extend graph with K33Search structures.") * - * def gp_AttachK4Search(self): # <<<<<<<<<<<<<< - * if cgraphLib.gp_AttachK4Search(self._theGraph) != cappconst.OK: - * raise RuntimeError("Failed to attach K4Search algorithm.") + * def gp_ExtendWith_K4Search(self): # <<<<<<<<<<<<<< + * if cgraphLib.gp_ExtendWith_K4Search(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with K4Search structures.") */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_65gp_AttachK4Search(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_71gp_ExtendWith_K4Search(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_64gp_AttachK4Search, "Graph.gp_AttachK4Search(self)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_65gp_AttachK4Search = {"gp_AttachK4Search", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_65gp_AttachK4Search, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_64gp_AttachK4Search}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_65gp_AttachK4Search(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_70gp_ExtendWith_K4Search, "Graph.gp_ExtendWith_K4Search(self)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_71gp_ExtendWith_K4Search = {"gp_ExtendWith_K4Search", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_71gp_ExtendWith_K4Search, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_70gp_ExtendWith_K4Search}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_71gp_ExtendWith_K4Search(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -8528,7 +9676,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("gp_AttachK4Search (wrapper)", 0); + __Pyx_RefNannySetupContext("gp_ExtendWith_K4Search (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -8537,18 +9685,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_AttachK4Search", 1, 0, 0, __pyx_nargs); return NULL; } + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_ExtendWith_K4Search", 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_AttachK4Search", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_64gp_AttachK4Search(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_ExtendWith_K4Search", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_70gp_ExtendWith_K4Search(((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_64gp_AttachK4Search(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_70gp_ExtendWith_K4Search(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -8558,53 +9706,53 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_64gp_AttachK4Search(str int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("gp_AttachK4Search", 0); + __Pyx_RefNannySetupContext("gp_ExtendWith_K4Search", 0); - /* "planarity/full/graph.pyx":255 + /* "planarity/full/graph.pyx":301 * - * def gp_AttachK4Search(self): - * if cgraphLib.gp_AttachK4Search(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< - * raise RuntimeError("Failed to attach K4Search algorithm.") + * def gp_ExtendWith_K4Search(self): + * if cgraphLib.gp_ExtendWith_K4Search(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< + * raise RuntimeError("Failed to extend graph with K4Search structures.") * */ - __pyx_t_1 = (gp_AttachK4Search(__pyx_v_self->_theGraph) != OK); + __pyx_t_1 = (gp_ExtendWith_K4Search(__pyx_v_self->_theGraph) != OK); if (unlikely(__pyx_t_1)) { - /* "planarity/full/graph.pyx":256 - * def gp_AttachK4Search(self): - * if cgraphLib.gp_AttachK4Search(self._theGraph) != cappconst.OK: - * raise RuntimeError("Failed to attach K4Search algorithm.") # <<<<<<<<<<<<<< + /* "planarity/full/graph.pyx":302 + * def gp_ExtendWith_K4Search(self): + * if cgraphLib.gp_ExtendWith_K4Search(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with K4Search structures.") # <<<<<<<<<<<<<< * * def gp_Embed(self, int embedFlags) -> int: */ __pyx_t_3 = NULL; __pyx_t_4 = 1; { - PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Failed_to_attach_K4Search_algori}; + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Failed_to_extend_graph_with_K4Se}; __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, 302, __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, 302, __pyx_L1_error) - /* "planarity/full/graph.pyx":255 + /* "planarity/full/graph.pyx":301 * - * def gp_AttachK4Search(self): - * if cgraphLib.gp_AttachK4Search(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< - * raise RuntimeError("Failed to attach K4Search algorithm.") + * def gp_ExtendWith_K4Search(self): + * if cgraphLib.gp_ExtendWith_K4Search(self._theGraph) != cappconst.OK: # <<<<<<<<<<<<<< + * raise RuntimeError("Failed to extend graph with K4Search structures.") * */ } - /* "planarity/full/graph.pyx":254 - * raise RuntimeError("Failed to attach K33Search algorithm.") + /* "planarity/full/graph.pyx":300 + * raise RuntimeError("Failed to extend graph with K33Search structures.") * - * def gp_AttachK4Search(self): # <<<<<<<<<<<<<< - * if cgraphLib.gp_AttachK4Search(self._theGraph) != cappconst.OK: - * raise RuntimeError("Failed to attach K4Search algorithm.") + * def gp_ExtendWith_K4Search(self): # <<<<<<<<<<<<<< + * if cgraphLib.gp_ExtendWith_K4Search(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with K4Search structures.") */ /* function exit code */ @@ -8613,7 +9761,7 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_64gp_AttachK4Search(str __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("planarity.full.graph.Graph.gp_AttachK4Search", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ExtendWith_K4Search", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -8621,8 +9769,8 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_64gp_AttachK4Search(str return __pyx_r; } -/* "planarity/full/graph.pyx":258 - * raise RuntimeError("Failed to attach K4Search algorithm.") +/* "planarity/full/graph.pyx":304 + * raise RuntimeError("Failed to extend graph with K4Search structures.") * * def gp_Embed(self, int embedFlags) -> int: # <<<<<<<<<<<<<< * return cgraphLib.gp_Embed(self._theGraph, embedFlags) @@ -8630,16 +9778,16 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_64gp_AttachK4Search(str */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_67gp_Embed(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_73gp_Embed(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_66gp_Embed, "Graph.gp_Embed(self, int embedFlags) -> int"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_67gp_Embed = {"gp_Embed", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_67gp_Embed, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_66gp_Embed}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_67gp_Embed(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_72gp_Embed, "Graph.gp_Embed(self, int embedFlags) -> int"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_73gp_Embed = {"gp_Embed", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_73gp_Embed, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_72gp_Embed}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_73gp_Embed(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -8669,32 +9817,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, 304, __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, 304, __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, 304, __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, 304, __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, 304, __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, 304, __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, 304, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -8705,7 +9853,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_66gp_Embed(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_embedFlags); + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_72gp_Embed(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_embedFlags); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { @@ -8715,7 +9863,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_66gp_Embed(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_embedFlags) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_72gp_Embed(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_embedFlags) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -8724,7 +9872,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":305 * * def gp_Embed(self, int embedFlags) -> int: * return cgraphLib.gp_Embed(self._theGraph, embedFlags) # <<<<<<<<<<<<<< @@ -8732,15 +9880,15 @@ 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, 305, __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, 305, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "planarity/full/graph.pyx":258 - * raise RuntimeError("Failed to attach K4Search algorithm.") + /* "planarity/full/graph.pyx":304 + * raise RuntimeError("Failed to extend graph with K4Search structures.") * * def gp_Embed(self, int embedFlags) -> int: # <<<<<<<<<<<<<< * return cgraphLib.gp_Embed(self._theGraph, embedFlags) @@ -8758,7 +9906,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":307 * return cgraphLib.gp_Embed(self._theGraph, embedFlags) * * def gp_TestEmbedResultIntegrity(self, Graph copy_of_orig_graph, int embed_result) -> int: # <<<<<<<<<<<<<< @@ -8766,16 +9914,16 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_66gp_Embed(struct __pyx */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_69gp_TestEmbedResultIntegrity(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_75gp_TestEmbedResultIntegrity(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_68gp_TestEmbedResultIntegrity, "Graph.gp_TestEmbedResultIntegrity(self, Graph copy_of_orig_graph, int embed_result) -> int"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_69gp_TestEmbedResultIntegrity = {"gp_TestEmbedResultIntegrity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_69gp_TestEmbedResultIntegrity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_68gp_TestEmbedResultIntegrity}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_69gp_TestEmbedResultIntegrity(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_74gp_TestEmbedResultIntegrity, "Graph.gp_TestEmbedResultIntegrity(self, Graph copy_of_orig_graph, int embed_result) -> int"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_75gp_TestEmbedResultIntegrity = {"gp_TestEmbedResultIntegrity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_75gp_TestEmbedResultIntegrity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_74gp_TestEmbedResultIntegrity}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_75gp_TestEmbedResultIntegrity(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -8806,39 +9954,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, 307, __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, 307, __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, 307, __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, 307, __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, 307, __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, 307, __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, 307, __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, 307, __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, 307, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -8849,8 +9997,8 @@ 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) - __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); + 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, 307, __pyx_L1_error) + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_74gp_TestEmbedResultIntegrity(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_copy_of_orig_graph, __pyx_v_embed_result); /* function exit code */ goto __pyx_L0; @@ -8869,7 +10017,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_68gp_TestEmbedResultIntegrity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_copy_of_orig_graph, int __pyx_v_embed_result) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_74gp_TestEmbedResultIntegrity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_copy_of_orig_graph, int __pyx_v_embed_result) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -8878,20 +10026,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":308 * * 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, 308, __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, 308, __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":307 * return cgraphLib.gp_Embed(self._theGraph, embedFlags) * * def gp_TestEmbedResultIntegrity(self, Graph copy_of_orig_graph, int embed_result) -> int: # <<<<<<<<<<<<<< @@ -8916,16 +10064,16 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_68gp_TestEmbedResultInt */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_71__reduce_cython__(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_77__reduce_cython__(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_70__reduce_cython__, "Graph.__reduce_cython__(self)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_71__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_71__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_70__reduce_cython__}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_71__reduce_cython__(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_76__reduce_cython__, "Graph.__reduce_cython__(self)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_77__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_77__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_76__reduce_cython__}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_77__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -8951,14 +10099,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("__reduce_cython__", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_70__reduce_cython__(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_76__reduce_cython__(((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_70__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_76__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; @@ -8998,16 +10146,16 @@ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_70__reduce_cython__(CYT */ /* Python wrapper */ -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_73__setstate_cython__(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_79__setstate_cython__(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_72__setstate_cython__, "Graph.__setstate_cython__(self, __pyx_state)"); -static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_73__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_73__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_72__setstate_cython__}; -static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_73__setstate_cython__(PyObject *__pyx_v_self, +PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_78__setstate_cython__, "Graph.__setstate_cython__(self, __pyx_state)"); +static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_79__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_79__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_78__setstate_cython__}; +static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_79__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -9073,7 +10221,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_72__setstate_cython__(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v___pyx_state); + __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_78__setstate_cython__(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { @@ -9083,7 +10231,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_72__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_78__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; @@ -9158,41 +10306,44 @@ static void __pyx_tp_dealloc_9planarity_4full_5graph_Graph(PyObject *o) { } static PyMethodDef __pyx_methods_9planarity_4full_5graph_Graph[] = { - {"is_graph_NULL", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_5is_graph_NULL, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_4is_graph_NULL}, - {"get_wrapper_for_graphP", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_7get_wrapper_for_graphP, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_6get_wrapper_for_graphP}, - {"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_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_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}, - {"gp_DupGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_41gp_DupGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_40gp_DupGraph}, - {"gp_Read", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_43gp_Read, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_42gp_Read}, - {"gp_Write", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_45gp_Write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_44gp_Write}, - {"gp_GetNeighborEdgeRecord", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_47gp_GetNeighborEdgeRecord, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_46gp_GetNeighborEdgeRecord}, - {"gp_GetVertexDegree", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_49gp_GetVertexDegree, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_48gp_GetVertexDegree}, - {"gp_GetArcCapacity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_51gp_GetArcCapacity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_50gp_GetArcCapacity}, - {"gp_EnsureArcCapacity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_53gp_EnsureArcCapacity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_52gp_EnsureArcCapacity}, - {"gp_AddEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_55gp_AddEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_54gp_AddEdge}, - {"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}, - {"gp_AttachDrawPlanar", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_59gp_AttachDrawPlanar, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_58gp_AttachDrawPlanar}, - {"gp_AttachK23Search", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_61gp_AttachK23Search, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_60gp_AttachK23Search}, - {"gp_AttachK33Search", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_63gp_AttachK33Search, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_62gp_AttachK33Search}, - {"gp_AttachK4Search", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_65gp_AttachK4Search, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_64gp_AttachK4Search}, - {"gp_Embed", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_67gp_Embed, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_66gp_Embed}, - {"gp_TestEmbedResultIntegrity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_69gp_TestEmbedResultIntegrity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_68gp_TestEmbedResultIntegrity}, - {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_71__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_70__reduce_cython__}, - {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_73__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_72__setstate_cython__}, + {"get_wrapper_for_graphP", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_5get_wrapper_for_graphP, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_4get_wrapper_for_graphP}, + {"gp_IsEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_7gp_IsEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_6gp_IsEdge}, + {"gp_EdgeArrayStart", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_9gp_EdgeArrayStart, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_8gp_EdgeArrayStart}, + {"gp_EdgeInUse", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_11gp_EdgeInUse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_10gp_EdgeInUse}, + {"gp_EdgeArraySize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_13gp_EdgeArraySize, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_12gp_EdgeArraySize}, + {"gp_EdgeInUseArraySize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_15gp_EdgeInUseArraySize, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_14gp_EdgeInUseArraySize}, + {"gp_GetFirstEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_17gp_GetFirstEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_16gp_GetFirstEdge}, + {"gp_GetNextEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_19gp_GetNextEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_18gp_GetNextEdge}, + {"gp_GetNeighbor", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_21gp_GetNeighbor, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_20gp_GetNeighbor}, + {"gp_IsVertex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_23gp_IsVertex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_22gp_IsVertex}, + {"gp_GetFirstVertex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_25gp_GetFirstVertex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_24gp_GetFirstVertex}, + {"gp_GetLastVertex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_27gp_GetLastVertex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_26gp_GetLastVertex}, + {"gp_VertexInRangeAscending", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_29gp_VertexInRangeAscending, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_28gp_VertexInRangeAscending}, + {"gp_GetN", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_31gp_GetN, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_30gp_GetN}, + {"gp_InitGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_33gp_InitGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_32gp_InitGraph}, + {"gp_ReinitializeGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_35gp_ReinitializeGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_34gp_ReinitializeGraph}, + {"gp_CopyGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_37gp_CopyGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_36gp_CopyGraph}, + {"gp_DupGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_39gp_DupGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_38gp_DupGraph}, + {"gp_Read", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_41gp_Read, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_40gp_Read}, + {"gp_Write", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_43gp_Write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_42gp_Write}, + {"gp_FindEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_45gp_FindEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_44gp_FindEdge}, + {"gp_GetVertexDegree", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_47gp_GetVertexDegree, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_46gp_GetVertexDegree}, + {"gp_GetEdgeCapacity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_49gp_GetEdgeCapacity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_48gp_GetEdgeCapacity}, + {"gp_EnsureEdgeCapacity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_51gp_EnsureEdgeCapacity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_50gp_EnsureEdgeCapacity}, + {"gp_AddEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_53gp_AddEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_52gp_AddEdge}, + {"gp_DeleteEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_55gp_DeleteEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_54gp_DeleteEdge}, + {"gp_ExtendWith_Planarity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_57gp_ExtendWith_Planarity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_56gp_ExtendWith_Planarity}, + {"gp_ExtendWith_DrawPlanar", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_59gp_ExtendWith_DrawPlanar, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_58gp_ExtendWith_DrawPlanar}, + {"gp_DrawPlanar_RenderToFile", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_61gp_DrawPlanar_RenderToFile, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_60gp_DrawPlanar_RenderToFile}, + {"gp_DrawPlanar_RenderToString", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_63gp_DrawPlanar_RenderToString, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_62gp_DrawPlanar_RenderToString}, + {"gp_ExtendWith_Outerplanarity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_65gp_ExtendWith_Outerplanarity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_64gp_ExtendWith_Outerplanarity}, + {"gp_ExtendWith_K23Search", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_67gp_ExtendWith_K23Search, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_66gp_ExtendWith_K23Search}, + {"gp_ExtendWith_K33Search", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_69gp_ExtendWith_K33Search, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_68gp_ExtendWith_K33Search}, + {"gp_ExtendWith_K4Search", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_71gp_ExtendWith_K4Search, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_70gp_ExtendWith_K4Search}, + {"gp_Embed", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_73gp_Embed, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_72gp_Embed}, + {"gp_TestEmbedResultIntegrity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_75gp_TestEmbedResultIntegrity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_74gp_TestEmbedResultIntegrity}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_77__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_76__reduce_cython__}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_79__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_78__setstate_cython__}, {0, 0, 0, 0} }; #if CYTHON_USE_TYPE_SPECS @@ -9338,15 +10489,15 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ #if CYTHON_USE_TYPE_SPECS - __pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9planarity_4full_5graph_Graph_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph)) __PYX_ERR(0, 26, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9planarity_4full_5graph_Graph_spec, __pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph) < (0)) __PYX_ERR(0, 26, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9planarity_4full_5graph_Graph_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph)) __PYX_ERR(0, 38, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9planarity_4full_5graph_Graph_spec, __pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph) < (0)) __PYX_ERR(0, 38, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph = &__pyx_type_9planarity_4full_5graph_Graph; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph) < (0)) __PYX_ERR(0, 26, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph) < (0)) __PYX_ERR(0, 38, __pyx_L1_error) #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph); @@ -9356,8 +10507,8 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { __pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph->tp_getattro = PyObject_GenericGetAttr; } #endif - if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Graph, (PyObject *) __pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph) < (0)) __PYX_ERR(0, 26, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph) < (0)) __PYX_ERR(0, 26, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Graph, (PyObject *) __pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph) < (0)) __PYX_ERR(0, 38, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph) < (0)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -9659,643 +10810,718 @@ __Pyx_RefNannySetupContext("PyInit_graph", 0); (void)__Pyx_modinit_function_import_code(__pyx_mstate); /*--- Execution code ---*/ - /* "planarity/full/graph.pyx":13 + /* "planarity/full/graph.pyx":15 * from planarity.full cimport cgraphLib * * OK = cappconst.OK # <<<<<<<<<<<<<< * NONEMBEDDABLE = cgraphLib.NONEMBEDDABLE * NOTOK = cappconst.NOTOK */ - __pyx_t_2 = __Pyx_PyLong_From_int(OK); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyLong_From_int(OK); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_OK, __pyx_t_2) < (0)) __PYX_ERR(0, 13, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_OK, __pyx_t_2) < (0)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/graph.pyx":14 + /* "planarity/full/graph.pyx":16 * * OK = cappconst.OK * NONEMBEDDABLE = cgraphLib.NONEMBEDDABLE # <<<<<<<<<<<<<< * NOTOK = cappconst.NOTOK * NIL = cappconst.NIL */ - __pyx_t_2 = __Pyx_PyLong_From_int(NONEMBEDDABLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyLong_From_int(NONEMBEDDABLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_NONEMBEDDABLE, __pyx_t_2) < (0)) __PYX_ERR(0, 14, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_NONEMBEDDABLE, __pyx_t_2) < (0)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/graph.pyx":15 + /* "planarity/full/graph.pyx":17 * OK = cappconst.OK * NONEMBEDDABLE = cgraphLib.NONEMBEDDABLE * NOTOK = cappconst.NOTOK # <<<<<<<<<<<<<< * NIL = cappconst.NIL * */ - __pyx_t_2 = __Pyx_PyLong_From_int(NOTOK); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyLong_From_int(NOTOK); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_NOTOK, __pyx_t_2) < (0)) __PYX_ERR(0, 15, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_NOTOK, __pyx_t_2) < (0)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/graph.pyx":16 + /* "planarity/full/graph.pyx":18 * NONEMBEDDABLE = cgraphLib.NONEMBEDDABLE * NOTOK = cappconst.NOTOK * NIL = cappconst.NIL # <<<<<<<<<<<<<< * * EMBEDFLAGS_PLANAR = cgraphLib.EMBEDFLAGS_PLANAR */ - __pyx_t_2 = __Pyx_PyLong_From_int(NIL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyLong_From_int(NIL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_NIL, __pyx_t_2) < (0)) __PYX_ERR(0, 16, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_NIL, __pyx_t_2) < (0)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/graph.pyx":18 + /* "planarity/full/graph.pyx":20 * NIL = cappconst.NIL * * EMBEDFLAGS_PLANAR = cgraphLib.EMBEDFLAGS_PLANAR # <<<<<<<<<<<<<< * EMBEDFLAGS_DRAWPLANAR = cgraphLib.EMBEDFLAGS_DRAWPLANAR * EMBEDFLAGS_OUTERPLANAR = cgraphLib.EMBEDFLAGS_OUTERPLANAR */ - __pyx_t_2 = __Pyx_PyLong_From_int(EMBEDFLAGS_PLANAR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyLong_From_int(EMBEDFLAGS_PLANAR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_PLANAR, __pyx_t_2) < (0)) __PYX_ERR(0, 18, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_PLANAR, __pyx_t_2) < (0)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/graph.pyx":19 + /* "planarity/full/graph.pyx":21 * * EMBEDFLAGS_PLANAR = cgraphLib.EMBEDFLAGS_PLANAR * EMBEDFLAGS_DRAWPLANAR = cgraphLib.EMBEDFLAGS_DRAWPLANAR # <<<<<<<<<<<<<< * EMBEDFLAGS_OUTERPLANAR = cgraphLib.EMBEDFLAGS_OUTERPLANAR * EMBEDFLAGS_SEARCHFORK23 = cgraphLib.EMBEDFLAGS_SEARCHFORK23 */ - __pyx_t_2 = __Pyx_PyLong_From_int(EMBEDFLAGS_DRAWPLANAR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyLong_From_int(EMBEDFLAGS_DRAWPLANAR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_DRAWPLANAR, __pyx_t_2) < (0)) __PYX_ERR(0, 19, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_DRAWPLANAR, __pyx_t_2) < (0)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/graph.pyx":20 + /* "planarity/full/graph.pyx":22 * EMBEDFLAGS_PLANAR = cgraphLib.EMBEDFLAGS_PLANAR * EMBEDFLAGS_DRAWPLANAR = cgraphLib.EMBEDFLAGS_DRAWPLANAR * EMBEDFLAGS_OUTERPLANAR = cgraphLib.EMBEDFLAGS_OUTERPLANAR # <<<<<<<<<<<<<< * EMBEDFLAGS_SEARCHFORK23 = cgraphLib.EMBEDFLAGS_SEARCHFORK23 * EMBEDFLAGS_SEARCHFORK33 = cgraphLib.EMBEDFLAGS_SEARCHFORK33 */ - __pyx_t_2 = __Pyx_PyLong_From_int(EMBEDFLAGS_OUTERPLANAR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyLong_From_int(EMBEDFLAGS_OUTERPLANAR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_OUTERPLANAR, __pyx_t_2) < (0)) __PYX_ERR(0, 20, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_OUTERPLANAR, __pyx_t_2) < (0)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/graph.pyx":21 + /* "planarity/full/graph.pyx":23 * EMBEDFLAGS_DRAWPLANAR = cgraphLib.EMBEDFLAGS_DRAWPLANAR * EMBEDFLAGS_OUTERPLANAR = cgraphLib.EMBEDFLAGS_OUTERPLANAR * EMBEDFLAGS_SEARCHFORK23 = cgraphLib.EMBEDFLAGS_SEARCHFORK23 # <<<<<<<<<<<<<< * EMBEDFLAGS_SEARCHFORK33 = cgraphLib.EMBEDFLAGS_SEARCHFORK33 * EMBEDFLAGS_SEARCHFORK4 = cgraphLib.EMBEDFLAGS_SEARCHFORK4 */ - __pyx_t_2 = __Pyx_PyLong_From_int(EMBEDFLAGS_SEARCHFORK23); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyLong_From_int(EMBEDFLAGS_SEARCHFORK23); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_SEARCHFORK23, __pyx_t_2) < (0)) __PYX_ERR(0, 21, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_SEARCHFORK23, __pyx_t_2) < (0)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/graph.pyx":22 + /* "planarity/full/graph.pyx":24 * EMBEDFLAGS_OUTERPLANAR = cgraphLib.EMBEDFLAGS_OUTERPLANAR * EMBEDFLAGS_SEARCHFORK23 = cgraphLib.EMBEDFLAGS_SEARCHFORK23 * EMBEDFLAGS_SEARCHFORK33 = cgraphLib.EMBEDFLAGS_SEARCHFORK33 # <<<<<<<<<<<<<< * EMBEDFLAGS_SEARCHFORK4 = cgraphLib.EMBEDFLAGS_SEARCHFORK4 * */ - __pyx_t_2 = __Pyx_PyLong_From_int(EMBEDFLAGS_SEARCHFORK33); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyLong_From_int(EMBEDFLAGS_SEARCHFORK33); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_SEARCHFORK33, __pyx_t_2) < (0)) __PYX_ERR(0, 22, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_SEARCHFORK33, __pyx_t_2) < (0)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/graph.pyx":23 + /* "planarity/full/graph.pyx":25 * EMBEDFLAGS_SEARCHFORK23 = cgraphLib.EMBEDFLAGS_SEARCHFORK23 * EMBEDFLAGS_SEARCHFORK33 = cgraphLib.EMBEDFLAGS_SEARCHFORK33 * EMBEDFLAGS_SEARCHFORK4 = cgraphLib.EMBEDFLAGS_SEARCHFORK4 # <<<<<<<<<<<<<< * * */ - __pyx_t_2 = __Pyx_PyLong_From_int(EMBEDFLAGS_SEARCHFORK4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyLong_From_int(EMBEDFLAGS_SEARCHFORK4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_SEARCHFORK4, __pyx_t_2) < (0)) __PYX_ERR(0, 23, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_SEARCHFORK4, __pyx_t_2) < (0)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/graph.pyx":38 - * cgraphLib.gp_Free(&self._theGraph) + /* "planarity/full/graph.pyx":28 * - * def is_graph_NULL(self): # <<<<<<<<<<<<<< - * return self._theGraph == NULL * + * def gp_GetProjectVersionFull(): # <<<<<<<<<<<<<< + * cdef bytes encoded_version = cgraphLib.gp_GetProjectVersionFull() + * return encoded_version.decode('utf-8') */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_5is_graph_NULL, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_is_graph_NULL, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_1gp_GetProjectVersionFull, 0, __pyx_mstate_global->__pyx_n_u_gp_GetProjectVersionFull, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __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_is_graph_NULL, __pyx_t_2) < (0)) __PYX_ERR(0, 38, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_gp_GetProjectVersionFull, __pyx_t_2) < (0)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/graph.pyx":41 - * return self._theGraph == NULL + /* "planarity/full/graph.pyx":33 + * + * + * def gp_GetLibPlanarityVersionFull(): # <<<<<<<<<<<<<< + * cdef bytes encoded_version = cgraphLib.gp_GetLibPlanarityVersionFull() + * return encoded_version.decode('utf-8') +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_3gp_GetLibPlanarityVersionFull, 0, __pyx_mstate_global->__pyx_n_u_gp_GetLibPlanarityVersionFull, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __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 (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_gp_GetLibPlanarityVersionFull, __pyx_t_2) < (0)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "planarity/full/graph.pyx":50 + * cgraphLib.gp_Free(&self._theGraph) * * def get_wrapper_for_graphP(self) -> Graph: # <<<<<<<<<<<<<< * cdef Graph new_wrapper = Graph() * */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __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, 41, __pyx_L1_error) - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_7get_wrapper_for_graphP, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_get_wrapper_for_graphP, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __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, 50, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_5get_wrapper_for_graphP, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_get_wrapper_for_graphP, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __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_get_wrapper_for_graphP, __pyx_t_3) < (0)) __PYX_ERR(0, 41, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_get_wrapper_for_graphP, __pyx_t_3) < (0)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":51 + /* "planarity/full/graph.pyx":60 * return new_wrapper * - * def gp_IsArc(self, int e): # <<<<<<<<<<<<<< + * def gp_IsEdge(self, int e): # <<<<<<<<<<<<<< * return ( - * (e >= self.gp_GetFirstEdge()) and + * (e >= self.gp_EdgeArrayStart()) and */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_9gp_IsArc, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_IsArc, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_7gp_IsEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_IsEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 60, __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_IsArc, __pyx_t_3) < (0)) __PYX_ERR(0, 51, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_IsEdge, __pyx_t_3) < (0)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":58 + /* "planarity/full/graph.pyx":67 * ) * - * def gp_GetFirstEdge(self): # <<<<<<<<<<<<<< - * return cgraphLib.gp_GetFirstEdge(self._theGraph) + * def gp_EdgeArrayStart(self): # <<<<<<<<<<<<<< + * return cgraphLib.gp_EdgeArrayStart(self._theGraph) * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_11gp_GetFirstEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetFirstEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 58, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_9gp_EdgeArrayStart, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_EdgeArrayStart, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __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_GetFirstEdge, __pyx_t_3) < (0)) __PYX_ERR(0, 58, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_EdgeArrayStart, __pyx_t_3) < (0)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":61 - * return cgraphLib.gp_GetFirstEdge(self._theGraph) + /* "planarity/full/graph.pyx":70 + * return cgraphLib.gp_EdgeArrayStart(self._theGraph) * * def gp_EdgeInUse(self, int e): # <<<<<<<<<<<<<< - * if not self.gp_IsArc(e): + * if not self.gp_IsEdge(e): * raise RuntimeError( */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_13gp_EdgeInUse, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_EdgeInUse, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_11gp_EdgeInUse, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_EdgeInUse, 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, 70, __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_EdgeInUse, __pyx_t_3) < (0)) __PYX_ERR(0, 61, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_t_3) < (0)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":69 + /* "planarity/full/graph.pyx":78 * 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_13gp_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[6])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __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, 78, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":72 - * return cgraphLib.gp_EdgeIndexBound(self._theGraph) + /* "planarity/full/graph.pyx":81 + * 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_15gp_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[7])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __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, 81, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":75 - * return cgraphLib.gp_EdgeInUseIndexBound(self._theGraph) + /* "planarity/full/graph.pyx":84 + * return cgraphLib.gp_EdgeInUseArraySize(self._theGraph) * - * def gp_GetFirstArc(self, int v): # <<<<<<<<<<<<<< + * def gp_GetFirstEdge(self, int v): # <<<<<<<<<<<<<< * if not self.gp_IsVertex(v): * raise RuntimeError( */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_19gp_GetFirstArc, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetFirstArc, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 75, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_17gp_GetFirstEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetFirstEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __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_GetFirstArc, __pyx_t_3) < (0)) __PYX_ERR(0, 75, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetFirstEdge, __pyx_t_3) < (0)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":83 - * return cgraphLib.gp_GetFirstArc(self._theGraph, v) + /* "planarity/full/graph.pyx":92 + * return cgraphLib.gp_GetFirstEdge(self._theGraph, v) * - * def gp_GetNextArc(self, int e): # <<<<<<<<<<<<<< - * if not self.gp_IsArc(e): + * def gp_GetNextEdge(self, int e): # <<<<<<<<<<<<<< + * if not self.gp_IsEdge(e): * raise RuntimeError( */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_21gp_GetNextArc, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetNextArc, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_19gp_GetNextEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetNextEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __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_GetNextArc, __pyx_t_3) < (0)) __PYX_ERR(0, 83, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetNextEdge, __pyx_t_3) < (0)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":91 - * return cgraphLib.gp_GetNextArc(self._theGraph, e) + /* "planarity/full/graph.pyx":100 + * return cgraphLib.gp_GetNextEdge(self._theGraph, e) * * def gp_GetNeighbor(self, int e): # <<<<<<<<<<<<<< - * if not self.gp_IsArc(e): + * if not self.gp_IsEdge(e): * raise RuntimeError( */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_23gp_GetNeighbor, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetNeighbor, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_21gp_GetNeighbor, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetNeighbor, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 100, __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_GetNeighbor, __pyx_t_3) < (0)) __PYX_ERR(0, 91, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetNeighbor, __pyx_t_3) < (0)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":99 + /* "planarity/full/graph.pyx":108 * return cgraphLib.gp_GetNeighbor(self._theGraph, e) * * def gp_IsVertex(self, int v): # <<<<<<<<<<<<<< * return ( * (v >= self.gp_GetFirstVertex()) and */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_25gp_IsVertex, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_IsVertex, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 99, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_23gp_IsVertex, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_IsVertex, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 108, __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_IsVertex, __pyx_t_3) < (0)) __PYX_ERR(0, 99, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_t_3) < (0)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":106 + /* "planarity/full/graph.pyx":115 * ) * * def gp_GetFirstVertex(self): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetFirstVertex(self._theGraph) * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_27gp_GetFirstVertex, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetFirstVertex, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 106, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_25gp_GetFirstVertex, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetFirstVertex, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 115, __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_GetFirstVertex, __pyx_t_3) < (0)) __PYX_ERR(0, 106, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetFirstVertex, __pyx_t_3) < (0)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":109 + /* "planarity/full/graph.pyx":118 * return cgraphLib.gp_GetFirstVertex(self._theGraph) * * def gp_GetLastVertex(self): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetLastVertex(self._theGraph) * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_29gp_GetLastVertex, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetLastVertex, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 109, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_27gp_GetLastVertex, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetLastVertex, 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, 118, __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_GetLastVertex, __pyx_t_3) < (0)) __PYX_ERR(0, 109, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetLastVertex, __pyx_t_3) < (0)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":112 + /* "planarity/full/graph.pyx":121 * 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_29gp_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[14])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __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, 121, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":118 + /* "planarity/full/graph.pyx":127 * ) * - * 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_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 127, __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) + if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_31gp_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[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 __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, 127, __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":136 + * 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_33gp_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[16])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 136, __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, 136, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/graph.pyx":130 + /* "planarity/full/graph.pyx":140 * 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_35gp_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[17])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __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, 140, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/graph.pyx":133 + /* "planarity/full/graph.pyx":143 * 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_37gp_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[18])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 143, __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, 143, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/graph.pyx":147 + /* "planarity/full/graph.pyx":167 * 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, 167, __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, 167, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_39gp_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[19])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 167, __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, 167, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":164 + /* "planarity/full/graph.pyx":184 * 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_41gp_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[20])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __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, 184, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":172 + /* "planarity/full/graph.pyx":192 * 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_43gp_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[21])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __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, 192, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":192 + /* "planarity/full/graph.pyx":212 * ) * - * def gp_GetNeighborEdgeRecord(self, int u, int v): # <<<<<<<<<<<<<< - * if not self.gp_IsVertex(u): - * raise RuntimeError(f"'{u}' is not a valid vertex label.") + * def gp_FindEdge(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_45gp_FindEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_FindEdge, 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, 212, __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_FindEdge, __pyx_t_3) < (0)) __PYX_ERR(0, 212, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "planarity/full/graph.pyx":220 + * return cgraphLib.gp_FindEdge(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_47gp_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[23])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __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, 220, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "planarity/full/graph.pyx":226 + * return cgraphLib.gp_GetVertexDegree(self._theGraph, v) + * + * def gp_GetEdgeCapacity(self): # <<<<<<<<<<<<<< + * return cgraphLib.gp_GetEdgeCapacity(self._theGraph) + * +*/ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_49gp_GetEdgeCapacity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetEdgeCapacity, 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, 226, __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_GetEdgeCapacity, __pyx_t_3) < (0)) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "planarity/full/graph.pyx":229 + * return cgraphLib.gp_GetEdgeCapacity(self._theGraph) + * + * def gp_EnsureEdgeCapacity(self, int new_edge_capacity): # <<<<<<<<<<<<<< + * if cgraphLib.gp_EnsureEdgeCapacity(self._theGraph, new_edge_capacity) != cappconst.OK: + * raise RuntimeError( +*/ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_51gp_EnsureEdgeCapacity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_EnsureEdgeCapacity, 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, 229, __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_EnsureEdgeCapacity, __pyx_t_3) < (0)) __PYX_ERR(0, 229, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "planarity/full/graph.pyx":235 + * f"{new_edge_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_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_53gp_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[26])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 235, __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_AddEdge, __pyx_t_3) < (0)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":200 - * return cgraphLib.gp_GetNeighborEdgeRecord(self._theGraph, u, v) + /* "planarity/full/graph.pyx":250 + * ) * - * def gp_GetVertexDegree(self, int v): # <<<<<<<<<<<<<< - * if not self.gp_IsVertex(v): - * raise RuntimeError(f"'{v}' is not a valid vertex label.") + * def gp_DeleteEdge(self, int e): # <<<<<<<<<<<<<< + * if not self.gp_IsEdge(e): + * raise RuntimeError( */ - __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_55gp_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[27])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 250, __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_DeleteEdge, __pyx_t_3) < (0)) __PYX_ERR(0, 250, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":206 - * return cgraphLib.gp_GetVertexDegree(self._theGraph, v) - * - * def gp_GetArcCapacity(self): # <<<<<<<<<<<<<< - * return cgraphLib.gp_GetArcCapacity(self._theGraph) + /* "planarity/full/graph.pyx":258 + * return cgraphLib.gp_DeleteEdge(self._theGraph, e) * + * def gp_ExtendWith_Planarity(self): # <<<<<<<<<<<<<< + * if cgraphLib.gp_ExtendWith_Planarity(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with Planarity structures.") */ - __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_57gp_ExtendWith_Planarity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ExtendWith_Planarity, 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, 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 - 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_ExtendWith_Planarity, __pyx_t_3) < (0)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":209 - * return cgraphLib.gp_GetArcCapacity(self._theGraph) + /* "planarity/full/graph.pyx":262 + * raise RuntimeError("Failed to extend graph with Planarity structures.") * - * def gp_EnsureArcCapacity(self, int new_arc_capacity): # <<<<<<<<<<<<<< - * if cgraphLib.gp_EnsureArcCapacity(self._theGraph, new_arc_capacity) != cappconst.OK: - * raise RuntimeError( + * def gp_ExtendWith_DrawPlanar(self): # <<<<<<<<<<<<<< + * if cgraphLib.gp_ExtendWith_DrawPlanar(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with DrawPlanar structures.") */ - __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_59gp_ExtendWith_DrawPlanar, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ExtendWith_DrawPlanar, 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, 262, __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_ExtendWith_DrawPlanar, __pyx_t_3) < (0)) __PYX_ERR(0, 262, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":215 - * f"{new_arc_capacity}.") + /* "planarity/full/graph.pyx":266 + * raise RuntimeError("Failed to extend graph with DrawPlanar structures.") * - * def gp_AddEdge(self, int u, int ulink, int v, int vlink): # <<<<<<<<<<<<<< - * if ulink != 0 and ulink != 1: - * raise RuntimeError( + * def gp_DrawPlanar_RenderToFile(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_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_61gp_DrawPlanar_RenderToFile, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_DrawPlanar_RenderToFile, 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, 266, __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_DrawPlanar_RenderToFile, __pyx_t_3) < (0)) __PYX_ERR(0, 266, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":230 - * ) + /* "planarity/full/graph.pyx":274 + * raise RuntimeError(f"Failed to render embedding to file '{outfile_name}'.") * - * def gp_DeleteEdge(self, int e, int nextLink): # <<<<<<<<<<<<<< - * if not self.gp_IsArc(e): - * raise RuntimeError( + * def gp_DrawPlanar_RenderToString(self): # <<<<<<<<<<<<<< + * cdef char* renditionString = NULL + * if cgraphLib.gp_DrawPlanar_RenderToString(self._theGraph, &renditionString) != OK: */ - __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_63gp_DrawPlanar_RenderToString, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_DrawPlanar_RenderToStri, 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_3)) __PYX_ERR(0, 274, __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_DrawPlanar_RenderToString, __pyx_t_3) < (0)) __PYX_ERR(0, 274, __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":288 + * free(renditionString) * - * def gp_AttachDrawPlanar(self): # <<<<<<<<<<<<<< - * if cgraphLib.gp_AttachDrawPlanar(self._theGraph) != cappconst.OK: - * raise RuntimeError("Failed to attach DrawPlanar algorithm.") + * def gp_ExtendWith_Outerplanarity(self): # <<<<<<<<<<<<<< + * if cgraphLib.gp_ExtendWith_Outerplanarity(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with Outerplanarity structures.") */ - __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_65gp_ExtendWith_Outerplanarity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ExtendWith_Outerplanari, 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, 288, __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_ExtendWith_Outerplanarity, __pyx_t_3) < (0)) __PYX_ERR(0, 288, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":246 - * raise RuntimeError("Failed to attach DrawPlanar algorithm.") + /* "planarity/full/graph.pyx":292 + * raise RuntimeError("Failed to extend graph with Outerplanarity structures.") * - * def gp_AttachK23Search(self): # <<<<<<<<<<<<<< - * if cgraphLib.gp_AttachK23Search(self._theGraph) != cappconst.OK: - * raise RuntimeError("Failed to attach K23Search algorithm.") + * def gp_ExtendWith_K23Search(self): # <<<<<<<<<<<<<< + * if cgraphLib.gp_ExtendWith_K23Search(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with K23Search structures.") */ - __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_67gp_ExtendWith_K23Search, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ExtendWith_K23Search, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[33])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __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_ExtendWith_K23Search, __pyx_t_3) < (0)) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":250 - * raise RuntimeError("Failed to attach K23Search algorithm.") + /* "planarity/full/graph.pyx":296 + * raise RuntimeError("Failed to extend graph with K23Search structures.") * - * def gp_AttachK33Search(self): # <<<<<<<<<<<<<< - * if cgraphLib.gp_AttachK33Search(self._theGraph) != cappconst.OK: - * raise RuntimeError("Failed to attach K33Search algorithm.") + * def gp_ExtendWith_K33Search(self): # <<<<<<<<<<<<<< + * if cgraphLib.gp_ExtendWith_K33Search(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with K33Search structures.") */ - __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_69gp_ExtendWith_K33Search, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ExtendWith_K33Search, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[34])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 296, __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_ExtendWith_K33Search, __pyx_t_3) < (0)) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":254 - * raise RuntimeError("Failed to attach K33Search algorithm.") + /* "planarity/full/graph.pyx":300 + * raise RuntimeError("Failed to extend graph with K33Search structures.") * - * def gp_AttachK4Search(self): # <<<<<<<<<<<<<< - * if cgraphLib.gp_AttachK4Search(self._theGraph) != cappconst.OK: - * raise RuntimeError("Failed to attach K4Search algorithm.") + * def gp_ExtendWith_K4Search(self): # <<<<<<<<<<<<<< + * if cgraphLib.gp_ExtendWith_K4Search(self._theGraph) != cappconst.OK: + * raise RuntimeError("Failed to extend graph with K4Search structures.") */ - __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_71gp_ExtendWith_K4Search, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ExtendWith_K4Search, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[35])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 300, __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_ExtendWith_K4Search, __pyx_t_3) < (0)) __PYX_ERR(0, 300, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "planarity/full/graph.pyx":258 - * raise RuntimeError("Failed to attach K4Search algorithm.") + /* "planarity/full/graph.pyx":304 + * raise RuntimeError("Failed to extend graph with K4Search structures.") * * 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, 304, __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, 304, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_73gp_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[36])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __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, 304, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "planarity/full/graph.pyx":261 + /* "planarity/full/graph.pyx":307 * 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, 307, __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, 307, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_75gp_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[37])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 307, __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, 307, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "(tree fragment)":1 @@ -10303,7 +11529,7 @@ __Pyx_RefNannySetupContext("PyInit_graph", 0); * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_71__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[33])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_77__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[38])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); @@ -10317,7 +11543,7 @@ __Pyx_RefNannySetupContext("PyInit_graph", 0); * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_73__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[34])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_79__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[39])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); @@ -10396,42 +11622,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 (2230 bytes) */ +const char* const cstring = "(\265/\375`\317\023eE\000z\\t\023G\360\220:\007\314\300\354\004\205\017\253L\321\230\270b\304M\005\254\030qSas\034=\246\021)\231\235\274\"\272\375\034Y\026\260;\005\357\367\236+z\254\267\360\250X\"\030\277{\304\273=C\005M\225;\033\327\3630t%\"\006\001\030\001+\001\234\302|\246\317\355k\217\204\206\240%1z\022\222\320g}O\277\317b\225\315)\362\277j\366\322\377i\220\276\313\356\217\331\026\345;t\321\235-\312\363\033[\321\307\256\276\037\345*\007s\266\034\345\277i\376\026\337\366\365\231\206\340\214\256Z\250g\377k\306i\276\034\337PEW \335\277\267\305\236*\334ts\357a\274\266\024\344\001t\241\024*\321\254\237{\027?\267\372U\027\377g[\234>\007I\237A\322{:\004w\214\243)!\225]\032#_,\201\352\277\253\353\375kSn]\032\\\215F)H\245\177\301\320\224\014^n\363\345\373?\372\305r\213\347{\031\027\333\313o\276\224\203\231\356[\202\243\253\357{\225\353\251~]\232\361\373\322\317C\027\020J\313\323\366Q(\032N\354\327!\367Bm\263\305%\030\253Yh\213_\030\332zY\315\242_~.\373\014\266\370\254\304\312W\363MW(\327\037\313\240GAN\277\307\327\212<\\X\364\317\272\032\254+\260\306\360\254\352=\253y\315\267bo\177\276<\0045\350y\300\353\345\331\266v\365\247\312\275\313\"\233\225j=\341r\302%\345B\n\215Ht,$\027\322\250\205\364\345\367v\266\247\334\302z\236[8\016\367\237\370\376\324~\315z\026\031\311\216T\344+*\201P^\270\266\374e\\\324\314j\335\241\300\324\251~_W_\265\352\312\237\305-\337\374w\255\236\347]\226\364\370\212@('\027\221\211\225S\027B\235B\251\024.\247\216\324\215J/\335\211\245\242Jt#\021K\210\004\212PX\"BE6{y0`\034\2560\324\352a{cW\363\013\271\326\367\302\357u\255\224\343\320\256\376\243`\376\366\365p.+\301\203_e1\265\034\267\002\371\325/\237\375\023\314\223\370\315-2\r\252Z\254\373$.{\276\365\025\361/\341y\366eWt\2703\267S\344\226W\310]\232\022z\376\370YJHV\352\213\345\261<+\312\375\276_\035AO<\234\307\273\370\025~\372\363\265\001\036\"\007T\371\200L\365\256s\214\335\314\247w\372\0369\264\027\344\007\271\221$!\347\307\354\230$\266\016\033U6\332\210\324\220\260\336\261\2310\332\010[\236\220_7""u\004\226f\242\205(UH\336mO0:\240m4\017v4\215)\"O\241N\032\246\n\255\244\304}\244s:\n\021\304\222\255\316b\213\262\003\233\231\017\217n4\201\215\"\035g\307\246\306\201!2\350(=\300,\246\203\243f`\300\215\316\306G\354\210\013\024\3248\nj.Z\234X\206\004\342\244A\202\310\016ibeNL\\\216\224\234\362\263\311\214h\034\037\347\307V\262\220\037\322B\310\031\262\251u6L\375\243o}3\206lf`\243\035O\304\005\0345\3238a\234\021\003\212\341(\000`sc\033C4gl\177\210m,\026\276\302\257~\213\357\347\265\346\255A\255?\207\325\323{\205\177g\035\362\327\262\3076\204\275j}\201/\217\247\302<\016k\276\326U\253k\273\352\276\225\273l\256\217\357*_P\2270\016E\252[Y\265z9\\\335\255?V\277\377@/\277\256\233e\003\235\022\367\221\316\351\005L4=\204\3501\243\353\036=\206\010\242\203\364\016I\2429?\357\364^\316\227\320\371\200\226*\273\022\304Bs\302b:\272\010\004\221\263\231\331\310Y\337\037\266\021%\246\364p\024\331\314X\030\003\214!`&\310\3440B\320\234&\321B\214\201M\306\0047\216\2109\240Y19M4\265\315F\247\003R\3436\221\257W\320\035\t\203sD\3341\035\010\254i2C\"g\013\026\347\013\031\0044\312\026\344\203\236\032\273\321D\327G6\265\215\000\351b\204\260\2311G \273s \347\207\350\305$\250\300)9iI\217%GJ>\250\323\211M\020'\375k\201u\256\334\312\006\344\2131B\001\000\006nt\345\247D\261`R\373\230\001\314\r4\027\351\241P\353L\0173DS!9IDj\002\312\014\021N\026\"HG\006\323N\312\2174\221\0278\342&*\340\230\ti\320\2155b:$\207\344\372\010\321\203\243V`\305\313\371\222:S+g\307\324)\230/\312\t\034\231\027\264\007e\212\354\310\223\010\nj0\323\232\242\rgWjJ\030\211\241t\216\314\027\332\004Z\2072@9\352\232\023\342\307L\347Sa\374D\022b\201\267\250Q\241R\010\241\221\221\021I\222$\303\001A\010\002\241\244\203\320\363R\241D\tS\216!\302\014!DdDFDd$)\250\244\003\207\017zT\231N\020\222\214\302/>\033I\234L\016\203\214\226\021\245\006-c\212\036,r\013\201,\3212#\321\265R\306\341$\3101cn\360x\274\213\222\007\006w\000k\030\003c\342v\204\210R\327\253\351\014\365}\303D@\0378\007\3038~\\\020\002\222\2174?d\022\315\240p\037\375\271\264o{""\3607SG\323\266\247\t\236\331~\274\310CV\235\371\340D[8\356\274\n,>\356\262\0348s\241e\226\010&\327\020\214\331\320\255\247V\004\323\200Q`\026W\305\210!\303\373#\026\225g\3730\302\261 \033fs\0248\264\177h4V\023\313\002U\214\222\367\304\014}\346\377x\2256\221\227\034\312H<(\025P\330R[\005p\3046e\250\346u\336\022\031\205\335\374\242~op\350\215\010m\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 (2387 bytes) */ +const char* const cstring = "BZh91AY&SY\303HW%\000\001G\377\377\357\377\377\347\377\377\377\377\277\357\377\374\277\377\377\376@@@@@@@@@@@@@\000@\000`\t;\343\266\333\235\355\347{s\265\326\201\246\200\000\000=\340}\337\006HH\247\264\23157\2526i\352\215\246\220\207\251\351\232H\320i\232@\036\2404h\006COF\243G\250\315#&#jh\311\240\222\202*\177\251\203T\364L\022i\243\324z\200\r4\006\232\000\000\000\000\000\000\003F\2004\000i\251\204\2056\224i\240\032h\375P\017S@\006\200\000\000h\000\000\000\000\000\321\260\246\200\325?J\247\212mF\203#M4\000\032\0004\304\320\000\000\3044\320\000\0310A\246C \000\n\220L\t\223\0010\023&\002b`\000&L#\000\002d\323\000\000\010\300\230#\000\221!4\010\004j`\324\304\321\220\3104\365\032S\324\006\201\240\000\000\000\000\000\304\006\206\215\036d%=\240.\336\006\376]\341}\203\335\300C6\006\200 \275\016\025!s\0230\002\014\325\212\201\356\245\016\236\353\020\333\033ccc\006\206\323m\246\306\230\2554 z\002\233\235\251$\240\260\253\022S,\270\220F;\361\222\343\200'\023v $\363i\231\234Y\314\002\031\243\035\210\265\336\204\257\270\213\313\253\221*\003\247jR\032H\004\243#&\201\352i 9*\345A\206\001\tcV\230\204\nf\261E\013;'?\317\337\335\313\007\336o\001\223-\367\324p\277t\237\244\326\367\035\223,\037\321|\252\004\255d\225\315J\034-\366\217\217\223\253re\355AQi\253\021\022\324_+0\306\005\232P\177\271Y\205\026\341\017\261m\036Q\325C\203,\345\234\372\"\340k+\245\317\225\203Y;\237\036\333\331U\232\224\204\343\246\201W\312Rj\211H\"\315T\n\2424\177\207E`\226\361\006{Yp\235.\236\305K\211\257II*\251B8\245\334\210\257\036Dp#\260I4\334\216,J~u)R\354\336X\"@tH\354L\303\234j6Xj\032\267\303\263\221$w\177\231\300\035(\315\236\350i\311r\315\361\342p03?\n'\000\005\223\241\225\213\342\351\263\253\263\177\272w\246'\263\365\224\362K\224\353\346\224\223blHc\006\357\2765\375+)YoM\260\3306n\212.\026\n\3257\271D\013\242\003\324\000\340\341$\222Uc\227}p,\324P0\036w\023!\301Z\3776\371\231\201\244O\013\344\227T\356[\000\227Q\221\030\316I\205\214\014\014\370\342\0205W\251{w\344\300O\221\217\033\207(C\230\t\357\030""\232\353\354\032\244\365\245\346\254\256\321R\271R\"\237\225\213i'\335\030\2652\265\005\245\356^\204\256\311J\302_\312\315\256\274\222\220h\3263\222\034\035sD\246\346Np0\016\337\253t_\275v \317\267\243\030\270\275\030\372\017\317\306#\240ANF-\372q\340g\353R7R\220s]\034\027I\006&\301\214\352\034\264,P\362\236\303\2079\316\343\255>\0321(%DT\013\207\"\310\360\233\005\207\rkF\265\246h\363\001\260\016\t\305\332\0332\315aN\250\306\213\034\231B\211\277\221\20326\000Xa\300B\211\202\275\212\235&\315)\306\220\202\023%j\333\236\345VY&3/$\304Z?\320\000$\367\337}\216\032\025\232\013K\334z\202R\314\305\340\032\237\262/1\344cc\351\016A\236B\375<\307\017{>9\017\030n\353\337\273\253n\002j\362\361\021f\3526\221\0327\032\262\370)\026F\243\037\014\245\273\3747\\\372\022}X:\364\374\332Q\347F\373^\006\r\202\024\206\224\t\356NCf\332Q\035\260\242\204\244\033-\020\330\250\n\024\343\313]u\272\r Mt\312vW\323hi\333V\264wvH\014=\245\023j\005\240\314\327V)e\210pG's$\205&\214\254\300\306v\227\346\267\345T3f\320\227\\H|\333\r\232\t\201[\247?\234\220\300\346J\353\261\327V\206b\320\001\025\26178\331(f\264\002.\026\244\014F\202\375x\036\243\353\317v\333\355E\367\221\254\254\320\275]\356~\204\226\322'\": Sh\033\357\354\313\260\316\006\366\2324eR\321\230\216\345\2353\013\221o\021\262h1\266\373\000\345+9\230C=x\350\226\027d\031\002\240z\376Z\\\372\030@\252A\016\022\031\031$\20597\004\231\000\245\004\266\216\017Ha\261\304\252ha1\242B\332\222\033\023\255\304\312\016b\212\274\233M\376\003\213\223\271\303\300KD@\324d\342\244\273\345M\347^\026P\213\245\r\264\022\335L\266E\236\345\216K\020\341,\025A9\213UL\260\316\273)\206v$\304\013\211\265@+}n\0052\020\211\225\254\203H\345F,{\302\336\224\356\026G\242s\313i\234\225\372\\\226/\340\032N\244\35672\345\311U\206Kp\226rs\236gI\315 \264\3005\021\217\035\206J\3025\031\\\225\243\360^C\004RI8\254e\220\230\250\222\374\r\342\020\313\203/*\332\346\022\317u\212\374\0304\031\332\230k\027\032\365\261\216\324\3013\\_l+\207\317\355J\210,\353\246D)\215$F{\t\226)\313\2020g\013""\206\356\213\\\334\330\336.)\027\276\307\245\325\266\334\233ve\2119>\301\332\365D[\246\311D\342N\347\rU\336\346\356f8 \320\321\231\023\210\270\320\316x\316.\020\322\2344!Bi@&:\267z\200\223d\323P&\273\275\271\007\233Q\313\273\t\036k\245\225K\316\231\231\010\216;\345\242\t\231\321|\250\355\327{\317\n\030\331\216\232\027\027\001\020)\332l\033\035\270\"\202\306[\227\243\005\177b^ S\013(b1\261\261\261\267\204w\314\240\316;\372n\025\256\036\231\324\315\237\322\226\246\323\033\270\345\357\246\265\264\221\003\270.\035oH\255x0\"\033\230@1\242\330\257\010z\026\337G\242\316..\325\335i\247@\"c\313\345'\274M\267\225\257\000\332\030E`\207\360J\033\264\n\200Xi\347\260\233\023&@\201\241\253H\301\247[:&\"\243\013pP%.;Q\305v|\352\270\334C`\301\301\306\005Z\024\274a\301\324\306`\260\302\3031t(M\262\235V\255\217\322\237B\344/\202\262\302T)\200\256\335\356\234%\027ixA\010\334\336K-\231\321t\301 v\357\346\202\375V\"/G~\303g.\321.i\0077\240\356\322\"(<\267\265\213!C\200\200\210\031\333\362\356\215\244\320!\246\206\206\306\014:QN\244\265\013Y\250/A|.\036=\317\314\331\211\300\245`\234\255\2673`x\224\2056\234\247gNC4\306\273\004\305\221\022\213\230'jZ\350\270\\\331Jh\2009\302f{\311\370|,9\264V\342\323Pnh\016\211\325\347\263:\334\252\31297\032\n2\n\205?\314 \222\312\235u/'\020l\272\233\235\242\335PN\\\036jHp\333!\032\355e\244\201R\310,\010\245%\031(\23794_7{\262$\242\021a\020\353p\202\355KUq\005'T\203@R\370\357\na~B\323\022o\n\241\027X\031[\037\320iS\000bv\210+]Ih]\335>\267\271\201\345F\244\236\237\024bj\361\033M\333\206\345\237\235Ze\n-\211r|E5\343\355\345\330!\371\362\357\345\241BL\307\337\360\225I\251\240\252\2008\332M\266\205\347\005\263&\366\221xe\010e\342\210h\305\340\315\266r\005\220\356\323\234\010#\257\223\313?\266\277\276o\331\314&\007\"\241PJ\020\261\370](\026D\353\230\240\022\201\000M\220 \220\010\000\220wX\366\025\237\277\033T\n\020K\330d\353\021h\357\245\273\327\025\240.h\330\261oY\"A\270xC\331C@m\333\342\266w\203\307\2203\227xUEk\246\310R\002\"\010\265\025\022\020\304\000\361""\001r\332,\205)CS[$\006o\205\3410i\217\305=q^\312.\324B\211\201\024\002\250\271D N\236|_M\364\025\367v\251N\314\273\222\270n\311\002\303L(\232\003\234\202\016\0277h\177\204\025\314\034\365A\013\025\231\016AR\202U\200v\312iP\376\322\237sR\202\235\263\375\272`]\333W\205\025\241\340`x\n\003\017D4\"\004k\364\353\313k\250\037\340nl\334\354!crm\235\344\346M\233\303\252*eIL\331\217c`e\314\207yS4\374\220\233\\TV\001\337\340\316\3543\022+3$\2312O\214i\366 \254\310\0364\010\000N\024\271\200\t\361G\256\300\260\371\344F\013\211\362>\001\373\324\373=F\326b\276\023\t0\327\224\364\351\211\243}\220\303\315q\026\024\371\237v\353\235o\254\326\2546\177\365P\226\2715\266A\230\302I\333\200B\310\203T\253 )\000\255r3+6h\306\211\210\020\035\210\200\241\361hR\246n[\376.\344\212p\241!\206\220\256J"; + PyObject *data = __Pyx_DecompressString(cstring, 2387, 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 (2209 bytes) */ +const char* const cstring = "x\332\225W\315S\333H\026\037W\330]'!C\030`\206\255JB{\302\304@\210\263,\314\354,I6\245\200I\250x\214\001g\330d\250\352j\244\266\255\211\220\214>\000\357d\253r\344\250\243\216:\352\250\243\217>r\324\321G\376\204\374\t\363\272%\3132\266\311\314\001P\277\257~\375\336\357\367\272\311\3466\210\254P\t\231\032\0225\365\230\352&ZC\206\251\313j\225\311J\r\263\246\251\221 aKOM\252J\250\252\223z\r\235\310f\r\255\353\344\244\244\020\225\350\314\332\022MK\247\306\225\036\257\377\271\274K\211.\326\376\260\303\362\237uX\371s\366[\226I\365:?\204l6\376\250W\351j\007\035\314\251\216\350\341\001\225\244\250\254k\375\025\035dV\001%\312\276\344[\311\006R5\023\311\252l\312D\221\377G\245\334\246z\014_\022\222\250a\312*1e\350\024\317k\025\235\300\237:\215\322,1\347\342\233B!\366\010\263\257h\372!1\221Q\247\242\\\221a\363o;zEV\337\303V\022=eF\310b\353U\224\035\242>\276\24464K\027\351gR)j*-j&Ef\rrX\013q\006J\211*\362\001\325\211I\025^PY\204\2360#\025\225\362\245G+?\256 \002\365\327\351\257T4\rdX\007\242B\014\203\032H\253\240\003KV\240\024\310l\324\241\007h\263\202\032\232\205T\032\226\270\016vI\007\263F\001\332\324d\037(KT\250//\"\006w\350@\026I\262\016\233\310\307\224yo\020\305\240\271\335\360l,\205\276\262\033\350\3202LT#\314\001B\032\344\220\"Mgm\345\364\2527:E\010\201\322\t\026v\243F\302\016\037P\310*\331\3467*9Px\nD\222\020\225\252\024\315Y\213\350x\036=Cs]\245\250S(\032\034\366\004\205\210\001>\233DVaw\326$\311\252+\262\010\026\271ln\021=\207PXe\345g'\341\r\204h\222l\260h\224\307\314\242\n\007g\256*V\353x\r\262\347a\347\346cy\035\257S\205\2324\017)\305\342U\310=\204\001\3174\313\254\254z\277+s\332T\337\030C=C|1\377\274j\000\247\230\303\032\251\023\021\230\026\373\260\203\263\016r\0171\3222!\270\275\244\346\206\254\033\346\220\364\330\254\203\rd\325\214\266\001\373\"\225\253\265\003M\377|N\334\370\324\274\352\350]\343M\350f\177\005\212\364\244g\275C\211\324#\330\203\241\302\242\003\260C\210\300\271\262\331\316$ \250\347\034\n9\240J\356\333\216\026\330\305\374\262Ur\230\315\311F\330RI""\325\000\265\025b)&\302X\247\222%R\214\001\032\034@\252\246>\002\276\035\003\356@+2\010b\034O\303\307\025KQ\036\363\301n^\330Y{\265\261\265\0037\305@\361\362`\361\312\006T\260\010\344\3435\347\277r\361qE>i0\356\210\001=\006\320\376\262\242JM\034N.\035\003}pH\334HW\307\202$\261\326\307\353\230\036\261\244K\215\256(\276\"\241\327l\332\2275\226\351U\372]^\345\256E\304\244X\300\342\013\272N\032\2730*\006HM\242\233=bN\271~\311\200\030\354\"\352\256\372(\330U\361\013q\017\372\2378\300 m|\337\017T._\245\\\031\256\353\275\263\007Y\224\372\224\033@\315\236\316\000\233\007\236-9B\372\204?s\342%\305\0052HZ\354YD\023\246Wv\332\267C\030f\235Vu\332\225\307s\244+1z\0347\215K\333\263\231\222Xt\257\225\3360e\270\312x\303w\250\001\303a\023fb\265\247ba\330Mu\207\250\000-C\204\332&q\311'Uq\263P\334*rF\256\013/\n\371\342Vy\353\365\326k\214K\215S\370Y\207\233\034\263\243\356\300\004\"FC\025e-'j\272f\301-J\r\021f\007\3052\\\276:\021\351\001\021\337\263\013\023k\025\254\351r5\344\037\345\257\243\r\205T\r\376\005\234f\351RU\324$*E\1770\014D\203\335\342\270b\251\"\306\325\301T\006E\207\371\270K\350$\225{H<\234\276W\0217A\331\313d\355\243i\222\216\003\251\331!\345@:\016#\342\020\n\016!\337`\332]E\270!TK\220\254\237^\227\210\325G\251\313d\212\326\362A\034\376\347\260\305\033p%E\024\352eW/\257\302UI\327\330\223\261\3175\311\264$\307bv%x\0251j\020\227\256`\321P\376t\230#\253\354\245\217U\270\262\3409\202e\003\307\274\000\355\241q\210\361!\274\344\3407\000\234\375`\206t\276\264\300\017\203\206\371\302oz\202\331\333\003w\236BL\300\361\316>\"\022@\340x\273\270\2179v\275\347\270i]\253\303\275\017\234\215\330qd\021%\014\337}3\364]\247\261\200\236\262O8\036{\027\207,\320)\374O\244\032T\251\360\3536\312\025\276\242\267H\342\022\306\003.dC\027\3033\304\037\330R\371\353\204\352\272\246\207\017\021\034\376\367\312\211\317\305\030\233\320\016\370]\243\235\347\000|\362Vax\013[""\374\255r\014O(\213\032\374\375\033\214L;\251O\351/\256\217\236\255\234\375\346\334w\266\333\243_\331\213\016q\216.\322\323N\332M\271\223\356\366G\241\235\236\016\246\037zK\336\272\237b\253\311`2\\\2156\013\347\251\330'R-\371\343\376\254\257\264\026\317\311e\325\202\227\361V\274\017\301\223\342\271\022\274\373%R\267o\217\267o\177eg\354\245\217\302\247\277\366g\003z&\276\321\036\035;k@V\327\334e\027\204_\333\277B\202\343\355\364X06\343\0341\343\005G`\301&&/\3227!\310\251m@\230\267n\315#]-\0135e\377\344\216\273\263\256\342\3177\237\266>\004\273\345\236L\341\264a\246|\305\"\231\366\252\263\355\2208\241\037\233\251&\217\364w\347K\227\270\246\367\324\037j\373\254\271\335$\241\355-w\333\225\274E\237\014\263}\336\247\236\264_\303&#n\301\277\346\377\253y\277\271\327*\004\245n\347\037{G\376\210/\004\337o\264H\353\250}\373^\002M\213\236\340\225\375;\315\375\363\361^\240\305\335\275\357\357\267zu\337\271\333= \315\004k\345\240\274\027\354\3757\001\375\353\355\321\t\373\271\233\365\306\275\014\300\353\354\377\000\234.T\277\231\276\030\275m\247\354\361(\215G\336\266'\371\213M\345<\323\263\325\224\3756\270\367\017\377/\254N\355\231\271`\356i3\337\232h\t\355\357r\336a\363\373\326\265\326R{\341aX\352.z\227\375%_\370t\343\213\353\367\234}\357\033?\345\003\300\263\356\021+\324&@Er\027\301\371IK\tvv\343\234\030X\227\"\340\316C\322\263\036\211V9\217x\246\317t\343\0178N\271\031\234\357\3133\321\236\014\246\262\256\001G\234\n\253\\hA?/\322w\235_\274\277\201 \325N\317\272\002\333\370\225#8e\367\216\367\316\377\320ZJ\234\221\331^J2\230\354\304\272u\276\037\274}\027Y\0073\371\326v\213\204\233\337\032;3\354\331\340\3539\300\267\300V:K\345\0010\003R\231\211\320\220\032b\313WYv\222\366T&js\346c\252=\262\020,\254Av#7\317\236;YPt\204\257`B""\365\no\234=\264\267\203\221\2730`\322?0\014\264V\000Z\320\207g\3165\207\237\357!#\345Ez\306\261\\\016\360U{\327I%\0247\317\376\r\260\005B\264\247\3562\211\323\360R\027\351q\373.t\003\376\314\270\260\032;;\nF\336\262\022\260F\254\370\202_n\336\t\362\00051\020\245`\004(\333Ng\334)\227\307{b\277w'`\263(\336o\014x\023\3663(\005T\231\201\221\003\021\".0\315\264s\275s\364\337\001\226\366\350\375"; + PyObject *data = __Pyx_DecompressString(cstring, 2209, 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 (5327 bytes) */ +const char* const bytes = "'.Failed to convert C string to Python string.Failed to extend graph with DrawPlanar structures.Failed to extend graph with K23Search structures.Failed to extend graph with K33Search structures.Failed to extend graph with K4Search structures.Failed to extend graph with Outerplanarity structures.Failed to extend graph with Planarity structures.Failed to render embedding to C string.Failed to render embedding to file 'Graph is not initialized.Invalid destination graph: wrapped graphP is NULL.Invalid graph format specifier \"Invalid link index for ulink: 'Invalid link index for vlink: 'Invalid source graph: wrapped graphP is NULL.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 has 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 edge 'gp_DupGraph() failed.gp_EdgeInUse() failed: invalid edge index 'gp_EnsureEdgeCapacity() failed to set edge capacity to gp_GetFirstEdge() failed: invalid vertex intex 'gp_GetNeighbor() failed: invalid edge index 'gp_GetNextEdge() 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_CopyGraphGraph.gp_DeleteEdgeGraph.gp_DrawPlanar_RenderToFileGraph.gp_DrawPlanar_RenderToStringGraph.gp_DupGraphGraph.gp_EdgeArraySizeG""raph.gp_EdgeArrayStartGraph.gp_EdgeInUseGraph.gp_EdgeInUseArraySizeGraph.gp_EmbedGraph.gp_EnsureEdgeCapacityGraph.gp_ExtendWith_DrawPlanarGraph.gp_ExtendWith_K23SearchGraph.gp_ExtendWith_K33SearchGraph.gp_ExtendWith_K4SearchGraph.gp_ExtendWith_OuterplanarityGraph.gp_ExtendWith_PlanarityGraph.gp_FindEdgeGraph.gp_GetEdgeCapacityGraph.gp_GetFirstEdgeGraph.gp_GetFirstVertexGraph.gp_GetLastVertexGraph.gp_GetNGraph.gp_GetNeighborGraph.gp_GetNextEdgeGraph.gp_GetVertexDegreeGraph.gp_InitGraphGraph.gp_IsEdgeGraph.gp_IsVertexGraph.gp_ReadGraph.gp_ReinitializeGraphGraph.gp_TestEmbedResultIntegrityGraph.gp_VertexInRangeAscendingGraph.gp_WriteNILNONEMBEDDABLENOTOKOK__Pyx_PyDict_NextRefaasyncio.coroutinescline_in_tracebackcopy_of_orig_grapheembedFlagsembed_resultencodedencoded_version__func__gget_wrapper_for_graphP__getstate__gp_AddEdgegp_CopyGraphgp_DeleteEdgegp_DrawPlanar_RenderToFilegp_DrawPlanar_RenderToStringgp_DupGraphgp_EdgeArraySizegp_EdgeArrayStartgp_EdgeInUsegp_EdgeInUseArraySizegp_Embedgp_EnsureEdgeCapacitygp_ExtendWith_DrawPlanargp_ExtendWith_K23Searchgp_ExtendWith_K33Searchgp_ExtendWith_K4Searchgp_ExtendWith_Outerplanaritygp_ExtendWith_Planaritygp_FindEdgegp_GetEdgeCapacitygp_GetFirstEdgegp_GetFirstVertexgp_GetLastVertexgp_GetLibPlanarityVersionFullgp_GetNgp_GetNeighborgp_GetNextEdgegp_GetProjectVersionFullgp_GetVertexDegreegp_InitGraphgp_IsEdgegp_IsVertexgp_Readgp_ReinitializeGraphgp_TestEmbedResultIntegritygp_VertexInRangeAscendinggp_Writeinfile_nameint_is_coroutineitemsm__main__modemode_code__module__n__name__new_edge_capacitynew_graphnew_wrapperoutfile_nameplanarity.full.graphpop__pyx_state__qualname____reduce____reduce_cython____reduce_ex__renditionStringreturnself__set_name__setdefault__setstate____setstate_cython__src_graphsrc_graph_uninit_errorstring_conversion_error__test__theFileNametheGraph_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+\2501\250D\260\001\200A\330\010\024\320\024+\2501\250D\260\014\270L\310\001\330\014\022\220,\230a\230q\200A\330\010\024\320\0241\260\021\260$\260l\300,\310a\330\014\022\220,\230a\230q\200A\330\010\024\320\024*\250!\2504\250|\320;N\310l\320Z[\330\014\022\220,\230a\330\020\021\330\020\022\220!\2201\200A\360\006\000\t\014\2104\210{\230#\230Q\330\014\022\220,\230a\330\020\021\360\006\000\t\n\330\014\017\210y\230\010\240\003\2403\240a\330\020\026\220j\240\001\240\021\330\010\017\320\017\037\230q\330\014\022\220*\230A\330\020\021\330\023\024\340\010\013\2104\210x\220s\230#\230Y\240h\250a\330\014\022\220*\230A\330\020\021\360\006\000\t\025\220M\240\021\240$\240l\260)\270<\300|\320ST\330\014\022\220,\230a\230q\200A\330\010\030\320\030*\250!\2504\250q\200A\330\010\013\2104\210t\220:\230Q\230a\330\014\022\220,\230a\330\0208\270\001\270\021\360\006\000\t\031\230\016\240a\240t\250<\260q\200A\330\010\013\2104\210t\220:\230Q\230a\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\220:\230Q\230a\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\020B\300!\3001\360\006\000\t\031\320\030(\250\001\250\024\250\\\270\021\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\230\014\240A\240T\250\034\260S\270\001\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""\330\010\024\320\024,\250A\250T\260\034\270\\\310\021\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%\240Q\330\010\024\320\0241\260\021\260$\260l\300!\320CT\320TW\320WX\330\014\022\220,\230a\230q\340\010\t\330\014\023\220?\240'\250\021\250!\330\010\017\210}\230A\330\014\022\220,\230a\330\020\021\330\027\030\340\014\020\220\001\220\021\200A\330\010\024\320\024-\250Q\250d\260,\270l\310!\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'\240q\340\010\024\220I\230Q\230d\240,\250m\270;\300l\320RS\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\t\330\014\016\210c\220\024\320\025'\240s\250!\330\025/\250q\260\004\260L\300\001\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\340\010\035\230\\\250\027\260\001\260\021\330\010'\240q\340\010\024\320\024/\250q\260\004\260L\300\r\310\\\320YZ\330\014\022\220,\230a\320\037E\300Q\300a\200A\330\010\t\330\r\017\210s\220$\320\026(\250\004\250A\330\r\017\210r\220\024\320\025&\240d\250!\330\025\037\230q\240\004\240L\260\001\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!\200\001\330\004*\320*C\3001\330\004\013\210?\230'\240\021\240!\200\001\330\004*\320*H\310\001\330\004\013\210?\230'\240\021\240!\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 < 192; 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 >= 51) PyUnicode_InternInPlace(&string); if (unlikely(!string)) { Py_XDECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) @@ -10439,7 +11665,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 = 192; i < 226; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length); stringtab[i] = string; @@ -10450,15 +11676,15 @@ 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 < 226; i++) { if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { __PYX_ERR(0, 1, __pyx_L1_error) } } #if CYTHON_IMMORTAL_CONSTANTS { - PyObject **table = stringtab + 174; - for (Py_ssize_t i=0; i<31; ++i) { + PyObject **table = stringtab + 192; + for (Py_ssize_t i=0; i<34; ++i) { #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #if PY_VERSION_HEX < 0x030E0000 if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1) @@ -10530,179 +11756,204 @@ 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), 38}; - 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_graph_pyx, __pyx_mstate->__pyx_n_u_is_graph_NULL, __pyx_mstate->__pyx_kp_b_iso88591_A_t_c, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 28}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_encoded_version}; + __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetProjectVersionFull, __pyx_mstate->__pyx_kp_b_iso88591_C1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 33}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_encoded_version}; + __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetLibPlanarityVersionFull, __pyx_mstate->__pyx_kp_b_iso88591_H, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 41}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 50}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_new_wrapper}; - __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_get_wrapper_for_graphP, __pyx_mstate->__pyx_kp_b_iso88591_a_k_A_Qa_A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) 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_get_wrapper_for_graphP, __pyx_mstate->__pyx_kp_b_iso88591_a_k_A_Qa_A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 51}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 60}; 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[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_IsEdge, __pyx_mstate->__pyx_kp_b_iso88591_A_s_A_r_d_q_L, 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), 58}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 67}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; - __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetFirstEdge, __pyx_mstate->__pyx_kp_b_iso88591_A_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_EdgeArrayStart, __pyx_mstate->__pyx_kp_b_iso88591_A_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 61}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 70}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; - __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_EdgeInUse, __pyx_mstate->__pyx_kp_b_iso88591_A_4t9AQ_a_Qa_Qd_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) 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_EdgeInUse, __pyx_mstate->__pyx_kp_b_iso88591_A_4t_Qa_a_Qa_Qd_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), 69}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 78}; 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[6] = __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[6])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 72}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 81}; 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[7] = __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[7])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 75}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 84}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; - __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetFirstArc, __pyx_mstate->__pyx_kp_b_iso88591_A_4t_q_a_A_q_L, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetFirstEdge, __pyx_mstate->__pyx_kp_b_iso88591_A_4t_q_a_B_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 83}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 92}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; - __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetNextArc, __pyx_mstate->__pyx_kp_b_iso88591_A_4t9AQ_a_aq_at_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetNextEdge, __pyx_mstate->__pyx_kp_b_iso88591_A_4t_Qa_a_q_q_L, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 91}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 100}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; - __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetNeighbor, __pyx_mstate->__pyx_kp_b_iso88591_A_4t9AQ_a_q_q_L, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) 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_GetNeighbor, __pyx_mstate->__pyx_kp_b_iso88591_A_4t_Qa_a_q_q_L, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 99}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 108}; 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[11] = __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[11])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 106}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 115}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; - __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetFirstVertex, __pyx_mstate->__pyx_kp_b_iso88591_A_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetFirstVertex, __pyx_mstate->__pyx_kp_b_iso88591_A_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 109}; + 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[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetLastVertex, __pyx_mstate->__pyx_kp_b_iso88591_A_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) 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_GetLastVertex, __pyx_mstate->__pyx_kp_b_iso88591_A_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[13])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 112}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 121}; 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[14] = __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[14])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 118}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 127}; 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[15] = __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[15])) 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), 136}; 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; + __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_InitGraph, __pyx_mstate->__pyx_kp_b_iso88591_A_M_l_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[16])) 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), 140}; 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[17] = __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[17])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 133}; - 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 = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 143}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_src_graph, __pyx_mstate->__pyx_n_u_src_graph_uninit_error}; + __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_CopyGraph, __pyx_mstate->__pyx_kp_b_iso88591_A_4_Q_a_y_3a_j_q_A_4xs_Yha_A_M_l, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[18])) 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), 167}; 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; + __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_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[19])) 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), 184}; 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; + __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_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[20])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 172}; - 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, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 192}; + 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_theFileName}; + __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_Write, __pyx_mstate->__pyx_kp_b_iso88591_A_Y_0_S_E_A_m5_1_4q_A_31A_q_IQd, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[21])) 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), 212}; 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; + __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_FindEdge, __pyx_mstate->__pyx_kp_b_iso88591_A_4t_q_as_1_4t_q_as_1_AT_S, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[22])) 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), 220}; 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; + __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_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[23])) 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), 226}; 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; + __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_GetEdgeCapacity, __pyx_mstate->__pyx_kp_b_iso88591_A_1D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[24])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 209}; - 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 = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 229}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_new_edge_capacity}; + __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_EnsureEdgeCapacity, __pyx_mstate->__pyx_kp_b_iso88591_A_4_NlZ_a_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[25])) 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), 235}; 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; + __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_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[26])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 250}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; + __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_DeleteEdge, __pyx_mstate->__pyx_kp_b_iso88591_A_4t_Qa_a_8_at_q, 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), 258}; + 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_ExtendWith_Planarity, __pyx_mstate->__pyx_kp_b_iso88591_A_AT_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), 262}; + 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_ExtendWith_DrawPlanar, __pyx_mstate->__pyx_kp_b_iso88591_A_Qd_l_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[29])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 266}; + 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_theFileName}; + __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_DrawPlanar_RenderToFile, __pyx_mstate->__pyx_kp_b_iso88591_A_q_q_L_YZ_a_EQa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[30])) 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 = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 274}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_renditionString, __pyx_mstate->__pyx_n_u_string_conversion_error}; + __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_DrawPlanar_RenderToString, __pyx_mstate->__pyx_kp_b_iso88591_A_Q_1_l_CTTWWX_aq_A_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[31])) 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), 288}; 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; + __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_ExtendWith_Outerplanarity, __pyx_mstate->__pyx_kp_b_iso88591_A_1_l_a_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[32])) 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), 292}; 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; + __pyx_mstate_global->__pyx_codeobj_tab[33] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ExtendWith_K23Search, __pyx_mstate->__pyx_kp_b_iso88591_A_AT_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[33])) 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), 296}; 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; + __pyx_mstate_global->__pyx_codeobj_tab[34] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ExtendWith_K33Search, __pyx_mstate->__pyx_kp_b_iso88591_A_AT_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[34])) 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), 300}; 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; + __pyx_mstate_global->__pyx_codeobj_tab[35] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ExtendWith_K4Search, __pyx_mstate->__pyx_kp_b_iso88591_A_1D_L_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[35])) 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), 304}; 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; + __pyx_mstate_global->__pyx_codeobj_tab[36] = __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[36])) 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), 307}; 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; + __pyx_mstate_global->__pyx_codeobj_tab[37] = __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[37])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; - __pyx_mstate_global->__pyx_codeobj_tab[33] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[33])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[38] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[38])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state}; - __pyx_mstate_global->__pyx_codeobj_tab[34] = __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[34])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[39] = __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[39])) goto bad; } Py_DECREF(tuple_dedup_map); return 0; @@ -11020,6 +12271,33 @@ CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, Py #endif #endif +/* decode_c_bytes (used by decode_bytes) */ +static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( + const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, + const char* encoding, const char* errors, + PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { + if (unlikely((start < 0) | (stop < 0))) { + if (start < 0) { + start += length; + if (start < 0) + start = 0; + } + if (stop < 0) + stop += length; + } + if (stop > length) + stop = length; + if (unlikely(stop <= start)) + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_unicode); + length = stop - start; + cstring += start; + if (decode_func) { + return decode_func(cstring, length, errors); + } else { + return PyUnicode_Decode(cstring, length, encoding, errors); + } +} + /* RaiseArgTupleInvalid */ static void __Pyx_RaiseArgtupleInvalid( const char* func_name, @@ -12408,101 +13686,515 @@ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *nam extra_info = __pyx_mstate_global->__pyx_kp_u_Note_that_Cython_is_deliberately; } } - type_name = __Pyx_PyType_GetFullyQualifiedName(type); - obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME - ", got " __Pyx_FMT_TYPENAME ")" -#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 - "%s%U" + type_name = __Pyx_PyType_GetFullyQualifiedName(type); + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME + ", got " __Pyx_FMT_TYPENAME ")" +#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 + "%s%U" +#endif + , name, type_name, obj_type_name +#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 + , (from_annotation_subclass ? ". " : ""), extra_info +#endif + ); +#if __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + if (exact == 2 && from_annotation_subclass) { + PyObject *res; + PyObject *vargs[2]; + vargs[0] = PyErr_GetRaisedException(); + vargs[1] = extra_info; + res = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_kp_u_add_note, vargs, 2, NULL); + Py_XDECREF(res); + PyErr_SetRaisedException(vargs[0]); + } +#endif + __Pyx_DECREF_TypeName(type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* PyLongCompare */ +static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_UNUSED_VAR(inplace); + if (op1 == op2) { + return 1; + } + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op1))) { + int unequal; + unsigned long uintval; + Py_ssize_t size = __Pyx_PyLong_DigitCount(op1); + const digit* digits = __Pyx_PyLong_Digits(op1); + if (intval == 0) { + return (__Pyx_PyLong_IsZero(op1) == 1); + } else if (intval < 0) { + if (__Pyx_PyLong_IsNonNeg(op1)) + return 0; + intval = -intval; + } else { + if (__Pyx_PyLong_IsNeg(op1)) + return 0; + } + uintval = (unsigned long) intval; +#if PyLong_SHIFT * 4 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 4)) { + unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 3 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 3)) { + unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 2 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 2)) { + unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 1 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 1)) { + unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif + unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); + return (unequal == 0); + } + #endif + if (PyFloat_CheckExact(op1)) { + const long b = intval; + double a = __Pyx_PyFloat_AS_DOUBLE(op1); + return ((double)a == (double)b); + } + return __Pyx_PyObject_IsTrueAndDecref( + PyObject_RichCompare(op1, op2, Py_EQ)); +} + +/* GetTopmostException (used by SaveResetException) */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * +__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) +{ + _PyErr_StackItem *exc_info = tstate->exc_info; + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && + exc_info->previous_item != NULL) + { + exc_info = exc_info->previous_item; + } + return exc_info; +} +#endif + +/* SaveResetException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; + } else { + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); + } + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + *type = exc_info->exc_type; + *value = exc_info->exc_value; + *tb = exc_info->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #endif +} +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = type; + exc_info->exc_value = value; + exc_info->exc_traceback = tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); + #endif +} +#endif + +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* GetException */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) +#endif +{ + PyObject *local_type = NULL, *local_value, *local_tb = NULL; +#if CYTHON_FAST_THREAD_STATE + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030C0000 + local_value = tstate->current_exception; + tstate->current_exception = 0; + #else + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + #endif +#elif __PYX_LIMITED_VERSION_HEX > 0x030C0000 + local_value = PyErr_GetRaisedException(); +#else + PyErr_Fetch(&local_type, &local_value, &local_tb); +#endif +#if __PYX_LIMITED_VERSION_HEX > 0x030C0000 + if (likely(local_value)) { + local_type = (PyObject*) Py_TYPE(local_value); + Py_INCREF(local_type); + local_tb = PyException_GetTraceback(local_value); + } +#else + PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_FAST_THREAD_STATE + if (unlikely(tstate->curexc_type)) +#else + if (unlikely(PyErr_Occurred())) +#endif + goto bad; + if (local_tb) { + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + } +#endif // __PYX_LIMITED_VERSION_HEX > 0x030C0000 + Py_XINCREF(local_tb); + Py_XINCREF(local_type); + Py_XINCREF(local_value); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_FAST_THREAD_STATE + #if CYTHON_USE_EXC_INFO_STACK + { + _PyErr_StackItem *exc_info = tstate->exc_info; + #if PY_VERSION_HEX >= 0x030B00a4 + tmp_value = exc_info->exc_value; + exc_info->exc_value = local_value; + tmp_type = NULL; + tmp_tb = NULL; + Py_XDECREF(local_type); + Py_XDECREF(local_tb); + #else + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = local_type; + exc_info->exc_value = local_value; + exc_info->exc_traceback = local_tb; + #endif + } + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#elif __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + PyErr_SetHandledException(local_value); + Py_XDECREF(local_value); + Py_XDECREF(local_type); + Py_XDECREF(local_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif + return 0; +#if __PYX_LIMITED_VERSION_HEX <= 0x030C0000 +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; +#endif +} + +/* SwapException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_value = exc_info->exc_value; + exc_info->exc_value = *value; + if (tmp_value == NULL || tmp_value == Py_None) { + Py_XDECREF(tmp_value); + tmp_value = NULL; + tmp_type = NULL; + tmp_tb = NULL; + } else { + tmp_type = (PyObject*) Py_TYPE(tmp_value); + Py_INCREF(tmp_type); + #if CYTHON_COMPILING_IN_CPYTHON + tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback; + Py_XINCREF(tmp_tb); + #else + tmp_tb = PyException_GetTraceback(tmp_value); + #endif + } + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = *type; + exc_info->exc_value = *value; + exc_info->exc_traceback = *tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; + #endif + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} #endif - , name, type_name, obj_type_name -#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 - , (from_annotation_subclass ? ". " : ""), extra_info + +/* PyUnicode_Unicode */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj) { + if (unlikely(obj == Py_None)) + obj = __pyx_mstate_global->__pyx_kp_u_None; + return __Pyx_NewRef(obj); +} + +/* PyObjectGetAttrStrNoError (used by GetBuiltinName) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} #endif - ); -#if __PYX_LIMITED_VERSION_HEX >= 0x030C0000 - if (exact == 2 && from_annotation_subclass) { - PyObject *res; - PyObject *vargs[2]; - vargs[0] = PyErr_GetRaisedException(); - vargs[1] = extra_info; - res = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_kp_u_add_note, vargs, 2, NULL); - Py_XDECREF(res); - PyErr_SetRaisedException(vargs[0]); +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + (void) PyObject_GetOptionalAttr(obj, attr_name, &result); + return result; +#else +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); } #endif - __Pyx_DECREF_TypeName(type_name); - __Pyx_DECREF_TypeName(obj_type_name); - return 0; + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +#endif } -/* PyLongCompare */ -static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) { - CYTHON_MAYBE_UNUSED_VAR(intval); - CYTHON_UNUSED_VAR(inplace); - if (op1 == op2) { - return 1; +/* GetBuiltinName (used by GetModuleGlobalName) */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, + "name '%U' is not defined", name); } - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - int unequal; - unsigned long uintval; - Py_ssize_t size = __Pyx_PyLong_DigitCount(op1); - const digit* digits = __Pyx_PyLong_Digits(op1); - if (intval == 0) { - return (__Pyx_PyLong_IsZero(op1) == 1); - } else if (intval < 0) { - if (__Pyx_PyLong_IsNonNeg(op1)) - return 0; - intval = -intval; - } else { - if (__Pyx_PyLong_IsNeg(op1)) - return 0; - } - uintval = (unsigned long) intval; -#if PyLong_SHIFT * 4 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 4)) { - unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else -#endif -#if PyLong_SHIFT * 3 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 3)) { - unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else + return result; +} + +/* PyDictVersioning (used by GetModuleGlobalName) */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); #endif -#if PyLong_SHIFT * 2 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 2)) { - unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} #endif -#if PyLong_SHIFT * 1 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 1)) { - unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) #endif - unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); - return (unequal == 0); +{ + PyObject *result; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + if (!PyErr_Occurred()) + PyErr_SetNone(PyExc_NameError); + return NULL; } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = __Pyx_PyFloat_AS_DOUBLE(op1); - return ((double)a == (double)b); + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; } - return __Pyx_PyObject_IsTrueAndDecref( - PyObject_RichCompare(op1, op2, Py_EQ)); + PyErr_Clear(); +#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear(); + __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return result; + } +#else + result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); } -/* PyUnicode_Unicode */ -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj) { - if (unlikely(obj == Py_None)) - obj = __pyx_mstate_global->__pyx_kp_u_None; - return __Pyx_NewRef(obj); +/* decode_c_string */ +static CYTHON_INLINE PyObject* __Pyx_decode_c_string( + const char* cstring, Py_ssize_t start, Py_ssize_t stop, + const char* encoding, const char* errors, + PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { + Py_ssize_t length; + if (unlikely((start < 0) | (stop < 0))) { + size_t slen = strlen(cstring); + if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, + "c-string too long to convert to Python"); + return NULL; + } + length = (Py_ssize_t) slen; + if (start < 0) { + start += length; + if (start < 0) + start = 0; + } + if (stop < 0) + stop += length; + } + if (unlikely(stop <= start)) + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_unicode); + length = stop - start; + cstring += start; + if (decode_func) { + return decode_func(cstring, length, errors); + } else { + return PyUnicode_Decode(cstring, length, encoding, errors); + } } /* AllocateExtensionType */ @@ -12992,76 +14684,6 @@ static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k) { return result; } -/* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); - for (i=0; i= 0x030C00A6 - PyObject *current_exception = tstate->current_exception; - if (unlikely(!current_exception)) return 0; - exc_type = (PyObject*) Py_TYPE(current_exception); - if (exc_type == err) return 1; -#else - exc_type = tstate->curexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; -#endif - #if CYTHON_AVOID_BORROWED_REFS - Py_INCREF(exc_type); - #endif - if (unlikely(PyTuple_Check(err))) { - result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); - } else { - result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); - } - #if CYTHON_AVOID_BORROWED_REFS - Py_DECREF(exc_type); - #endif - return result; -} -#endif - -/* PyObjectGetAttrStrNoError (used by SetupReduce) */ -#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 -static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - __Pyx_PyErr_Clear(); -} -#endif -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { - PyObject *result; -#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 - (void) PyObject_GetOptionalAttr(obj, attr_name, &result); - return result; -#else -#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { - return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); - } -#endif - result = __Pyx_PyObject_GetAttrStr(obj, attr_name); - if (unlikely(!result)) { - __Pyx_PyObject_GetAttrStr_ClearAttributeError(); - } - return result; -#endif -} - /* SetupReduce */ static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { int ret; @@ -14551,32 +16173,6 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qual return op; } -/* PyDictVersioning (used by CLineInTraceback) */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { - PyObject **dictptr = NULL; - Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; - if (offset) { -#if CYTHON_COMPILING_IN_CPYTHON - dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); -#else - dictptr = _PyObject_GetDictPtr(obj); -#endif - } - return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; -} -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) - return 0; - return obj_dict_version == __Pyx_get_object_dict_version(obj); -} -#endif - /* CLineInTraceback (used by AddTraceback) */ #if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 diff --git a/planarity/full/graph.pyx b/planarity/full/graph.pyx index 55c8fac..3f64faa 100644 --- a/planarity/full/graph.pyx +++ b/planarity/full/graph.pyx @@ -7,6 +7,8 @@ Wraps a graphP struct using a Cython class and wraps functions and macros that operate over graphP structs. """ +from libc.stdlib cimport free + from planarity.full cimport cappconst from planarity.full cimport cgraphLib @@ -23,6 +25,16 @@ EMBEDFLAGS_SEARCHFORK33 = cgraphLib.EMBEDFLAGS_SEARCHFORK33 EMBEDFLAGS_SEARCHFORK4 = cgraphLib.EMBEDFLAGS_SEARCHFORK4 +def gp_GetProjectVersionFull(): + cdef bytes encoded_version = cgraphLib.gp_GetProjectVersionFull() + return encoded_version.decode('utf-8') + + +def gp_GetLibPlanarityVersionFull(): + cdef bytes encoded_version = cgraphLib.gp_GetLibPlanarityVersionFull() + return encoded_version.decode('utf-8') + + cdef class Graph: def __cinit__(self): global global_id_count @@ -35,9 +47,6 @@ cdef class Graph: if self._theGraph != NULL and self.owns_graphP: cgraphLib.gp_Free(&self._theGraph) - def is_graph_NULL(self): - return self._theGraph == NULL - def get_wrapper_for_graphP(self) -> Graph: cdef Graph new_wrapper = Graph() @@ -48,48 +57,48 @@ cdef class Graph: new_wrapper.owns_graphP = False return new_wrapper - def gp_IsArc(self, int e): + def gp_IsEdge(self, int e): return ( - (e >= self.gp_GetFirstEdge()) and - (e < self.gp_EdgeIndexBound()) and - cgraphLib.gp_IsArc(e) + (e >= self.gp_EdgeArrayStart()) and + (e < self.gp_EdgeArraySize()) and + cgraphLib.gp_IsEdge(self._theGraph, e) ) - def gp_GetFirstEdge(self): - return cgraphLib.gp_GetFirstEdge(self._theGraph) + def gp_EdgeArrayStart(self): + return cgraphLib.gp_EdgeArrayStart(self._theGraph) def gp_EdgeInUse(self, int e): - if not self.gp_IsArc(e): + if not self.gp_IsEdge(e): raise RuntimeError( f"gp_EdgeInUse() failed: invalid edge index '{e}'." ) 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): + def gp_GetFirstEdge(self, int v): if not self.gp_IsVertex(v): raise RuntimeError( - f"gp_GetFirstArc() failed: invalid vertex intex '{v}'." + f"gp_GetFirstEdge() failed: invalid vertex intex '{v}'." ) - return cgraphLib.gp_GetFirstArc(self._theGraph, v) + return cgraphLib.gp_GetFirstEdge(self._theGraph, v) - def gp_GetNextArc(self, int e): - if not self.gp_IsArc(e): + def gp_GetNextEdge(self, int e): + if not self.gp_IsEdge(e): raise RuntimeError( - f"gp_GetNextArc() failed: invalid edge index '{e}'." + f"gp_GetNextEdge() failed: invalid edge index '{e}'." ) - return cgraphLib.gp_GetNextArc(self._theGraph, e) + return cgraphLib.gp_GetNextEdge(self._theGraph, e) def gp_GetNeighbor(self, int e): - if not self.gp_IsArc(e): + if not self.gp_IsEdge(e): raise RuntimeError( f"gp_GetNeighbor() failed: invalid edge index '{e}'." ) @@ -100,7 +109,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 +118,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,14 +143,24 @@ 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 self._theGraph == NULL: + raise RuntimeError( + "Invalid destination graph: wrapped graphP is NULL." + ) + + try: + if src_graph.gp_GetN() == 0: + raise ValueError("Source graph has not been initialized.") + except RuntimeError as src_graph_uninit_error: raise ValueError( - "Source graph either has not been allocated or not been " - "initialized.") - if self.gp_getN() != src_graph.gp_getN(): + "Invalid source graph: wrapped graphP is NULL." + ) from src_graph_uninit_error + + if self.gp_GetN() != src_graph.gp_GetN(): raise ValueError( "Source and destination graphs must have the same order " "to copy graphP struct.") + if cgraphLib.gp_CopyGraph(self._theGraph, src_graph._theGraph) != cappconst.OK: raise RuntimeError(f"gp_CopyGraph() failed.") @@ -182,20 +202,20 @@ cdef class Graph: # 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 + cdef const char *theFileName = encoded - if cgraphLib.gp_Write(self._theGraph, FileName, mode_code) != cappconst.OK: + if cgraphLib.gp_Write(self._theGraph, theFileName, mode_code) != cappconst.OK: raise RuntimeError( f"gp_Write() of graph to '{outfile_name}' failed." ) - def gp_GetNeighborEdgeRecord(self, int u, int v): + def gp_FindEdge(self, int u, int v): if not self.gp_IsVertex(u): 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.") - return cgraphLib.gp_GetNeighborEdgeRecord(self._theGraph, u, v) + return cgraphLib.gp_FindEdge(self._theGraph, u, v) def gp_GetVertexDegree(self, int v): if not self.gp_IsVertex(v): @@ -203,14 +223,14 @@ cdef class Graph: return cgraphLib.gp_GetVertexDegree(self._theGraph, v) - def gp_GetArcCapacity(self): - return cgraphLib.gp_GetArcCapacity(self._theGraph) + def gp_GetEdgeCapacity(self): + return cgraphLib.gp_GetEdgeCapacity(self._theGraph) - def gp_EnsureArcCapacity(self, int new_arc_capacity): - if cgraphLib.gp_EnsureArcCapacity(self._theGraph, new_arc_capacity) != cappconst.OK: + def gp_EnsureEdgeCapacity(self, int new_edge_capacity): + if cgraphLib.gp_EnsureEdgeCapacity(self._theGraph, new_edge_capacity) != cappconst.OK: raise RuntimeError( - "gp_EnsureArcCapacity() failed to set capacity to " - f"{new_arc_capacity}.") + "gp_EnsureEdgeCapacity() failed to set edge capacity to " + f"{new_edge_capacity}.") def gp_AddEdge(self, int u, int ulink, int v, int vlink): if ulink != 0 and ulink != 1: @@ -227,33 +247,59 @@ cdef class Graph: f"and vlink = {vlink}." ) - def gp_DeleteEdge(self, int e, int nextLink): - if not self.gp_IsArc(e): - raise RuntimeError( - f"gp_DeleteEdge() failed: invalid arc '{e}'." - ) - if nextLink != 0 and nextLink != 1: + def gp_DeleteEdge(self, int e): + if not self.gp_IsEdge(e): raise RuntimeError( - f"Invalid link index for nextLink: '{nextLink}'." + f"gp_DeleteEdge() failed: invalid edge '{e}'." ) - - return cgraphLib.gp_DeleteEdge(self._theGraph, e, nextLink) - def gp_AttachDrawPlanar(self): - if cgraphLib.gp_AttachDrawPlanar(self._theGraph) != cappconst.OK: - raise RuntimeError("Failed to attach DrawPlanar algorithm.") + return cgraphLib.gp_DeleteEdge(self._theGraph, e) + + def gp_ExtendWith_Planarity(self): + if cgraphLib.gp_ExtendWith_Planarity(self._theGraph) != cappconst.OK: + raise RuntimeError("Failed to extend graph with Planarity structures.") + + def gp_ExtendWith_DrawPlanar(self): + if cgraphLib.gp_ExtendWith_DrawPlanar(self._theGraph) != cappconst.OK: + raise RuntimeError("Failed to extend graph with DrawPlanar structures.") + + def gp_DrawPlanar_RenderToFile(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 *theFileName = encoded + + if cgraphLib.gp_DrawPlanar_RenderToFile(self._theGraph, theFileName) != cappconst.OK: + raise RuntimeError(f"Failed to render embedding to file '{outfile_name}'.") + + def gp_DrawPlanar_RenderToString(self): + cdef char* renditionString = NULL + if cgraphLib.gp_DrawPlanar_RenderToString(self._theGraph, &renditionString) != OK: + raise RuntimeError(f"Failed to render embedding to C string.") + + try: + return renditionString.decode('ascii') + except Exception as string_conversion_error: + raise RuntimeError( + "Failed to convert C string to Python string." + ) from string_conversion_error + finally: + free(renditionString) + + def gp_ExtendWith_Outerplanarity(self): + if cgraphLib.gp_ExtendWith_Outerplanarity(self._theGraph) != cappconst.OK: + raise RuntimeError("Failed to extend graph with Outerplanarity structures.") - def gp_AttachK23Search(self): - if cgraphLib.gp_AttachK23Search(self._theGraph) != cappconst.OK: - raise RuntimeError("Failed to attach K23Search algorithm.") + def gp_ExtendWith_K23Search(self): + if cgraphLib.gp_ExtendWith_K23Search(self._theGraph) != cappconst.OK: + raise RuntimeError("Failed to extend graph with K23Search structures.") - def gp_AttachK33Search(self): - if cgraphLib.gp_AttachK33Search(self._theGraph) != cappconst.OK: - raise RuntimeError("Failed to attach K33Search algorithm.") + def gp_ExtendWith_K33Search(self): + if cgraphLib.gp_ExtendWith_K33Search(self._theGraph) != cappconst.OK: + raise RuntimeError("Failed to extend graph with K33Search structures.") - def gp_AttachK4Search(self): - if cgraphLib.gp_AttachK4Search(self._theGraph) != cappconst.OK: - raise RuntimeError("Failed to attach K4Search algorithm.") + def gp_ExtendWith_K4Search(self): + if cgraphLib.gp_ExtendWith_K4Search(self._theGraph) != cappconst.OK: + raise RuntimeError("Failed to extend graph with K4Search structures.") def gp_Embed(self, int embedFlags) -> int: return cgraphLib.gp_Embed(self._theGraph, embedFlags) diff --git a/planarity/full/planarity_app_utils.py b/planarity/full/planarity_app_utils.py deleted file mode 100644 index 6f38bd4..0000000 --- a/planarity/full/planarity_app_utils.py +++ /dev/null @@ -1,90 +0,0 @@ -"""Utilities to support planarity app implementation""" - -from planarity import Graph -from planarity import ( - EMBEDFLAGS_PLANAR, - EMBEDFLAGS_DRAWPLANAR, - EMBEDFLAGS_OUTERPLANAR, - EMBEDFLAGS_SEARCHFORK23, - EMBEDFLAGS_SEARCHFORK33, - EMBEDFLAGS_SEARCHFORK4, -) - -__all__ = [ - "PLANARITY_ALGORITHM_SPECIFIERS", - "ENSURE_ARC_CAPACITY_SPECIFIERS", - "attach_algorithm", - "get_embed_flags", - "max_num_edges_for_order", -] - - -def PLANARITY_ALGORITHM_SPECIFIERS() -> tuple[str, ...]: - """Returns immutable tuple containing algorithm command specifiers""" - return ("p", "d", "o", "2", "3", "4") - - -def ENSURE_ARC_CAPACITY_SPECIFIERS() -> tuple[str, ...]: - """Graph algorithm extensions requiring ensure arc capacity before attaching""" - return ("d", "3", "4") - - -def attach_algorithm(theGraph: Graph, command: str) -> None: - """Attach the specified algorithm to the graph. - - Args: - graph: The Graph object to which the algorithm will be attached. - command: The algorithm command specifier - - Raises: - ValueError: If the command is not recognized - RuntimeError: If the underlying C function to attach the graph - algorithm extension fails. - """ - if command not in PLANARITY_ALGORITHM_SPECIFIERS(): - raise ValueError(f"Unsupported algorithm specifier: {command}") - - command_attach_extension_function_correspondence = { - "d": theGraph.gp_AttachDrawPlanar, - "2": theGraph.gp_AttachK23Search, - "3": theGraph.gp_AttachK33Search, - "4": theGraph.gp_AttachK4Search, - } - - command_attach_extension_function_correspondence.get( - command, lambda *a, **k: None - )() - - -def get_embed_flags(command: str) -> int: - """Get embedFlags corresponding to the command - - Args: - command: The algorithm command specifier - - Returns: - int: The corresponding embed flag from the C graphLib exposed by the - Cython wrapper. - - Raises: - ValueError: If an invalid command is provided - """ - command_embed_flag_correspondence = { - "p": EMBEDFLAGS_PLANAR, - "d": EMBEDFLAGS_DRAWPLANAR, - "o": EMBEDFLAGS_OUTERPLANAR, - "2": EMBEDFLAGS_SEARCHFORK23, - "3": EMBEDFLAGS_SEARCHFORK33, - "4": EMBEDFLAGS_SEARCHFORK4, - } - - embed_flags = command_embed_flag_correspondence.get(command) - if embed_flags is None: - raise ValueError(f"Unsupported algorithm specifier: {command}") - - return embed_flags - - -def max_num_edges_for_order(order: int) -> int: - """Returns max number of edges possible for given graph order""" - return (int)((order * (order - 1)) / 2)