import re


def get_node_count(gviz):
    """Get number of nodes in a Digraph

    Args:
        gviz (graphviz.graphs.Digraph): Digraph

    Returns:
        int: Number of nodes
    """
    nodes = 0
    for line in list(gviz):
        if not re.search("\".*\" \-> \".*\" \[.*\]", line) and re.search("\".*\" \[.*", line): # Node ( "_" [_ )
            nodes = nodes + 1
    return nodes