File: highlighting.txt

package info (click to toggle)
objgraph 3.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,224 kB
  • sloc: python: 1,188; makefile: 108; sh: 8
file content (25 lines) | stat: -rw-r--r-- 646 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Highlighting
------------

You can highlight some graph nodes.

    >>> class Node(object):
    ...     def __init__(self, *neighbours):
    ...         self.neighbours = list(neighbours)
    >>> a = Node()
    >>> b = Node(a)
    >>> c = Node(b)
    >>> d = Node(c)
    >>> a.neighbours.append(d)

    >>> import objgraph
    >>> objgraph.show_backrefs(a, max_depth=15,
    ...     extra_ignore=[id(locals())],
    ...     highlight=lambda x: isinstance(x, Node),
    ...     filename='highlight.png') # doctest: +NODES_VARY
    Graph written to ....dot (12 nodes)
    Image generated as highlight.png

.. figure:: highlight.png
   :scale: 50%