<commit_before>import tulippaths as tp


def graphToJson(graph):
    completeness = tp.utils.getApproximateAnnotationCompleteness(graph)
    nodes = []
    edges = []

    for node in graph.getNodes():
        dictionary = {
            "ID": int(node.id),
            "Label": tp.utils.getNodeType(node, graph),
            "StructureID": int(tp.utils.getNodeId(node, graph)),
            "Completeness": completeness[node]
        }
        nodes.append(dictionary)

    for edge in graph.getEdges():
        dictionary = {
            "ID": edge.id,
            "SourceStructureID": int(tp.utils.getNodeId(graph.source(edge), graph)),
            "TargetStructureID": int(tp.utils.getNodeId(graph.target(edge), graph)),
            "Type": tp.utils.getEdgeType(edge, graph),
            "LinkedStructures": tp.utils.getEdgeLinkedStructures(edge, graph)
        }
        edges.append(dictionary)

    return {
        "nodes": nodes,
        "edges": edges
    }<commit_msg>Update export.<commit_after>import tulippaths as tp


def graphToJson(graph):
    completeness = tp.utils.getApproximateAnnotationCompleteness(graph)
    nodes = []
    edges = []

    for node in graph.getNodes():
        dictionary = {
            "ID": int(node.id),
            "Label": tp.utils.getNodeType(node, graph),
            "StructureID": int(tp.utils.getNodeId(node, graph)),
            "Completeness": completeness[node]
        }
        nodes.append(dictionary)

    for edge in graph.getEdges():
        source = graph.source(edge)
        target = graph.target(edge)
        dictionary = {
            "ID": edge.id,
            "SourceStructureID": int(tp.utils.getNodeId(source, graph)),
            "TargetStructureID": int(tp.utils.getNodeId(target, graph)),
            "SourceID": int(source.id),
            "TargetID": int(target.id),
            "Type": tp.utils.getEdgeType(edge, graph),
            "LinkedStructures": tp.utils.getEdgeLinkedStructures(edge, graph)
        }
        edges.append(dictionary)

    return {
        "nodes": nodes,
        "edges": edges
    }
{'fraction_non_alphanumeric': 0.13106096975516082, 'fraction_numerical': 0.0, 'mean_word_length': 2.2818897637795277, 'pattern_counts': {'":': 24, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4513579', 'n_tokens_mistral': 614, 'n_tokens_neox': 616, 'n_words': 111}