compute_item_matrix(items, row_first=False, empty=None, *args, **kwargs)
list of strings to columize
Whether to compute columns for a row-first matrix instead of column-first (default).
default value to fill list if needed
How much characters will be used as a separation between each columns.
The width of the area onto which the columns should enter
nested list of string, the outer most list contains as many list as rows, the innermost lists have each as many element as columns. If the total number of elements in :None:None:`items`
does not equal the product of rows*columns, the last element of some lists are filled with :None:None:`None`
.
some info to make columnize easier:
num_columns
number of columns
max_rows
maximum number of rows (final number may be less)
column_widths
list of with of each columns
optimal_separator_width
best separator width between columns
Returns a nested list, and info to columnize items
See :In [1]: l = ['aaa','b','cc','d','eeeee','f','g','h','i','j','k','l'] In [2]: list, info = compute_item_matrix(l, displaywidth=12) In [3]: list Out[3]: [['aaa', 'f', 'k'], ['b', 'g', 'l'], ['cc', 'h', None], ['d', 'i', None], ['eeeee', 'j', None]] In [4]: ideal = {'num_columns': 3, 'column_widths': [5, 1, 1], 'optimal_separator_width': 2, 'max_rows': 5} In [5]: all((info[k] == ideal[k] for k in ideal.keys())) Out[5]: True
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them