<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def vertex_graph(entities):
 """ Given a set of entity objects generate a networkx.Graph that represents their vertex nodes. Parameters entities : list Objects with 'closed' and 'nodes' attributes Returns graph : networkx.Graph Graph where node indexes represent vertices closed : (n,) int Indexes of entities which are 'closed' """

    graph = nx.Graph()
    closed = []
    for index, entity in enumerate(entities):
        if entity.closed:
            closed.append(index)
        else:
            graph.add_edges_from(entity.nodes,
                                 entity_index=index)
    return graph, np.array(closed)