Analysis Software
Documentation for sPHENIX simulation software
|
Tests if a graph can be drawn on a plane without any edge crossings. More...
#include <JETSCAPE/blob/main/external_packages/gtl/include/GTL/planarity.h>
Public Member Functions | |
planarity () | |
Creates an object of the planarity test algorithm. | |
~planarity () | |
Destructor. | |
int | check (graph &G) |
Checks whether planarity test can be applied to G . | |
int | run (graph &G) |
Runs planarity test on G . | |
void | reset () |
Resets algorithm object, such that it can be applied to another graph. | |
void | calc_embedding (bool p) |
If p is true a planar embedding will be calculated in the next run. | |
bool | calc_embedding () const |
Returns true if a planar embedding will be calculated in the next run. | |
void | calc_obstruction (bool p) |
If p is true the obstructions to planarity will be calculated in the next run. | |
bool | calc_obstruction () const |
Returns true if the obstructions to planarity will be calculated in the next run. | |
void | make_biconnected (bool p) |
Determines the strategy used to test a graph which is not biconnected. | |
bool | make_biconnected () const |
Returns strategy for testing graphs, which are not biconnected. | |
bool | is_planar () const |
Result of last test. | |
planar_embedding & | get_embedding () |
If graph in last run was planar a planar embedding is calculated during the reductions. This function gives access to it. | |
list< edge > & | get_obstruction_edges () |
Returns the edges of a subgraph homeomorphic to either K3,3 or K5 if graph in last run was not planar. | |
list< node > & | get_obstruction_nodes () |
Returns the nodes of a subgraph homeomorphic to either K3,3 or K5 if graph in last run was not planar. | |
Public Member Functions inherited from algorithm | |
algorithm () | |
Creates an algorithm object. | |
virtual | ~algorithm () |
Destroys the algorithm object. | |
Private Attributes | |
list< edge > | ob_edges |
list< node > | ob_nodes |
planar_embedding | embedding |
bool | planar |
bool | emp |
bool | kup |
bool | bip |
Additional Inherited Members | |
Public Types inherited from algorithm | |
enum | { GTL_OK = 1, GTL_ERROR = 0 } |
Return values for algorithm::check and algorithm::run. More... | |
Tests if a graph can be drawn on a plane without any edge crossings.
This class implements the Lempel-Even-Cederbaum planarity test using PQ-trees. In case the graph is planar a planar embedding is obtained, i.e. for each node in the graph an ordered adjacency list is calculated, such that there exists a planar drawing in which all adjacent edges around a node apply to this order.
If the graph is not planar Kuratowski's famous theorem states that it must contain a subgraph hoemeomorphic to either K5 (the complete graph with five nodes) or K3,3 (the complete bipartite graph with three nodes each side). In this case the nodes and edges of the tested graph that form either of these two are calculated.
In case the graph is planar and has nodes the algorithm needs time for the test (including the planar embedding). In case the graph isn't planar it needs at most time if is the number of edges for both the test and the detection of K5 or K3,3.
Definition at line 47 of file planarity.h.
View newest version in sPHENIX GitHub at line 47 of file planarity.h
__GTL_BEGIN_NAMESPACE planarity::planarity | ( | ) |
Creates an object of the planarity test algorithm.
Definition at line 37 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 37 of file planarity.cpp
References GTL_debug::init_debug().
planarity::~planarity | ( | ) |
Destructor.
Definition at line 45 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 45 of file planarity.cpp
References GTL_debug::close_debug().
|
private |
Definition at line 431 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 431 of file planarity.cpp
References planar_embedding::adj_edges_begin(), planar_embedding::adj_edges_end(), planar_embedding::adjacency(), embedding, end, forall_nodes, it, planar_embedding::multi, n, planar_embedding::pos(), planar_embedding::self, and symlist< T >::splice().
Referenced by run().
|
private |
Definition at line 1581 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 1581 of file planarity.cpp
References planar_embedding::adjacency(), planar_embedding::cyclic_next(), symlist< T >::front(), next, ob_edges, and node::opposite().
Referenced by examine_obstruction().
|
inline |
If p
is true a planar embedding will be calculated in the next run.
p | true iff embedding should be calculated |
Definition at line 118 of file planarity.h.
View newest version in sPHENIX GitHub at line 118 of file planarity.h
References merge_hashes::p.
|
inline |
Returns true if a planar embedding will be calculated in the next run.
true | iff embedding will be calculated |
Definition at line 133 of file planarity.h.
View newest version in sPHENIX GitHub at line 133 of file planarity.h
|
inline |
If p
is true the obstructions to planarity will be calculated in the next run.
This implies the calculation of an embedding.
p | true iff obstructions to planarity should be calculated |
Definition at line 147 of file planarity.h.
View newest version in sPHENIX GitHub at line 147 of file planarity.h
References merge_hashes::p.
|
inline |
Returns true if the obstructions to planarity will be calculated in the next run.
true | iff obstructions to planarity will be calculated |
Definition at line 162 of file planarity.h.
View newest version in sPHENIX GitHub at line 162 of file planarity.h
|
private |
Definition at line 902 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 902 of file planarity.cpp
References assert, symlist< T >::begin(), cur(), end, i, it, n, pq_node::n, ob_edges, ob_nodes, p_node::partial_sons, q_node::Q(), run_through_partial(), st_number::s_node(), edge::source(), st_number::st_edge(), edge::target(), Acts::Test::tmp(), and up_until_marked().
Referenced by examine_obstruction().
|
private |
Definition at line 971 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 971 of file planarity.cpp
References node::adj_edges_begin(), node::adj_edges_end(), node::adj_edges_iterator(), assert, symlist< T >::begin(), end, symlist< T >::end(), p_node::full_sons, it, mark_all_neighbors_of_leaves(), pq_node::n, ob_edges, ob_nodes, node::opposite(), p_node::partial_sons, q_node::pert_begin, q_node::pert_end, q_node::Q(), run_through_partial(), st_number::s_node(), st_number::st_edge(), Acts::Test::tmp(), and up_until_marked().
Referenced by examine_obstruction().
|
private |
Definition at line 1062 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 1062 of file planarity.cpp
References assert, pq_leaf::e, i, n, pq_node::n, ob_edges, ob_nodes, node::opposite(), st_number::s_node(), st_number::st_edge(), Acts::Test::tmp(), and up_until_marked().
Referenced by examine_obstruction().
|
private |
Definition at line 1100 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 1100 of file planarity.cpp
References node::adj_edges_begin(), node::adj_edges_end(), node::adj_edges_iterator(), assert, symlist< T >::begin(), cur(), pq_leaf::e, end, symlist< T >::end(), i, it, mark_all_neighbors_of_leaves(), n, pq_node::n, ob_edges, ob_nodes, node::opposite(), st_number::s_node(), pq_node::sons, edge::source(), st_number::st_edge(), edge::target(), Acts::Test::tmp(), and up_until_marked().
Referenced by examine_obstruction().
|
private |
Definition at line 1227 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 1227 of file planarity.cpp
References node::adj_edges_begin(), node::adj_edges_end(), node::adj_edges_iterator(), assert, parse_cmake_options::begin, GTL_debug::debug_message(), pq_leaf::e, end, i, it, mark_all_neighbors_of_leaves(), n, pq_node::n, next, ob_edges, ob_nodes, node::opposite(), q_node::pert_begin, q_node::pert_end, Acts::Test::pos, st_number::s_node(), edge::source(), st_number::st_edge(), edge::target(), Acts::Test::tmp(), up_until_marked(), and y.
Referenced by examine_obstruction().
|
virtual |
Checks whether planarity test can be applied to G
.
This should return always GTL_OK
. There aren't any restrictions on G
, even multiple edges and selfloops are tolerated.
G | arbitrary graph |
GTL_OK | if planarity test can be applied |
GTL_ERROR | if not |
Implements algorithm.
Definition at line 53 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 53 of file planarity.cpp
References algorithm::GTL_OK.
|
private |
Definition at line 464 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 464 of file planarity.cpp
References planar_embedding::adjacency(), end, i, it, st_number::rbegin(), st_number::rend(), and symlist< T >::reverse().
Referenced by examine_obstruction(), and run_on_biconnected().
|
private |
Definition at line 1595 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 1595 of file planarity.cpp
References node::adj_edges_begin(), node::adj_edges_end(), node::adj_edges_iterator(), end, it, n, and node::opposite().
Referenced by examine_obstruction().
|
private |
Definition at line 559 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 559 of file planarity.cpp
References planar_embedding::adjacency(), attachment_cycle(), symlist< T >::begin(), case_A(), case_B(), case_C(), case_D(), case_E(), correct_embedding(), direction_indicator::D(), GTL_debug::debug_message(), dfs_bushform(), pq_node::DIR, direction_indicator::direction, symlist< T >::end(), symlist< T >::erase(), extend_embedding(), forall_nodes, ne_map< Key, Value, Graph, Alloc >::init(), ne_map< node, T, graph, Alloc >::init(), pq_node::kind(), pq_node::n, GTL_debug::os(), pq_node::P(), p_node::partial_count, q_node::partial_count, q_node::partial_pos, q_node::pert_begin, q_node::pert_cons, q_node::pert_end, pq_node::pos, pq_node::Q(), pq_node::Q_NODE, pq_tree::remove_dir_ind(), st_number::s_node(), search_empty_leaf(), search_full_leaf(), pq_node::sons, Acts::Test::tmp(), and planar_embedding::write_st().
Referenced by run_on_biconnected().
|
private |
Definition at line 503 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 503 of file planarity.cpp
References planar_embedding::adjacency(), end, symlist< T >::end(), it, n, node::opposite(), planar_embedding::pos(), and planar_embedding::push_front().
Referenced by examine_obstruction(), and run_on_biconnected().
|
inline |
If graph in last run was planar a planar embedding is calculated during the reductions. This function gives access to it.
Definition at line 220 of file planarity.h.
View newest version in sPHENIX GitHub at line 220 of file planarity.h
|
inline |
Returns the edges of a subgraph homeomorphic to either K3,3 or K5 if graph in last run was not planar.
Definition at line 234 of file planarity.h.
View newest version in sPHENIX GitHub at line 234 of file planarity.h
|
inline |
Returns the nodes of a subgraph homeomorphic to either K3,3 or K5 if graph in last run was not planar.
Definition at line 248 of file planarity.h.
View newest version in sPHENIX GitHub at line 248 of file planarity.h
|
inline |
Result of last test.
true | iff graph in last run was planar. |
Definition at line 207 of file planarity.h.
View newest version in sPHENIX GitHub at line 207 of file planarity.h
|
inline |
Determines the strategy used to test a graph which is not biconnected.
If this is enabled the graph will be made biconnected by adding some new edges. This is usually faster than testing the biconnected components one by one, which is done if this option is disabled. By default this is enabled.
p | true iff graph should be made biconnected |
Definition at line 184 of file planarity.h.
View newest version in sPHENIX GitHub at line 184 of file planarity.h
References merge_hashes::p.
|
inline |
Returns strategy for testing graphs, which are not biconnected.
true | iff graph will be made biconnected before test |
Definition at line 197 of file planarity.h.
View newest version in sPHENIX GitHub at line 197 of file planarity.h
Definition at line 1513 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 1513 of file planarity.cpp
References symlist< T >::begin(), end, symlist< T >::end(), it, pq_node::kind(), pq_node::LEAF, n, and pq_node::sons.
Referenced by case_B(), case_D(), and case_E().
|
virtual |
Resets algorithm object, such that it can be applied to another graph.
Implements algorithm.
Definition at line 457 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 457 of file planarity.cpp
|
virtual |
Runs planarity test on G
.
This should return always GTL_OK
. The return value only tracks errors that might occur, it is definitly not the result of the test itself. The result of the test is stored in a member variable and can be accessed via is_planar.
G | arbitrary graph |
GTL_OK | if planarity test was sucessfully applied |
GTL_ERROR | if not |
Implements algorithm.
Definition at line 332 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 332 of file planarity.cpp
References add_to_embedding(), biconnectivity::additional_begin(), biconnectivity::additional_end(), planar_embedding::adj, bip, biconnectivity::check(), biconnectivity::components_begin(), biconnectivity::components_end(), GTL_debug::debug_message(), graph::del_edge(), embedding, emp, end, algorithm::GTL_OK, planar_embedding::init(), biconnectivity::is_biconnected(), graph::is_directed(), it, biconnectivity::make_biconnected(), graph::make_directed(), graph::make_undirected(), GTL_debug::os(), planar, graph::restore_graph(), dfs::run(), run_on_biconnected(), physmon_simulation::s, planar_embedding::s_pos, biconnectivity::store_components(), switch_to_component(), t, and planar_embedding::t_pos.
|
private |
Definition at line 58 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 58 of file planarity.cpp
References planar_embedding::adj_edges_begin(), planar_embedding::adj_edges_end(), planar_embedding::adjacency(), assert, parse_cmake_options::begin, symlist< T >::begin(), st_number::begin(), st_number::check(), correct_embedding(), graph::edges_begin(), graph::edges_end(), emp, end, examine_obstruction(), extend_embedding(), filename, forall_nodes, pq_tree::get_fail(), pq_tree::get_frontier(), algorithm::GTL_OK, node::in_edges_begin(), node::in_edges_end(), ne_map< node, T, graph, Alloc >::init(), ne_map< Key, Value, Graph, Alloc >::init(), planar_embedding::init(), pq_tree::integrity_check(), pq_tree::is_fail_root(), kup, planar_embedding::multi, graph::number_of_edges(), graph::number_of_nodes(), node::opposite(), os, GTL_debug::os(), out, node::out_edges_begin(), node::out_edges_end(), pq_tree::reduce(), pq_tree::replace_pert(), pq_tree::reset(), st_number::run(), st_number::s_node(), planar_embedding::self, size, edge::source(), st_number::st_edge(), and Acts::Test::tmp().
Referenced by run().
|
private |
Definition at line 1527 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 1527 of file planarity.cpp
References assert, pq_leaf::e, pq_node::n, ob_edges, ob_nodes, node::opposite(), search_empty_leaf(), search_full_leaf(), Acts::Test::tmp(), and up_until_marked().
Referenced by case_A(), and case_B().
Definition at line 1495 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 1495 of file planarity.cpp
References assert, symlist< T >::begin(), pq_node::kind(), pq_node::L(), pq_node::LEAF, pq_node::P_NODE, pq_node::Q_NODE, and pq_node::sons.
Referenced by examine_obstruction(), and run_through_partial().
Definition at line 1478 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 1478 of file planarity.cpp
References assert, symlist< T >::end(), pq_node::kind(), pq_node::L(), pq_node::LEAF, pq_node::P_NODE, pq_node::Q_NODE, and pq_node::sons.
Referenced by examine_obstruction(), and run_through_partial().
|
private |
Definition at line 526 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 526 of file planarity.cpp
References dummy, end, graph::induced_subgraph(), it, graph::restore_edge(), and graph::restore_node().
Referenced by run().
|
private |
Definition at line 1547 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 1547 of file planarity.cpp
References next, ob_edges, and node::opposite().
Referenced by case_A(), case_B(), case_C(), case_D(), case_E(), and run_through_partial().
Definition at line 1559 of file planarity.cpp.
View newest version in sPHENIX GitHub at line 1559 of file planarity.cpp
References node::adj_edges_begin(), node::adj_edges_end(), node::adj_edges_iterator(), assert, end, it, ob_edges, and node::opposite().
|
private |
Definition at line 611 of file planarity.h.
View newest version in sPHENIX GitHub at line 611 of file planarity.h
Referenced by run().
|
private |
Definition at line 591 of file planarity.h.
View newest version in sPHENIX GitHub at line 591 of file planarity.h
Referenced by add_to_embedding(), and run().
|
private |
Definition at line 601 of file planarity.h.
View newest version in sPHENIX GitHub at line 601 of file planarity.h
Referenced by run(), and run_on_biconnected().
|
private |
Definition at line 606 of file planarity.h.
View newest version in sPHENIX GitHub at line 606 of file planarity.h
Referenced by run_on_biconnected().
|
private |
Definition at line 581 of file planarity.h.
View newest version in sPHENIX GitHub at line 581 of file planarity.h
Referenced by attachment_cycle(), case_A(), case_B(), case_C(), case_D(), case_E(), reset(), run_through_partial(), and up_until_marked().
|
private |
Definition at line 586 of file planarity.h.
View newest version in sPHENIX GitHub at line 586 of file planarity.h
Referenced by case_A(), case_B(), case_C(), case_D(), case_E(), reset(), and run_through_partial().
|
private |
Definition at line 596 of file planarity.h.
View newest version in sPHENIX GitHub at line 596 of file planarity.h
Referenced by run().