Return connected components from graph determined by edges matrix
    Args:
        edges: DataFrame of (undirected) edges.
        vertices: set of vertices in graph. Defaults to union of all vertices in edges.

    Returns:
        set of connected components, each of which is a set of vertices.

def get_components(edges, vertices=None):
    """
    Return connected components from graph determined by edges matrix
    Args:
        edges: DataFrame of (undirected) edges.
        vertices: set of vertices in graph. Defaults to union of all vertices in edges.

    Returns:
        set of connected components, each of which is a set of vertices.

    """
    if vertices is None:
        vertices = set(chain(edges.ix[:, 0], edges.ix[:, 1]))

    visited = set()
    components = []

    for id in vertices:
        if id not in visited:
            c = follow(id, edges)
            visited.update(c)
            components.append(c)

    return components