List of all classes, functions and methods in python-igraph

module documentation

Undocumented

Function | `_export_graph_to_networkx` |
Converts the graph to networkx format. |

Function | `_construct_graph_from_networkx` |
Converts the graph from networkx |

Function | `_export_graph_to_graph_tool` |
Converts the graph to graph-tool |

Function | `_construct_graph_from_graph_tool` |
Converts the graph from graph-tool |

def _export_graph_to_networkx(graph, create_using=None, vertex_attr_hashable='_nx_name'):

Converts the graph to networkx format.

igraph has ordered vertices and edges, but networkx does not. To keep track of the original order, the '_igraph_index' vertex property is added to both vertices and edges.

Parameters | graph | Undocumented |

create_using | specifies which NetworkX graph class to use when constructing the graph. `None` means to let igraph infer the most appropriate class based on whether the graph is directed and whether it has multi-edges. | |

vertex_attr_hashable | Undocumented | |

vertex_attr_hashable (str) | vertex attribute used to name vertices in the exported network. The default "_nx_name" ensures round trip conversions to/from networkx are lossless. |

def _construct_graph_from_networkx(cls, g, vertex_attr_hashable='_nx_name'):

Converts the graph from networkx

Vertex names will be stored as a vertex_attr_hashable attribute (usually "_nx_name", but see below). Because igraph stored vertices in an ordered manner, vertices will get new IDs from 0 up. In case of multigraphs, each edge will have an "_nx_multiedge_key" attribute, to distinguish edges that connect the same two vertices.

Parameters | g | networkx Graph or DiGraph |

vertex_attr_hashable | Undocumented | |

vertex_attr_hashable (str) | attribute used to store the Python hashable used by networkx to identify each vertex. The default value '_nx_name' ensures lossless round trip conversions to/from networkx. An alternative choice is 'name': in that case, using strings for vertex names is recommended and, if the graph is re-exported to networkx, Graph.to_networkx(vertex_attr_hashable="name") must be used to recover the correct vertex nomenclature in the exported network. |

def _export_graph_to_graph_tool(graph, graph_attributes=None, vertex_attributes=None, edge_attributes=None):

Converts the graph to graph-tool

Data types: graph-tool only accepts specific data types. See the following web page for a list:

https://graph-tool.skewed.de/static/doc/quickstart.html

Note: because of the restricted data types in graph-tool, vertex and edge attributes require to be type-consistent across all vertices or edges. If you set the property for only some vertices/edges, the other will be tagged as None in igraph, so they can only be converted to graph-tool with the type 'object' and any other conversion will fail.

Parameters | graph | Undocumented |

graph_attributes | dictionary of graph attributes to transfer. Keys are attributes from the graph, values are data types (see below). `None` means no graph attributes are transferred. | |

vertex_attributes | dictionary of vertex attributes to transfer. Keys are attributes from the vertices, values are data types (see below). `None` means no vertex attributes are transferred. | |

edge_attributes | dictionary of edge attributes to transfer. Keys are attributes from the edges, values are data types (see below). `None` means no vertex attributes are transferred. |