nocad.io.from_pandas_edgelist#
- nocad.io.from_pandas_edgelist(edges, source='source', target='target', weight=None, nodes=None)[source]#
Network from an edge-list DataFrame (one row per edge \(x_j\to x_i\)).
nodes(list or DataFrame with alabelcolumn) fixes the node order and adds isolated nodes; its other columns becomenode_data.Examples
>>> import pandas as pd >>> net = from_pandas_edgelist(pd.DataFrame({"source": ["a", "b"], "target": ["b", "c"]})) >>> net.labels, int(net.adj.nnz) (['a', 'b', 'c'], 2)