networkit.nxadapter

This module handles compatibility between NetworKit and NetworkX

networkit.nxadapter.nk2nx(nkG)

Convert a networKit.Graph to a networkx.Graph.

Parameters:

nkG (networkit.Graph) – The input NetworKit graph.

networkit.nxadapter.nx2nk(nxG, weightAttr=None)

Convert a networkx.Graph to a networkit.Graph. If data is true, try to convert networkx.Graph data to networkit.Graph attributes. Note that there are limitations to this conversion: networkit only supports int, float, and str attribute types. Other types will be converted into their string representation. Attribute keys are always converted to strings. Optionally, a dictionary that maps attribute names to specific types can be supplied.

Parameters:
  • nxG (networkx.Graph) – The input networkx graph.

  • weightAttr (str, optional) – The edge attribute which should be treated as the edge weight. Default: None

  • data (bool, optional) – If true, convert networkx.Graph data into networkit.Graph attributes. Default: False

  • typeMap (dict, optional) – Specifies the data type an attribute has. Missing attributes are inferred as described above. Default: None