grakel.graph_from_networkx#

grakel.graph_from_networkx(X, node_labels_tag=None, edge_labels_tag=None, edge_weight_tag=None, as_Graph=False, val_node_labels=None, val_edge_labels=None)[source][source]#

Transform an iterable of networkx objects to an iterable of Graphs.

A function for helping a user that has a collection of graphs in networkx to use grakel.

Parameters:
node_labels_tagstr or None

Define where to search for labels of nodes, inside the node attribute of each graph. If None no labels are assigned.

edge_labels_tagtuple

Define where to search for labels of edges, inside the edge attribute of each graph. If None no labels are assigned.

edge_weight_tagint

Define where to search for weights inside the edge attribute of each graph. If None 1.0 weights are assigned.

as_Graphbool, default=False

Return each output as a grakel.Graph object.

val_node_labelsUnion[str, int, np.array], default=None

Sets constant value to all nodes labels of a graph if missing.

val_edge_labelsUnion[str, int, np.array], default=None

Sets constant value to all edges labels of a graph if missing.

Returns:
grakel_graphsgenerator

Returns a generator containing the same collections to be given as an input for any grakel kernel.

Examples using grakel.graph_from_networkx#

NetworkX to GraKeL

NetworkX to GraKeL