grakel
.graph_from_pandas¶
-
grakel.
graph_from_pandas
(edge_df, node_df=None, directed=False, as_Graph=False)[source][source]¶ Produces a collection of Graph Objects from pandas dataframes.
A function for helping a user that has a bunch of graph csv files make a collection for grakel input.
- Parameters
- edge_dftuple(pandas.DataFrame, pct, tuple(pct, pct), pct or None, pct or list(pct) or None)
A tuple of many elements:
A pandas dataframe containing all the edges of a collection of graphs
The column name of the graph index
A tuple containing source and destination column names
The column name of weights column (None if non-existent)
The column name pointing the column containing edge-labels or a list pointing the columns of attributes (None if edge-labels are non-existent).
If node_df exists, correspondance of graph indexes and node indexes must be exact.
- node_dftuple(pandas.DataFrame, pct, pct or list(pct) or None) or None, default=None
A tuple of many elements:
A pandas dataframe containing all the nodes of a collection of graphs
The column name of the graph index
The column name pointing the column containing node-labels or a list pointing the columns of attributes (None if node-labels are non-existent).
Node id must correspond to node number.
- directedbool, default=False
A variable indicating with True if both directions of the graph have been inserted inside the dataframe. Otherwise the graph is considered as undirected.
- as_Graphbool, default=False
Return each output as a grakel.Graph object.
- Returns
- grakel_graphsdict
Dictionary with keys te keys of the graphs inside the pandas dataframe and values the corresponding graph object