(self, create_using=None)
return g
Converts the graph to networkx format.

        @param create_using: specifies which NetworkX graph class to use when
            constructing the graph. C{None} means to let igraph infer the most
            appropriate class based on whether the graph is directed and whether
            it has multi-edges.
Converts the graph to networkx format.
Converts the graph to networkx format .
def to_networkx(self, create_using=None):
        """Converts the graph to networkx format.

        @param create_using: specifies which NetworkX graph class to use when
            constructing the graph. C{None} means to let igraph infer the most
            appropriate class based on whether the graph is directed and whether
            it has multi-edges.
        """
        import networkx as nx

        # Graph: decide on directness and mutliplicity
        if create_using is None:
            if self.has_multiple():
                cls = nx.MultiDiGraph if self.is_directed() else nx.MultiGraph
            else:
                cls = nx.DiGraph if self.is_directed() else nx.Graph
        else:
            cls = create_using

        # Graph attributes
        kw = {x: self[x] for x in self.attributes()}
        g = cls(**kw)

        # Nodes and node attributes
        for i, v in enumerate(self.vs):
            # TODO: use _nx_name if the attribute is present so we can achieve
            # a lossless round-trip in terms of vertex names
            g.add_node(i, **v.attributes())

        # Edges and edge attributes
        for edge in self.es:
            g.add_edge(edge.source, edge.target, **edge.attributes())

        return g
def to_networkx ( self , create_using = None ) : import networkx as nx # Graph: decide on directness and mutliplicity if create_using is None : if self . has_multiple ( ) : cls = nx . MultiDiGraph if self . is_directed ( ) else nx . MultiGraph else : cls = nx . DiGraph if self . is_directed ( ) else nx . Graph else : cls = create_using # Graph attributes kw = { x : self [ x ] for x in self . attributes ( ) } g = cls ( * * kw ) # Nodes and node attributes for i , v in enumerate ( self . vs ) : # TODO: use _nx_name if the attribute is present so we can achieve # a lossless round-trip in terms of vertex names g . add_node ( i , * * v . attributes ( ) ) # Edges and edge attributes for edge in self . es : g . add_edge ( edge . source , edge . target , * * edge . attributes ( ) ) return g