stream_graph.Graph

class stream_graph.Graph(nodeset=None, linkset=None, weighted=False)[source][source]

Graph abstract-object implementation.

A Graph \(S=(V, E)\) is a collection of two elements:

  • \(V\), a node-set

  • \(E\), a link-set

Attributes
linkset

Extract the linkset.

m

Extract the number of links.

n

Extract the number of nodes.

nodeset

Extract the nodeset.

total_coverage

Extract the total coverage of the graph.

weighted
weighted_total_coverage

Extract the weighted total coverage of the graph.

wm

Extract the weighted number of links.

Methods

neighbor_coverage_of(self[, u, direction, …])

Extract the neighbor coverage of the graph.

to_networkx(self[, create_using])

Convert Graph to a networkx graph.

copy

__init__(self, nodeset=None, linkset=None, weighted=False)[source][source]
property linkset

Extract the linkset.

Parameters
None. Property
Returns
linkset: ABC.LinkSet

Returns a copy of the linkset defining this graph.

property m

Extract the number of links.

Parameters
None. Property
Returns
m: Int

Returns the size of the linkset defining this graph.

property n

Extract the number of nodes.

Parameters
None. Property.
Returns
n: Int

Returns the size of the nodeset defining this graph.

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

Extract the neighbor coverage of the graph.

Parameters
u: NodeId or None
direction: ‘in’, ‘out’ or ‘both’, default=’out’
weights: Bool
Returns
total_coverage: Real or NodeCollection

If u is Real, returns \(\frac{d_{direction}(u)}{n^{2}}\). Otherwise returns the coverage of each node.

property nodeset

Extract the nodeset.

Parameters
None. Property
Returns
nodeset: ABC.NodeSet

Returns a copy of the nodeset defining this graph.

to_networkx(self, create_using=None)[source][source]

Convert Graph to a networkx graph.

Parameters
create_using(NetworkX graph constructor, optional (default=nx.Graph))

Graph type to create. If graph instance, then cleared before populated.

Returns
graphnx.Graph
property total_coverage

Extract the total coverage of the graph.

Parameters
None. Property.
Returns
total_coverage: Real

Returns \(\frac{m}{n^{2}}\).

property weighted_total_coverage

Extract the weighted total coverage of the graph.

Parameters
None. Property.
Returns
total_coverage: Real

Returns \(\frac{m_{w}}{n^{2}}\).

property wm

Extract the weighted number of links.

Parameters
None. Property
Returns
m: Int

Returns the size of the linkset defining this graph.