How to use the nxviz.io.graph_from_dataframe function in nxviz

To help you get started, we’ve selected a few nxviz examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ericmjl / nxviz / tests / test_io.py View on Github external
def test_basic_import():

    g = graph_from_dataframe(test_dataframe)

    assert g.number_of_nodes() == 21
    assert g.number_of_edges() == 129
    assert g.nodes["A"] == {"type": "group"}
    assert g["blue"]["New York"] == {"type": "color_location", "weight": 6.0}
github ericmjl / nxviz / tests / test_io.py View on Github external
def test_node_properties():
    g = graph_from_dataframe(
        test_dataframe,
        threshold_by_count_unique=3,
        node_property_columns=["ten_things"],
    )

    assert g.number_of_nodes() == 5
    assert g.number_of_edges() == 6
    assert g.nodes["A"] == {
        "ten_things": "4|6|7|8|0|1|2|3|5|9",
        "type": "group",
    }
github ericmjl / nxviz / tests / test_io.py View on Github external
def test_percent_threshold():

    g = graph_from_dataframe(test_dataframe, threshold_by_percent_unique=0.08)

    assert g.number_of_nodes() == 11
    assert g.number_of_edges() == 36
    assert g.nodes["A"] == {"type": "group"}
    assert g["blue"]["B"] == {"type": "color_group", "weight": 20.0}
github ericmjl / nxviz / tests / test_io.py View on Github external
def test_edge_properties():
    g = graph_from_dataframe(
        test_dataframe, edge_property_columns=["ten_things", "a_string"]
    )

    assert g.number_of_nodes() == 21
    assert g.number_of_edges() == 129
    assert g["blue"]["B"] == {
        "a_string": "96",
        "ten_things": 6,
        "type": "color_group",
        "weight": 20.0,
    }
github ericmjl / nxviz / tests / test_io.py View on Github external
def test_count_threshold():

    g = graph_from_dataframe(test_dataframe, threshold_by_count_unique=3)

    assert g.number_of_nodes() == 5
    assert g.number_of_edges() == 6
    assert g.nodes["A"] == {"type": "group"}
    assert g["blue"]["B"] == {"type": "color_group", "weight": 20.0}