How to use the igraph.compat.property function in igraph

To help you get started, we’ve selected a few igraph examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github igraph / igraph / interfaces / python / igraph / remote / gephi.py View on Github external
    @property
    def url(self):
        """The URL of the Gephi workspace where the data will be sent."""
        return self._url_root
github igraph / python-igraph / src / igraph / drawing / utils.py View on Github external
    @property
    def coords(self):
        """The coordinates of the corners.

        The coordinates are returned as a 4-tuple in the following order:
        left edge, top edge, right edge, bottom edge.
        """
        return self._left, self._top, self._right, self._bottom
github igraph / python-igraph / igraph / nexus.py View on Github external
    @property
    def vertices_edges(self):
        if self.vertices is None or self.edges is None:
            return ""
        elif isinstance(self.vertices, (list, tuple)) and isinstance(self.edges, (list, tuple)):
            return " ".join("%s/%s" % (v,e) for v, e in izip(self.vertices, self.edges))
        else:
            return "%s/%s" % (self.vertices, self.edges)
github igraph / python-igraph / src / igraph / drawing / coord.py View on Github external
    @property
    def bounds(self):
        """Returns the lower and upper bounds of the X and Y values"""
        return self._bounds.coords
github igraph / python-igraph / src / igraph / clustering.py View on Github external
    @property
    def optimal_count(self):
        """Returns the optimal number of clusters for this dendrogram.

        If an optimal count hint was given at construction time, this
        property simply returns the hint. If such a count was not given,
        this method calculates the optimal number of clusters by maximizing
        the modularity along all the possible cuts in the dendrogram.
        """
        if self._optimal_count is not None:
            return self._optimal_count

        n = self._graph.vcount()
        max_q, optimal_count = 0, 1
        for step in xrange(min(n-1, len(self._merges))):
            membs = community_to_membership(self._merges, n, step)
            q = self._graph.modularity(membs, **self._modularity_params)
github igraph / igraph / interfaces / python / igraph / drawing / utils.py View on Github external
    @property
    def coords(self):
        """The coordinates of the corners.

        The coordinates are returned as a 4-tuple in the following order:
        left edge, top edge, right edge, bottom edge.
        """
        return self._left, self._top, self._right, self._bottom
github igraph / python-igraph / src / igraph / drawing / utils.py View on Github external
    @property
    def shape(self):
        """The shape of the rectangle (width, height)"""
        return self._right - self._left, self._bottom - self._top
github igraph / python-igraph / src / igraph / drawing / __init__.py View on Github external
    @property
    def background(self):
        """Returns the background color of the plot. C{None} means a
        transparent background.
        """
        return self._background
github igraph / python-igraph / src / igraph / drawing / __init__.py View on Github external
    @property
    def height(self):
        """Returns the height of the Cairo surface on which the plot
        is drawn"""
        return self.bbox.height
github igraph / igraph / interfaces / python / igraph / drawing / utils.py View on Github external
# pylint: disable-msg=W0141
    # W0141: used builtin function 'map'
    def _replace(self, **kwds):
        """Returns a new point object replacing specified fields with new
        values"""
        result = self._make(map(kwds.pop, ('x', 'y'), self))
        if kwds:
            raise ValueError('Got unexpected field names: %r' % kwds.keys())
        return result

    def __getnewargs__(self):
        """Return self as a plain tuple. Used by copy and pickle."""
        return tuple(self)

    x = property(itemgetter(0), doc="Alias for field number 0")
    y = property(itemgetter(1), doc="Alias for field number 1")

    def __add__(self, other):
        """Adds the coordinates of a point to another one"""
        return self.__class__(x = self.x + other.x, y = self.y + other.y)

    def __sub__(self, other):
        """Subtracts the coordinates of a point to another one"""
        return self.__class__(x = self.x - other.x, y = self.y - other.y)

    def __mul__(self, scalar):
        """Multiplies the coordinates by a scalar"""
        return self.__class__(x = self.x * scalar, y = self.y * scalar)
    __rmul__ = __mul__

    def __div__(self, scalar):