@classmethod
def from_data(cls, nodes):
    """Create an instance from a bunch of nodes.

    Parameters
    ----------
    nodes: list
      A sequence of nodes, each item is (node_name, depends).

    Returns
    -------
    instance: TopologicalGraph
      Instance constructed from input argument.

    """
    instance = cls()
    for node_name, depends in nodes:
        instance.add(node_name, depends)
    return instance
