Undocumented
Function | _construct |
Converts the graph from graph-tool |
Function | _construct |
Converts the graph from networkx |
Function | _export |
Converts the graph to graph-tool |
Function | _export |
Converts the graph to networkx format. |
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 | |
cls | Undocumented |
g | networkx Graph or DiGraph |
vertexstr | 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. |
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 | 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 | 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 | 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. |
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 | 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. |
vertexstr | vertex attribute used to name vertices in the exported network. The default "_nx_name" ensures round trip conversions to/from networkx are lossless. |