(g, allowed_extensions=set())
return True
Test if the given graphs only uses the allowed extensions.

    :param g: graphs a dictionary with an edgeSet
    :param allowed_extensions: a set of allowed extensions
    :return: True if graph uses only allowed extensions, false otherwise
    >>> if_graph_adheres({'edgeSet': [{'kbID': 'P17v','right': ['Iceland'],'rightkbID': 'Q189','type': 'direct'}]}, allowed_extensions=set())
    True
    >>> if_graph_adheres({'edgeSet': [{'kbID': 'P17v','right': ['Iceland'],'rightkbID': 'Q189','type': 'v-structure'}]}, allowed_extensions=set())
    False
    >>> if_graph_adheres({'edgeSet': [{'kbID': 'P17v','right': ['Iceland'],'rightkbID': 'Q189','argmin': 'time'}]}, allowed_extensions=set())
    False
    >>> if_graph_adheres({'edgeSet': [{'kbID': 'P17v','right': ['Iceland'],'rightkbID': 'Q189','type': 'time'}]}, allowed_extensions={'temporal'})
    True
    >>> if_graph_adheres({'edgeSet': [{'kbID': 'P17v','right': ['Iceland']}, {'kbID':'P31v'}]}, allowed_extensions=set())
    False
    >>> if_graph_adheres({'edgeSet': [{'kbID': 'P512q', 'rightkbID': 'Q8027', 'type': 'reverse'}], 'filter': 'importance'}, allowed_extensions=['multi_rel', 'temporal', 'qualifier_rel', 'v-structure'])
    False
Test if the given graphs only uses the allowed extensions.
Test if the given graphs only uses the allowed extensions .
def if_graph_adheres(g, allowed_extensions=set()):
    """
    Test if the given graphs only uses the allowed extensions.

    :param g: graphs a dictionary with an edgeSet
    :param allowed_extensions: a set of allowed extensions
    :return: True if graph uses only allowed extensions, false otherwise
    >>> if_graph_adheres({'edgeSet': [{'kbID': 'P17v','right': ['Iceland'],'rightkbID': 'Q189','type': 'direct'}]}, allowed_extensions=set())
    True
    >>> if_graph_adheres({'edgeSet': [{'kbID': 'P17v','right': ['Iceland'],'rightkbID': 'Q189','type': 'v-structure'}]}, allowed_extensions=set())
    False
    >>> if_graph_adheres({'edgeSet': [{'kbID': 'P17v','right': ['Iceland'],'rightkbID': 'Q189','argmin': 'time'}]}, allowed_extensions=set())
    False
    >>> if_graph_adheres({'edgeSet': [{'kbID': 'P17v','right': ['Iceland'],'rightkbID': 'Q189','type': 'time'}]}, allowed_extensions={'temporal'})
    True
    >>> if_graph_adheres({'edgeSet': [{'kbID': 'P17v','right': ['Iceland']}, {'kbID':'P31v'}]}, allowed_extensions=set())
    False
    >>> if_graph_adheres({'edgeSet': [{'kbID': 'P512q', 'rightkbID': 'Q8027', 'type': 'reverse'}], 'filter': 'importance'}, allowed_extensions=['multi_rel', 'temporal', 'qualifier_rel', 'v-structure'])
    False
    """
    allowed_extensions = set(allowed_extensions)
    if 'v-structure' not in allowed_extensions and 'v-structure' in {e.get('type', "direct") for e in g.get('edgeSet', [])}:
        return False
    if 'temporal' not in allowed_extensions and graph_has_temporal(g):
        return False
    if 'hopUp' not in allowed_extensions and any('hopUp' in e for e in g.get('edgeSet', [])):
        return False
    if 'hopDown' not in allowed_extensions and any('hopDown' in e for e in g.get('edgeSet', [])):
        return False
    if 'qualifier_rel' not in allowed_extensions and any(e.get('kbID', "").endswith('q') for e in g.get('edgeSet', [])):
        return False
    if 'multi_rel' not in allowed_extensions and len(g.get('edgeSet', [])) > 1:
        return False
    if 'filter' not in allowed_extensions and 'filter' in g:
        return False
    if 'iclass' not in allowed_extensions and any(edge.get("type") == 'iclass' for edge in g.get('edgeSet', [])):
        return False
    return True
def if_graph_adheres ( g , allowed_extensions = set ( ) ) : allowed_extensions = set ( allowed_extensions ) if 'v-structure' not in allowed_extensions and 'v-structure' in { e . get ( 'type' , "direct" ) for e in g . get ( 'edgeSet' , [ ] ) } : return False if 'temporal' not in allowed_extensions and graph_has_temporal ( g ) : return False if 'hopUp' not in allowed_extensions and any ( 'hopUp' in e for e in g . get ( 'edgeSet' , [ ] ) ) : return False if 'hopDown' not in allowed_extensions and any ( 'hopDown' in e for e in g . get ( 'edgeSet' , [ ] ) ) : return False if 'qualifier_rel' not in allowed_extensions and any ( e . get ( 'kbID' , "" ) . endswith ( 'q' ) for e in g . get ( 'edgeSet' , [ ] ) ) : return False if 'multi_rel' not in allowed_extensions and len ( g . get ( 'edgeSet' , [ ] ) ) > 1 : return False if 'filter' not in allowed_extensions and 'filter' in g : return False if 'iclass' not in allowed_extensions and any ( edge . get ( "type" ) == 'iclass' for edge in g . get ( 'edgeSet' , [ ] ) ) : return False return True