##################################################
-# Global Functions
+# Global Functions and Variables
##################################################
+MAX_DWORD = 2 ** 32 - 1
+
def sort_dsa_by_guid(dsa1, dsa2):
return cmp(dsa1.dsa_guid, dsa2.dsa_guid)
# Truncate to MAX_DWORD
info_c.cost = info_a.cost + info_b.cost
- if info_c.cost > 2 ** 32 - 1:
- info_c.cost = 2 ** 32 -1
+ if info_c.cost > MAX_DWORD:
+ info_c.cost = MAX_DWORD
return True
v = edge.vertices[0]
w = edge.vertices[1]
if v.site is vid or w.site is vid:
- if (v.is_black() or w.is_black()) and not v.dist_to_red == 2 ** 32 - 1:
+ if (v.is_black() or w.is_black()) and not v.dist_to_red == MAX_DWORD:
edge.directed = True
if w.dist_to_red < v.dist_to_red:
def setup_vertices(graph):
for v in graph.vertices:
if v.is_white():
- v.repl_info.cost = 2 ** 32 - 1
+ v.repl_info.cost = MAX_DWORD
v.root = None
v.component_id = None
else:
if ((vertex.is_black() and not include_black)
or edge_type not in vertex.accept_black
or edge_type not in vertex.accept_red_red):
- vertex.repl_info.cost = 2 ** 32 - 1
+ vertex.repl_info.cost = MAX_DWORD
vertex.root = None # NULL GUID
vertex.demoted = True # Demoted appears not to be used
else:
# Accepts neither red-red nor black edges, demote
if edge_type not in vertex.accept_black and edge_type not in vertex.accept_red_red:
- vertex.repl_info.cost = 2 ** 32 - 1
+ vertex.repl_info.cost = MAX_DWORD
vertex.root = None
vertex.demoted = True # Demoted appears not to be used