def make_vertices_for_3dlayout(nxgraph): nx_3dlayout = nx.layout.spring_layout(nxgraph, dim=3) # need to create an array of arrays where last 3 are xyz, first is key output = [] for k,v in nx_3dlayout.iteritems(): this_elem = [farmhash.hash32(k)] + [k] + v.tolist() output.append(this_elem) return output
def make_vertices_for_3dlayout(nxgraph): nx_3dlayout = nx.layout.spring_layout(nxgraph, dim=3) # need to create an array of arrays where last 3 are xyz, first is key output = [] for k, v in nx_3dlayout.iteritems(): this_elem = [farmhash.hash32(k)] + [k] + v.tolist() output.append(this_elem) return output
def _populate_feature_flags(user_proto): """Update the feature flags.""" user_proto.features_enabled.ClearField('action_done_button_discreet') user_proto.features_enabled.ClearField('action_done_button_control') lbb_integration = bool( farmhash.hash32(user_proto.user_id + 'lbb_integration') % 2) user_proto.features_enabled.lbb_integration = ( user_pb2.ACTIVE if lbb_integration else user_pb2.CONTROL) if _ALPHA_USER_REGEXP.search(user_proto.profile.email): user_proto.features_enabled.alpha = True
def edge_tuples_to_array(nxgraph): output = [[farmhash.hash32(elem[0])] + [farmhash.hash32(elem[1])] for elem in nxgraph.edges()] return output
def _hash_32(d): return farmhash.hash32(d)
def _hashfunc32(self, str_value): return farmhash.hash32(str_value)