[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Loading graphs into python-igraph
From: |
Tamas Nepusz |
Subject: |
Re: [igraph] Loading graphs into python-igraph |
Date: |
Thu, 23 Oct 2008 23:23:33 +0100 |
Another thing I’m wondering about: is there any way to load a graph
in Python-igraph that’s not in an external file?
Igraph.load() and Graph.Read() seem to only be able to support an
external file.
You can use the Graph constructor straight away:
edges=[(0,1), (1,2), (2,0)]
g=Graph(edges, directed=True)
The full syntax is:
Graph(num_of_vertices, edgelist, directed, graph_attrs, vertex_attrs,
edge_attrs)
but you can omit num_of_vertices if it equals the maximum ID found in
edgelist + 1.
graph_attrs must be a dict of graph attributes, vertex_attrs is a dict
of vertex attributes (assigning attribute names to lists of the
corresponding vertex attribute values), edge_attrs is a dict of edge
attributes.
--
T.