def get_sub_graph(graph, subgraph, node):
    """Returns a subgraph with the source node and all adjacent edges and nodes"""
    subgraph.add_node(node)
    for in_edge in graph.in_edges(node, data=True):
        subgraph.add_node(in_edge[0], **graph.nodes[in_edge[0]])
        subgraph.add_edge(in_edge[0], in_edge[1], data=in_edge[2])
    for out_edge in graph.out_edges(node, data=True):
        subgraph.add_node(out_edge[1], **graph.nodes[out_edge[1]])
        subgraph.add_edge(out_edge[0], out_edge[1], data=out_edge[2])
    return subgraph