Commit 5cbf8593 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Improve documentation of Graph class

This moves the documentation out of the constructor, and into the class
definition.
parent ec544ea7
...@@ -653,14 +653,18 @@ from libgraph_tool_core import Vertex, Edge, Vector_bool, Vector_int32_t, \ ...@@ -653,14 +653,18 @@ from libgraph_tool_core import Vertex, Edge, Vector_bool, Vector_int32_t, \
class Graph(object): class Graph(object):
"""Generic multigraph class. """Generic multigraph class.
This class encapsulates either a directed multigraph ( This class encapsulates either a directed multigraph (default or if
default or if ``directed=True``) or an undirected multigraph ( ``directed=True``) or an undirected multigraph (if ``directed=False``),
if ``directed=False``),
with optional internal edge, vertex or graph properties. with optional internal edge, vertex or graph properties.
If ``g`` is specified, the graph (and its internal properties) will be If ``g`` is specified, the graph (and its internal properties) will be
copied. copied.
If ``prune`` is set to True, and ``g`` is specified, only the filtered graph
will be copied, and the new graph object will not be filtered. Optionally, a
tuple of three booleans can be passed as value to ``prune``, to specify a
different behavior to vertex, edge, and reversal filters, respectively.
The graph is implemented as an `adjacency list`_, where both vertex and edge The graph is implemented as an `adjacency list`_, where both vertex and edge
lists are C++ STL vectors. lists are C++ STL vectors.
...@@ -669,13 +673,6 @@ class Graph(object): ...@@ -669,13 +673,6 @@ class Graph(object):
""" """
def __init__(self, g=None, directed=True, prune=False): def __init__(self, g=None, directed=True, prune=False):
"""Construct a graph. If ``g`` is specified, the graph (and its internal
properties) will be copied. The ``directed`` parameter specifies whether
the graph should be directed or undirected. If ``prune`` is set to True,
and ``g`` is specified, only the filtered graph will be copied, and the
new graph object will not be filtered. Optionally, a tuple of booleans
can be passed as value to ``prune``, to specify a different behavior to
vertex, edge, and reversal filters, respectively."""
self.__properties = {} self.__properties = {}
self.__known_properties = [] self.__known_properties = []
self.__filter_state = {"reversed": False, self.__filter_state = {"reversed": False,
......
Supports Markdown
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