How to use the karateclub.GraphReader function in karateclub

To help you get started, we’ve selected a few karateclub 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 VHRanger / graph2vec / nodevectors / evaluation / graph_eval.py View on Github external
def get_karateclub(graph_name):
    """
    Gets formatted dataset from KarateClub library
    https://karateclub.readthedocs.io
    """
    try:
        from karateclub import GraphReader
    except:
        raise Exception(
            "get_karateclub requires the karateclub library!\n"
            + "Try 'pip install karateclub'\n"
            + "see https://github.com/benedekrozemberczki/KarateClub")
    G = GraphReader(graph_name).get_graph()
    y = GraphReader(graph_name).get_target()
    return G, pd.DataFrame({'node': list(G), 'label': pd.Series(y)})
github VHRanger / graph2vec / nodevectors / evaluation / graph_eval.py View on Github external
def get_karateclub(graph_name):
    """
    Gets formatted dataset from KarateClub library
    https://karateclub.readthedocs.io
    """
    try:
        from karateclub import GraphReader
    except:
        raise Exception(
            "get_karateclub requires the karateclub library!\n"
            + "Try 'pip install karateclub'\n"
            + "see https://github.com/benedekrozemberczki/KarateClub")
    G = GraphReader(graph_name).get_graph()
    y = GraphReader(graph_name).get_target()
    return G, pd.DataFrame({'node': list(G), 'label': pd.Series(y)})