Returns the top properties in the concept halo, sorted by betweenness centrality. The return value is a list of concept id's instead of Concepts (for performance).
(self)
| 42 | |
| 43 | @property |
| 44 | def properties(self): |
| 45 | """ Returns the top properties in the concept halo, sorted by betweenness centrality. |
| 46 | The return value is a list of concept id's instead of Concepts (for performance). |
| 47 | """ |
| 48 | if self._properties is None: |
| 49 | g = self.graph.copy(nodes=self.halo) |
| 50 | p = (n for n in g.nodes if n.id in self.graph.properties) |
| 51 | p = [n.id for n in reversed(sorted(p, key=lambda n: n.centrality))] |
| 52 | self._properties = p |
| 53 | return self._properties |
| 54 | |
| 55 | def halo(concept, depth=2): |
| 56 | return concept.flatten(depth=depth) |