Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Shortcut for planar graphs.
Browse files Browse the repository at this point in the history
  • Loading branch information
jm58660 committed Nov 15, 2017
1 parent 669bb34 commit 8de878c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/sage/graphs/generic_graph.py
Expand Up @@ -4929,6 +4929,9 @@ def crossing_number(self):

self._scream_if_not_simple()

if self.is_planar():
return 0

# Optimization one: the crossing number if the sum of crossing
# numbers of connected components.
if not self.is_connected():
Expand All @@ -4952,7 +4955,7 @@ def crossing_number(self):
edgepairs = [x for x in edgepairs if x[0][0] not in [x[1][0], x[1][1]] and
x[0][1] not in [x[1][0], x[1][1]]]

k = 0
k = 1
while True:
for edges in Subsets(edgepairs, k):
g = copy(G)
Expand Down

0 comments on commit 8de878c

Please sign in to comment.