A node with a unique id in the graph. Node.id is drawn as a text label, unless optional parameter text=False. Optional parameters include: fill, stroke, strokewidth, text, font, fontsize, fontweight.
(self, id="", radius=5, **kwargs)
| 77 | class Node(object): |
| 78 | |
| 79 | def __init__(self, id="", radius=5, **kwargs): |
| 80 | """ A node with a unique id in the graph. |
| 81 | Node.id is drawn as a text label, unless optional parameter text=False. |
| 82 | Optional parameters include: fill, stroke, strokewidth, text, font, fontsize, fontweight. |
| 83 | """ |
| 84 | self.graph = None |
| 85 | self.links = Links() |
| 86 | self.id = id |
| 87 | self._x = 0.0 # Calculated by Graph.layout.update(). |
| 88 | self._y = 0.0 # Calculated by Graph.layout.update(). |
| 89 | self.force = Vector(0.0, 0.0) |
| 90 | self.radius = radius |
| 91 | self.fixed = kwargs.pop("fixed", False) |
| 92 | self.fill = kwargs.pop("fill", None) |
| 93 | self.stroke = kwargs.pop("stroke", (0,0,0,1)) |
| 94 | self.strokewidth = kwargs.pop("strokewidth", 1) |
| 95 | self.text = kwargs.get("text", True) and \ |
| 96 | Text(isinstance(id, unicode) and id or str(id).decode("utf-8", "ignore"), |
| 97 | width = 85, |
| 98 | fill = kwargs.pop("text", (0,0,0,1)), |
| 99 | fontsize = kwargs.pop("fontsize", 11), **kwargs) or None |
| 100 | self._weight = None # Calculated by Graph.eigenvector_centrality(). |
| 101 | self._centrality = None # Calculated by Graph.betweenness_centrality(). |
| 102 | |
| 103 | @property |
| 104 | def _distance(self): |