MCPcopy Create free account
hub / github.com/ddbourgin/numpy-ml / __init__

Method __init__

numpy_ml/utils/graphs.py:13–31  ·  view source on GitHub ↗

A generic directed edge object. Parameters ---------- fr: int The id of the vertex the edge goes from to: int The id of the vertex the edge goes to w: float, :class:`Object` instance, or None The edge weight, if ap

(self, fr, to, w=None)

Source from the content-addressed store, hash-verified

11
12class Edge(object):
13 def __init__(self, fr, to, w=None):
14 """
15 A generic directed edge object.
16
17 Parameters
18 ----------
19 fr: int
20 The id of the vertex the edge goes from
21 to: int
22 The id of the vertex the edge goes to
23 w: float, :class:`Object` instance, or None
24 The edge weight, if applicable. If weight is an arbitrary Object it
25 must have a method called 'sample' which takes no arguments and
26 returns a random sample from the weight distribution. If `w` is
27 None, no weight is assumed. Default is None.
28 """
29 self.fr = fr
30 self.to = to
31 self._w = w
32
33 def __repr__(self):
34 return "{} -> {}, weight: {}".format(self.fr, self.to, self._w)

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected