```#!/usr/bin/env python

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import networkx as nx
import numpy as np
import random
from eden.util import timeit
from eden.ml.estimator_utils import paired_shuffle
import logging

logger = logging.getLogger()

def _bfs(graph, start, max_depth):
visited, queue, dist = set(), [start], dict()
dist[start] = 0
while queue:
vertex = queue.pop(0)
if dist[vertex] <= max_depth:
if vertex not in visited:
next_nodes = [u for u in graph.neighbors(vertex)
if u not in visited]
next_dist = dist[vertex] + 1
for u in next_nodes:
dist[u] = next_dist
queue.extend(next_nodes)
return visited

neighborhood_nodes = n1 | n2
neighborhood_pair = nx.Graph(graph.subgraph(neighborhood_nodes))
# add a new node connected to the two endpoints
edge_node_id = len(graph)
if neighborhood_pair.has_edge(endpoint_1, endpoint_2):
neighborhood_pair.remove_edge(endpoint_1, endpoint_2)
neighborhood_pair.graph['roots'] = (endpoint_1, endpoint_2)
return neighborhood_pair

for u, v in endpoints:

@timeit
test_proportion=.3, ratio_neg_to_pos=10):
"""make_train_test_set."""
pos = [(u, v) for u, v in graph.edges()]
neg = [(u, v) for u, v in nx.non_edges(graph)]
random.shuffle(pos)
random.shuffle(neg)
pos_dim = len(pos)
neg_dim = len(neg)
max_n_neg = min(pos_dim * ratio_neg_to_pos, neg_dim)
neg = neg[:max_n_neg]
neg_dim = len(neg)
tr_pos = pos[:-int(pos_dim * test_proportion)]
te_pos = pos[-int(pos_dim * test_proportion):]
tr_neg = neg[:-int(neg_dim * test_proportion)]
te_neg = neg[-int(neg_dim * test_proportion):]

# remove edges
tr_graph = graph.copy()
tr_graph.remove_edges_from(te_pos)