neurokernel.tools.graph.graph_to_df

neurokernel.tools.graph.graph_to_df(g)[source]

Convert a directed multigraph into pandas DataFrames.

Constructs two pandas DataFrame instances that respectively contain the specified graph’s node and edge attributes.

Parameters:g (networkx.Graph) – Graph instance.
Returns:
  • df_node (pandas.DataFrame) – Node attributes; the index corresponds to the node identifiers.
  • df_edge (pandas.DataFrame) – Edge attributes; the index is a MultiIndex that permits access to the edges by origin node, destination node, and edge number (i.e., for multigraphs in which nodes connected by more than one edge with the same direction).