Esempio n. 1
0
def test_remove_edge():
    causal_fragments = [(("small", 1, tension), ("large", -1, food_security))]

    print("\n\n\n\n")
    print("\nCreating CAG")
    G = AnalysisGraph.from_causal_fragments(causal_fragments)
    G.find_all_paths()

    G.print_nodes()
    G.print_all_paths()

    print("\nRemoving edge - invalid source")
    with pytest.raises(IndexError):
        G.remove_edge(source="invalid", target=food_security)

    print("\nRemoving edge - invalid target")
    with pytest.raises(IndexError):
        G.remove_edge(source=tension, target="invalid")

    print("\nRemoving edge - source and target inverted target")
    G.remove_edge(source=food_security, target=tension)
    G.print_nodes()

    print("\nRemoving edge - correct")
    G.remove_edge(source=tension, target=food_security)
    G.print_nodes()
    G.print_edges()
    G.to_png()
Esempio n. 2
0
def test_delete_indicator():
    statements = [(
        ("large", -1, "UN/entities/human/financial/economic/inflation"),
        ("small", 1, "UN/events/human/human_migration"),
    )]
    G = AnalysisGraph.from_causal_fragments(statements)
    print("\n")
    G.print_nodes()
    G.map_concepts_to_indicators()
    G.print_indicators()
    print("\n")
    G["UN/events/human/human_migration"].replace_indicator(
        "Net migration", "New asylum seeking applicants", "UNHCR")
    G.print_indicators()
    print("\n")
    G.set_indicator("UN/events/human/human_migration", "Net Migration",
                    "MITRE12")

    G.print_indicators()
    print("\n")
    G.delete_indicator("UN/events/human/human_migration",
                       "New asylum seeking applicants")

    G.print_indicators()
    print("\n")

    G.set_indicator(
        "UN/events/human/human_migration",
        "New asylum seeking applicants",
        "UNHCR",
    )

    G.delete_all_indicators("UN/events/human/human_migration")

    G.print_indicators()
Esempio n. 3
0
def test_prune():
    causal_fragments = [  # Center node is n4
        (("small", 1, "n0"), ("large", -1, "n1")),
        (("small", 1, "n0"), ("large", -1, "n2")),
        (("small", 1, "n0"), ("large", -1, "n3")),
        (("small", 1, "n2"), ("large", -1, "n1")),
        (("small", 1, "n3"), ("large", -1, "n4")),
        (("small", 1, "n4"), ("large", -1, "n1")),
        # (("small", 1, "n4"), ("large", -1, "n2")),
        # (("small", 1, "n2"), ("large", -1, "n3")),
    ]

    print("\n\n\n\n")
    print("\nCreating CAG")
    G = AnalysisGraph.from_causal_fragments(causal_fragments)
    G.find_all_paths()

    print("\nBefore pruning")
    G.print_all_paths()

    cutoff = 2

    G.prune(cutoff)

    print("\nAfter pruning")
    G.print_all_paths()
Esempio n. 4
0
def test_cpp_extensions_preds():
    statements = [(
        ("large", -1, "UN/entities/human/financial/economic/inflation"),
        ("small", 1, "UN/events/human/human_migration"),
    )]
    G = AnalysisGraph.from_causal_fragments(statements)
    G.map_concepts_to_indicators()
    G["UN/events/human/human_migration"].replace_indicator(
        "Net migration", "New asylum seeking applicants", "UNHCR")
    G.to_png()

    # Now we can specify how to initialize betas. Posible values are:
    # InitialBeta.ZERO
    # InitialBeta.ONE
    # InitialBeta.HALF
    # InitialBeta.MEAN
    # InitialBeta.RANDOM - A random value between [-1, 1]
    G.train_model(2015,
                  1,
                  2015,
                  12,
                  10,
                  10,
                  initial_beta=InitialBeta.ZERO,
                  use_continuous=False)
    preds = G.generate_prediction(2015, 1, 2016, 12)
    pred_plot(preds, "New asylum seeking applicants", save_as="pred_plot.pdf")
Esempio n. 5
0
def test_remove_edges():
    causal_fragments = [(("small", 1, "UN/events/human/conflict"),
                         ("large", -1, "UN/entities/human/food/food_security"))
                        ]

    print('\n\n\n\n')
    print('\nCreating CAG')
    G = AnalysisGraph.from_causal_fragments(causal_fragments)
    G.find_all_paths()

    G.print_nodes()

    print('\nName to vertex ID map entries')
    G.print_name_to_vertex()

    G.print_all_paths()

    edges_to_remove = [
        ('invalid_src_1', "UN/entities/human/food/food_security"),
        ('invalid_src_2', "UN/entities/human/food/food_security"),
        ('UN/events/human/conflict', 'invalid_tgt1'),
        ('UN/events/human/conflict', 'invalid_tgt2'),
        ('invalid_src_2', 'invalid_tgt_2'),
        ('invalid_src_3', 'invalid_tgt3'),
        ("UN/entities/human/food/food_security", 'UN/events/human/conflict'),
        ('UN/events/human/conflict', "UN/entities/human/food/food_security"),
    ]
    print('\nRemoving edges')
    G.remove_edges(edges_to_remove)
    G.print_nodes()
    print('\nName to vertex ID map entries')
    G.print_name_to_vertex()
    G.print_all_paths()
Esempio n. 6
0
def test_remove_node():
    causal_fragments = [(("small", 1, "UN/events/human/conflict"),
                         ("large", -1, "UN/entities/human/food/food_security"))
                        ]

    print('\n\n\n\n')
    print('\nCreating CAG')
    G = AnalysisGraph.from_causal_fragments(causal_fragments)
    G.find_all_paths()

    G.print_nodes()

    print('\nName to vertex ID map entries')
    G.print_name_to_vertex()

    G.print_all_paths()

    print('\nRemoving an invalid concept')
    G.remove_node(concept='invalid')
    G.print_nodes()
    print('\nName to vertex ID map entries')
    G.print_name_to_vertex()
    G.print_all_paths()

    print('\nRemoving a valid concept')
    G.remove_node(concept='UN/events/human/conflict')
    G.print_nodes()
    print('\nName to vertex ID map entries')
    G.print_name_to_vertex()
    G.print_all_paths()
Esempio n. 7
0
def test_merge():
    causal_fragments = [
        (("small", 1, tension), ("large", -1, food_security)),
        (("small", 1, displacement), ("small", 1, tension)),
        (("small", 1, displacement), ("large", -1, food_security)),
        (("small", 1, tension), ("small", 1, crop_production)),
        (("large", -1, food_security), ("small", 1, crop_production)),
        (
            ("small", 1, "UN/events/human/economic_crisis"),
            ("small", 1, tension),
        ),
        (
            ("small", 1, "UN/events/weather/precipitation"),
            ("large", -1, food_security),
        ),
        (("large", -1, food_security), ("small", 1, inflation)),
    ]

    print("\n\n\n\n")
    print("\nCreating CAG")
    G = AnalysisGraph.from_causal_fragments(causal_fragments)
    G.find_all_paths()

    print("\nBefore merging")
    G.print_all_paths()

    G.print_nodes()

    print("\nAfter merging")
    G.merge_nodes(food_security, tension)

    G.print_all_paths()

    G.print_nodes()
Esempio n. 8
0
def test_remove_edges():
    causal_fragments = [(("small", 1, tension), ("large", -1, food_security))]

    print("\n\n\n\n")
    print("\nCreating CAG")
    G = AnalysisGraph.from_causal_fragments(causal_fragments)
    G.find_all_paths()

    G.print_nodes()

    print("\nName to vertex ID map entries")
    G.print_name_to_vertex()

    G.print_all_paths()

    edges_to_remove = [
        ("invalid_src_1", food_security),
        ("invalid_src_2", food_security),
        (tension, "invalid_tgt1"),
        (tension, "invalid_tgt2"),
        ("invalid_src_2", "invalid_tgt_2"),
        ("invalid_src_3", "invalid_tgt3"),
        (food_security, tension),
        (tension, food_security),
    ]
    print("\nRemoving edges")
    G.remove_edges(edges_to_remove)
    G.print_nodes()
    print("\nName to vertex ID map entries")
    G.print_name_to_vertex()
    G.print_all_paths()
Esempio n. 9
0
def test_subgraph_between():
    causal_fragments = [  # Center node is n4
        (("small", 1, "n0"), ("large", -1, "n1")),
        (("small", 1, "n1"), ("large", -1, "n2")),
        (("small", 1, "n2"), ("large", -1, "n3")),
        (("small", 1, "n3"), ("large", -1, "n4")),
        (("small", 1, "n0"), ("large", -1, "n5")),
        (("small", 1, "n5"), ("large", -1, "n6")),
        (("small", 1, "n6"), ("large", -1, "n4")),
        (("small", 1, "n0"), ("large", -1, "n7")),
        (("small", 1, "n7"), ("large", -1, "n4")),
        (("small", 1, "n0"), ("large", -1, "n4")),
        (("small", 1, "n0"), ("large", -1, "n8")),
        (("small", 1, "n8"), ("large", -1, "n9")),
        (("small", 1, "n10"), ("large", -1, "n0")),
        (("small", 1, "n4"), ("large", -1, "n12")),
        (("small", 1, "n12"), ("large", -1, "n13")),
        (("small", 1, "n13"), ("large", -1, "n4")),
    ]

    print("\n\n\n\n")
    print("\nCreating CAG")
    G = AnalysisGraph.from_causal_fragments(causal_fragments)
    G.find_all_paths()

    G.print_nodes()

    print("\nName to vertex ID map entries")
    G.print_name_to_vertex()

    G.print_nodes()
    G.print_name_to_vertex()
    # G.print_all_paths()

    cutoff = 3
    src = "n0"
    tgt = "n4"

    print(
        "\nSubgraph with inbetween hops less than or equal {} between source node {} and target node {}".format(
            cutoff, src, tgt
        )
    )
    try:
        G_sub = G.get_subgraph_for_concept_pair(src, tgt, cutoff)
        # G_sub.find_all_paths()
    except IndexError:
        print("Incorrect source or target concept")
        return

    print("\n\nTwo Graphs")
    print("The original")
    G.print_nodes()
    G.print_name_to_vertex()
    print()

    print("The subgraph")
    G_sub.print_nodes()
    G_sub.print_name_to_vertex()
Esempio n. 10
0
def test_inference():
    causal_fragments = [(("small", 1, tension), ("large", -1, food_security))]

    print("\n\n\n\n")
    print("\nCreating CAG")
    G = AnalysisGraph.from_causal_fragments(causal_fragments)

    G.print_nodes()

    print("\nName to vertex ID map entries")
    G.print_name_to_vertex()
Esempio n. 11
0
def test_inference():
    causal_fragments = [(("small", 1, "UN/events/human/conflict"),
                         ("large", -1, "UN/entities/human/food/food_security"))
                        ]

    print('\n\n\n\n')
    print('\nCreating CAG')
    G = AnalysisGraph.from_causal_fragments(causal_fragments)

    G.print_nodes()

    print('\nName to vertex ID map entries')
    G.print_name_to_vertex()

    print('\nSample from proposal debug')
Esempio n. 12
0
def test_merge():
    causal_fragments = [
        (("small", 1, "UN/events/human/conflict"),
         ("large", -1, "UN/entities/human/food/food_security")),
        (("small", 1, "UN/events/human/human_migration"),
         ("small", 1, "UN/events/human/conflict")),
        (("small", 1, "UN/events/human/human_migration"),
         ("large", -1, "UN/entities/human/food/food_security")),
        (("small", 1, "UN/events/human/conflict"),
         ("small", 1, "UN/entities/natural/crop_technology/product")),
        (("large", -1, "UN/entities/human/food/food_security"),
         ("small", 1, "UN/entities/natural/crop_technology/product")),
        (("small", 1, "UN/events/human/economic_crisis"),
         ("small", 1, "UN/events/human/conflict")),
        (("small", 1, "UN/events/weather/precipitation"),
         ("large", -1, "UN/entities/human/food/food_security")),
        (("small", 1, "UN/entities/human/financial/economic/inflation"),
         ("small", 1, "UN/events/human/conflict")),
        (("large", -1, "UN/entities/human/food/food_security"),
         ("small", 1, "UN/entities/human/financial/economic/inflation")),
    ]
    '''
    ("large", -1, "UN/entities/human/food/food_security")
    ("small", 1, "UN/events/human/conflict")
    ("small", 1, "UN/events/human/human_migration")
    ("small", 1, "UN/entities/natural/crop_technology/product")
    ("small", 1, "UN/events/human/economic_crisis")
    ("small", 1, "UN/events/weather/precipitation")
    ("small", 1, "UN/entities/human/financial/economic/inflation")
    '''
    print('\n\n\n\n')
    print('\nCreating CAG')
    G = AnalysisGraph.from_causal_fragments(causal_fragments)
    G.find_all_paths()

    print('\nBefore merging')
    G.print_all_paths()

    G.print_nodes()

    print('\nAfter mergning')
    #G.merge_nodes( "UN/events/human/conflict", "UN/entities/human/food/food_security")
    G.merge_nodes("UN/entities/human/food/food_security",
                  "UN/events/human/conflict")

    G.print_all_paths()

    G.print_nodes()
Esempio n. 13
0
def test_remove_edge():
    causal_fragments = [(("small", 1, "UN/events/human/conflict"),
                         ("large", -1, "UN/entities/human/food/food_security"))
                        ]

    print('\n\n\n\n')
    print('\nCreating CAG')
    G = AnalysisGraph.from_causal_fragments(causal_fragments)
    G.find_all_paths()

    G.print_nodes()

    print('\nName to vertex ID map entries')
    G.print_name_to_vertex()

    G.print_all_paths()

    print('\nRemoving edge - invalid source')
    G.remove_edge(source='invalid',
                  target="UN/entities/human/food/food_security")
    G.print_nodes()
    print('\nName to vertex ID map entries')
    G.print_name_to_vertex()
    G.print_all_paths()

    print('\nRemoving edge - invalid target')
    G.remove_edge(source='UN/events/human/conflict', target='invalid')
    G.print_nodes()
    print('\nName to vertex ID map entries')
    G.print_name_to_vertex()
    G.print_all_paths()

    print('\nRemoving edge - source and target inverted target')
    G.remove_edge(source="UN/entities/human/food/food_security",
                  target='UN/events/human/conflict')
    G.print_nodes()
    print('\nName to vertex ID map entries')
    G.print_name_to_vertex()
    G.print_all_paths()

    print('\nRemoving edge - correct')
    G.remove_edge(source='UN/events/human/conflict',
                  target="UN/entities/human/food/food_security")
    G.print_nodes()
    print('\nName to vertex ID map entries')
    G.print_name_to_vertex()
    G.print_all_paths()
    G.to_png()
Esempio n. 14
0
def test_remove_node():
    causal_fragments = [(("small", 1, tension), ("large", -1, food_security))]

    print("\n\n\n\n")
    print("\nCreating CAG")
    G = AnalysisGraph.from_causal_fragments(causal_fragments)
    G.find_all_paths()
    G.print_nodes()

    print("\nRemoving an invalid concept")
    with pytest.raises(IndexError):
        G.remove_node(concept="invalid")

    print("\nRemoving a valid concept")
    G.remove_node(concept=tension)
    G.print_nodes()
Esempio n. 15
0
def test_remove_nodes():
    causal_fragments = [(("small", 1, tension), ("large", -1, food_security))]

    print("\n\n\n\n")
    print("\nCreating CAG")
    G = AnalysisGraph.from_causal_fragments(causal_fragments)
    G.find_all_paths()

    G.print_nodes()

    print("\nName to vertex ID map entries")
    G.print_name_to_vertex()

    G.print_all_paths()

    print("\nRemoving a several concepts, some valid, some invalid")
    G.remove_nodes(concepts=set(["invalid1", tension, "invalid2"]))
    G.print_nodes()
    print("\nName to vertex ID map entries")
    G.print_name_to_vertex()
    G.print_all_paths()
Esempio n. 16
0
def create_base_CAG(causemos_create_model,
                    belief_score_cutoff=0,
                    grounding_score_cutoff=0,
                    kde_kernels=4):
    if causemos_create_model:
        G = AnalysisGraph.from_causemos_json_file(causemos_create_model,
                                                  belief_score_cutoff,
                                                  grounding_score_cutoff,
                                                  kde_kernels)
    else:
        statements = [(
            ("large", 1,
             "wm/concept/indicator_and_reported_property/agriculture/Crop_Production"
             ),
            ("small", -1,
             "wm/concept/causal_factor/condition/food_insecurity"),
        )]
        G = AnalysisGraph.from_causal_fragments(statements)
        G.map_concepts_to_indicators()
        curate_indicators(G)
    return G
Esempio n. 17
0
def test_subgraph():
    causal_fragments = [  # Center node is n4
        (("small", 1, "n0"), ("large", -1, "n1")),
        (("small", 1, "n1"), ("large", -1, "n2")),
        (("small", 1, "n2"), ("large", -1, "n3")),
        (("small", 1, "n3"), ("large", -1, "n4")),
        (("small", 1, "n4"), ("large", -1, "n5")),
        (("small", 1, "n5"), ("large", -1, "n6")),
        (("small", 1, "n6"), ("large", -1, "n7")),
        (("small", 1, "n7"), ("large", -1, "n8")),
        #(("small", 1, "n8"), ("large", -1, "n9")),
        #(("small", 1, "n9"), ("large", -1, "n0")),
        (("small", 1, "n0"), ("large", -1, "n9")),
        (("small", 1, "n9"), ("large", -1, "n2")),
        (("small", 1, "n2"), ("large", -1, "n10")),
        (("small", 1, "n10"), ("large", -1, "n4")),
        (("small", 1, "n4"), ("large", -1, "n11")),
        (("small", 1, "n11"), ("large", -1, "n6")),
        (("small", 1, "n6"), ("large", -1, "n12")),
        (("small", 1, "n12"), ("large", -1, "n8")),
        (("small", 1, "n13"), ("large", -1, "n14")),
        (("small", 1, "n14"), ("large", -1, "n4")),
        (("small", 1, "n4"), ("large", -1, "n15")),
        (("small", 1, "n15"), ("large", -1, "n16")),
        (("small", 1, "n5"), ("large", -1, "n3")),  # Creates a loop
    ]

    print('\n\n\n\n')
    print('\nCreating CAG')
    G = AnalysisGraph.from_causal_fragments(causal_fragments)
    G.find_all_paths()

    G.print_nodes()

    print('\nName to vertex ID map entries')
    G.print_name_to_vertex()

    #G.remove_nodes(set(['n0', 'n1', 'n2', 'n3', 'n4']))
    #G.remove_nodes(set(['n2', 'n3', 'n4']))
    #G.remove_nodes(set(['n9', 'n8', 'n7', 'n6', 'n5']))

    G.print_nodes()
    G.print_name_to_vertex()

    hops = 3
    node = 'n4'
    print('\nSubgraph of {} hops beginning at node {} graph'.format(
        hops, node))
    try:
        G_sub = G.get_subgraph_for_concept(node, False, hops)
    except IndexError:
        print('Concept {} is not in the CAG!'.format(node))
        return

    print('\n\nTwo Graphs')
    print('The original')
    G.print_nodes()
    G.print_name_to_vertex()
    #G.print_all_paths()
    print()

    print('The subgraph')
    G_sub.print_nodes()
    G_sub.print_name_to_vertex()
    #G_sub.print_all_paths()

    print('\nSubgraph of {} hops ending at node {} graph'.format(hops, node))
    G_sub = G.get_subgraph_for_concept(node, True, hops)

    print('\n\nTwo Graphs')
    print('The original')
    G.print_nodes()
    G.print_name_to_vertex()

    print('\nSubgraph of {} hops beginning at node {} graph'.format(
        hops, node))
    G.get_subgraph_for_concept(node, False, hops)
Esempio n. 18
0
def test_debug():
    causal_fragments = [  # Center node is n4
        (("small", 1, "n0"), ("large", -1, "n1")),
        (("small", 1, "n0"), ("large", -1, "n2")),
        (("small", 1, "n0"), ("large", -1, "n3")),
        (("small", 1, "n2"), ("large", -1, "n1")),
        (("small", 1, "n3"), ("large", -1, "n4")),
        (("small", 1, "n4"), ("large", -1, "n1")),
    ]

    causal_fragments = [  # Center node is n4
        (("small", 1, "n0"), ("large", -1, "n1")),
        (("small", 1, "n1"), ("large", -1, "n2")),
        (("small", 1, "n2"), ("large", -1, "n3")),
        (("small", 1, "n3"), ("large", -1, "n4")),
        (("small", 1, "n4"), ("large", -1, "n5")),
        (("small", 1, "n5"), ("large", -1, "n6")),
        (("small", 1, "n6"), ("large", -1, "n7")),
        (("small", 1, "n7"), ("large", -1, "n8")),
        (("small", 1, "n0"), ("large", -1, "n9")),
        (("small", 1, "n9"), ("large", -1, "n2")),
        (("small", 1, "n2"), ("large", -1, "n10")),
        (("small", 1, "n10"), ("large", -1, "n4")),
        (("small", 1, "n4"), ("large", -1, "n11")),
        (("small", 1, "n11"), ("large", -1, "n6")),
        (("small", 1, "n6"), ("large", -1, "n12")),
        (("small", 1, "n12"), ("large", -1, "n8")),
        (("small", 1, "n13"), ("large", -1, "n14")),
        (("small", 1, "n14"), ("large", -1, "n4")),
        (("small", 1, "n4"), ("large", -1, "n15")),
        (("small", 1, "n15"), ("large", -1, "n16")),
        (("small", 1, "n5"), ("large", -1, "n3")),  # Creates a loop
    ]

    causal_fragments = [  # Center node is n4
        (("small", 1, "n0"), ("large", -1, "n1")),
        (("small", 1, "n1"), ("large", -1, "n2")),
        (("small", 1, "n2"), ("large", -1, "n3")),
        (("small", 1, "n3"), ("large", -1, "n4")),
        (("small", 1, "n4"), ("large", -1, "n5")),
        (("small", 1, "n5"), ("large", -1, "n6")),
        (("small", 1, "n6"), ("large", -1, "n7")),
        (("small", 1, "n7"), ("large", -1, "n8")),
        (("small", 1, "n0"), ("large", -1, "n3")),
    ]

    print("\n\n\n\n")
    print("\nCreating CAG")
    G = AnalysisGraph.from_causal_fragments(causal_fragments)
    G.find_all_paths()
    G.print_nodes()

    print("\nBefore pruning")
    G.print_all_paths()

    hops = 3
    node = "n0"
    print(
        f"\nSubgraph of {hops} hops beginning at node {node} graph"
    )
    try:
        G_sub = G.get_subgraph_for_concept(node, False, hops)
    except IndexError:
        print(f"Concept {node} is not in the CAG!")
        return

    G_sub.find_all_paths()
    G_sub.print_nodes()
Esempio n. 19
0
def test_subgraph():
    causal_fragments = [  # Center node is n4
        (("small", 1, "n0"), ("large", -1, "n1")),
        (("small", 1, "n1"), ("large", -1, "n2")),
        (("small", 1, "n2"), ("large", -1, "n3")),
        (("small", 1, "n3"), ("large", -1, "n4")),
        (("small", 1, "n4"), ("large", -1, "n5")),
        (("small", 1, "n5"), ("large", -1, "n6")),
        (("small", 1, "n6"), ("large", -1, "n7")),
        (("small", 1, "n7"), ("large", -1, "n8")),
        (("small", 1, "n0"), ("large", -1, "n9")),
        (("small", 1, "n9"), ("large", -1, "n2")),
        (("small", 1, "n2"), ("large", -1, "n10")),
        (("small", 1, "n10"), ("large", -1, "n4")),
        (("small", 1, "n4"), ("large", -1, "n11")),
        (("small", 1, "n11"), ("large", -1, "n6")),
        (("small", 1, "n6"), ("large", -1, "n12")),
        (("small", 1, "n12"), ("large", -1, "n8")),
        (("small", 1, "n13"), ("large", -1, "n14")),
        (("small", 1, "n14"), ("large", -1, "n4")),
        (("small", 1, "n4"), ("large", -1, "n15")),
        (("small", 1, "n15"), ("large", -1, "n16")),
        (("small", 1, "n5"), ("large", -1, "n3")),  # Creates a loop
    ]

    print("\n\n\n\n")
    print("\nCreating CAG")
    G = AnalysisGraph.from_causal_fragments(causal_fragments)
    G.find_all_paths()

    G.print_nodes()

    print("\nName to vertex ID map entries")
    G.print_name_to_vertex()

    G.print_nodes()
    G.print_name_to_vertex()

    hops = 2
    node = "n4"
    print(
        "\nSubgraph of {} hops beginning at node {} graph".format(hops, node)
    )
    try:
        G_sub = G.get_subgraph_for_concept(node, False, hops)
    except IndexError:
        print("Concept {} is not in the CAG!".format(node))
        return

    print("\n\nTwo Graphs")
    print("The original")
    G.print_nodes()
    G.print_name_to_vertex()

    print("The subgraph")
    G_sub.print_nodes()
    G_sub.print_name_to_vertex()

    print("\nSubgraph of {} hops ending at node {} graph".format(hops, node))
    G_sub = G.get_subgraph_for_concept(node, True, hops)

    print("\n\nTwo Graphs")
    print("The original")
    G.print_nodes()
    G.print_name_to_vertex()

    print(
        "\nSubgraph of {} hops beginning at node {} graph".format(hops, node)
    )
    G.get_subgraph_for_concept(node, False, hops)