Commit c804ff8e authored by Tiago Peixoto's avatar Tiago Peixoto

Add load_graph utility function

Avoids having to do

    g = Graph()

each time. Now one can do simply,

    g = load_graph("foo")

parent ecabb934
......@@ -39,8 +39,8 @@ __URL__=""
from . core import __version__, Graph, GraphError, Vector_bool, \
Vector_int32_t, Vector_int64_t, Vector_double, Vector_long_double,\
Vector_string, value_types
Vector_string, value_types, load_graph
__all__ = ["Graph", "GraphError", "Vector_bool", "Vector_int32_t",
"Vector_int64_t", "Vector_double", "Vector_long_double",
"Vector_string", "value_types"]
"Vector_string", "value_types", "load_graph"]
......@@ -671,6 +671,12 @@ class Graph(object):
def load_graph(filename, format="auto"):
"""Load a graph from file"""
g = Graph()
g.load(filename, format=format)
return g
def value_types():
"""Return a list of possible properties value types"""
return libcore.get_property_types()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment