(
        self, graph_attributes=None, vertex_attributes=None, edge_attributes=None
    )
return g
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.

        @param graph_attributes: dictionary of graph attributes to transfer.
          Keys are attributes from the graph, values are data types (see
          below). C{None} means no graph attributes are transferred.
        @param vertex_attributes: dictionary of vertex attributes to transfer.
          Keys are attributes from the vertices, values are data types (see
          below). C{None} means no vertex attributes are transferred.
        @param edge_attributes: dictionary of edge attributes to transfer.
          Keys are attributes from the edges, values are data types (see
          below). C{None} means no vertex attributes are transferred.
Converts the graph to graph-tool
Converts the graph to graph - tool
def to_graph_tool(
        self, 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.

        @param graph_attributes: dictionary of graph attributes to transfer.
          Keys are attributes from the graph, values are data types (see
          below). C{None} means no graph attributes are transferred.
        @param vertex_attributes: dictionary of vertex attributes to transfer.
          Keys are attributes from the vertices, values are data types (see
          below). C{None} means no vertex attributes are transferred.
        @param edge_attributes: dictionary of edge attributes to transfer.
          Keys are attributes from the edges, values are data types (see
          below). C{None} means no vertex attributes are transferred.
        """
        import graph_tool as gt

        # Graph
        g = gt.Graph(directed=self.is_directed())

        # Nodes
        vc = self.vcount()
        g.add_vertex(vc)

        # Graph attributes
        if graph_attributes is not None:
            for x, dtype in list(graph_attributes.items()):
                # Strange syntax for setting internal properties
                gprop = g.new_graph_property(str(dtype))
                g.graph_properties[x] = gprop
                g.graph_properties[x] = self[x]

        # Vertex attributes
        if vertex_attributes is not None:
            for x, dtype in list(vertex_attributes.items()):
                # Create a new vertex property
                g.vertex_properties[x] = g.new_vertex_property(str(dtype))
                # Fill the values from the igraph.Graph
                for i in range(vc):
                    g.vertex_properties[x][g.vertex(i)] = self.vs[i][x]

        # Edges and edge attributes
        if edge_attributes is not None:
            for x, dtype in list(edge_attributes.items()):
                g.edge_properties[x] = g.new_edge_property(str(dtype))
        for edge in self.es:
            e = g.add_edge(edge.source, edge.target)
            if edge_attributes is not None:
                for x, dtype in list(edge_attributes.items()):
                    prop = edge.attributes().get(x, None)
                    g.edge_properties[x][e] = prop

        return g
def to_graph_tool ( self , graph_attributes = None , vertex_attributes = None , edge_attributes = None ) : import graph_tool as gt # Graph g = gt . Graph ( directed = self . is_directed ( ) ) # Nodes vc = self . vcount ( ) g . add_vertex ( vc ) # Graph attributes if graph_attributes is not None : for x , dtype in list ( graph_attributes . items ( ) ) : # Strange syntax for setting internal properties gprop = g . new_graph_property ( str ( dtype ) ) g . graph_properties [ x ] = gprop g . graph_properties [ x ] = self [ x ] # Vertex attributes if vertex_attributes is not None : for x , dtype in list ( vertex_attributes . items ( ) ) : # Create a new vertex property g . vertex_properties [ x ] = g . new_vertex_property ( str ( dtype ) ) # Fill the values from the igraph.Graph for i in range ( vc ) : g . vertex_properties [ x ] [ g . vertex ( i ) ] = self . vs [ i ] [ x ] # Edges and edge attributes if edge_attributes is not None : for x , dtype in list ( edge_attributes . items ( ) ) : g . edge_properties [ x ] = g . new_edge_property ( str ( dtype ) ) for edge in self . es : e = g . add_edge ( edge . source , edge . target ) if edge_attributes is not None : for x , dtype in list ( edge_attributes . items ( ) ) : prop = edge . attributes ( ) . get ( x , None ) g . edge_properties [ x ] [ e ] = prop return g