stream_graph.ABC.LinkSet

class stream_graph.ABC.LinkSet[source][source]

LinkSet Object API Specification.

A LinkSet can be abstractly be defined as a set of links (u, v).

Attributes
as_graph

Generate the graph containing this LinkSet.

nodeset

Return the nodeset that can be derived from the LinkSet.

size

Returns the size of the LinkSet.

weighted

Designate if the LinkSet has weights.

weighted_size

Returns the weighted size of the LinkSet.

Methods

copy(self[, deep])

Returns a deep or shallow copy of the current LinkSet.

degree(self[, u, direction, weights])

Return the degree of a node.

issuperset(self, ls)

Check if a LinkSet contains another LinkSet.

neighbors_of(self[, u, direction])

Return the nodeset of a neighbors of a node.

abstract __and__(self, ls)[source][source]

Implementation of the & operator for a LinkSet object.

Parameters
lsLinkSet
Returns
outLinkSet

Returns the intersection of Links.

abstract __bool__(self)[source][source]

Implementation of the bool casting of a LinkSet object.

Parameters
None.
Returns
outBool

Return True if an object is both initialized and contains information.

__class__[source]

alias of abc.ABCMeta

abstract __contains__(self, l)[source][source]

Implementation of the in operator for LinkSet.

Parameters
ltuple, len(l) == 2

l[0] : Node_Id or None l[1] : Node_Id or None

Returns
containsBool

Returns true if the (u, v) appears in the LinkSet. If u is None v can match with anything and if v is None the opposite. If both u and v is None this function should return False.

__delattr__(self, name, /)

Implement delattr(self, name).

__dir__()

default dir() implementation

__eq__(self, value, /)

Return self==value.

__format__()

default object formatter

__ge__(self, value, /)

Return self>=value.

__getattribute__(self, name, /)

Return getattr(self, name).

__gt__(self, value, /)

Return self>value.

__hash__(self, /)

Return hash(self).

__init__(self, /, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

abstract __iter__(self)[source][source]

Implementation of the iter function for a LinkSet object.

Parameters
None
Returns
outIterator of tuple

Each tuple is of the form (u, v)

__le__(self, value, /)

Return self<=value.

__lt__(self, value, /)

Return self<value.

__ne__(self, value, /)

Return self!=value.

__new__(*args, **kwargs)

Create and return a new object. See help(type) for accurate signature.

abstract __or__(self, ls)[source][source]

Implementation of the | operator for a LinkSet object.

Parameters
lsLinkSet
Returns
outLinkSet

Returns the union of Links.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__(self, /)

Return repr(self).

__setattr__(self, name, value, /)

Implement setattr(self, name, value).

__sizeof__()

size of object in memory, in bytes

abstract __sub__(self, ls)[source][source]

Implementation of the - operator for a LinkSet object.

Parameters
lsLinkSet
Returns
outLinkStream

Returns the difference of Links.

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

property as_graph

Generate the graph containing this LinkSet.

Parameters
None. Property.
Returns
graphGraph

Generates a Graph containing the LinkSet.

copy(self, deep=True)[source][source]

Returns a deep or shallow copy of the current LinkSet.

Parameters
deepBool
Returns
linkset_copyLinkSet

Returns a deep or shallow copy of the current LinkSet

degree(self, u=None, direction='out', weights=False)[source][source]

Return the degree of a node.

Parameters
uNode_Id, default=None

direction : string={‘in’, ‘out’, ‘both’}, default=’both’

weights : bool, default=False

Returns
nodestreamReal or NodeCollection(Real)

Return the (‘in’, ‘out’ or ‘both’) degree of a node of u. If None returns a NodeCollection with the degree for each Node.

.
abstract issuperset(self, ls)[source][source]

Check if a LinkSet contains another LinkSet.

Parameters
lsLinkSet
Returns
issuperset_fBool

True if all links of ls appears in this LinkSet.

abstract neighbors_of(self, u=None, direction='out')[source][source]

Return the nodeset of a neighbors of a node.

Parameters
uNode_Id or None
directionstring={‘in’, ‘out’, ‘both’}, default=’both’
Returns
nodestreamNodeSet or NodeCollection(NodeSet)

Return the (‘in’, ‘out’ or ‘both’) nodeset of neighbors of u. If u is None, returns a NodeCollection of its node with its neighbors.

abstract property nodeset

Return the nodeset that can be derived from the LinkSet.

Parameters
None. Property.
Returns
nodesetNodeSet

Returns all the nodes that appear in links.

property size

Returns the size of the LinkSet.

Parameters
None. Property.
Returns
sizeReal

The number of links.

abstract property weighted

Designate if the LinkSet has weights.

Parameters
None. Property.
Returns
weightsBool

True if the links are weighted. None if the linkset is empty.

property weighted_size

Returns the weighted size of the LinkSet.

Parameters
None. Property.
Returns
sizeReal

The sum of weights of links.