Example #1
0
def run_filters(num_nodes, num_edges):
    nodes_df = pd.DataFrame({'n': [x for x in range(0, num_nodes)]})
    edges_df = pd.DataFrame({
        's': [x % num_nodes for x in range(0, num_edges)],
        'd': [(x + 1) % num_nodes for x in range(0, num_edges)],
    })
    graph_url = graphistry.nodes(nodes_df).edges(edges_df) \
            .bind(source='s', destination='d', node='n')\
            .plot(render=False)
    return {'nodes_df': nodes_df, 'edges_df': edges_df, 'graph_url': graph_url}
Example #2
0
def run_filters(num_nodes, num_edges):

    try:
        import cudf
    except Exception as e:
        st.exception(RuntimeError('Failed importing cudf'))
        raise e

    nodes_df = cudf.DataFrame({ 'n': [x for x in range(0, num_nodes)] })
    edges_df = cudf.DataFrame({
        's': [x % num_nodes for x in range(0, num_edges)],
        'd': [(x+1) % num_nodes for x in range(0, num_edges)],
    })
    graph_url = graphistry.nodes(nodes_df).edges(edges_df) \
            .bind(source='s', destination='d', node='n')\
            .plot(render=False)
    return { 'nodes_df': nodes_df.to_pandas(), 'edges_df': edges_df.to_pandas(), 'graph_url': graph_url }