aiidateam / aiida-core

The official repository for the AiiDA code
https://aiida-core.readthedocs.io
Other
437 stars 192 forks source link

verdi graph generate: print both pk/uuid AND label #3232

Closed danieleongari closed 5 months ago

danieleongari commented 5 years ago

Hi, I just upgraded to 1.0.0b5 and the graph looks very nice with graphviz! However, it was very convenient to me to have both the pk and the label written in the nodes. Now, with --identifier, I can specify only one. Can you please consider adding the option of having both? To me the best would be the option of chosing between pk or uuid in the brackets in the left of the nodetype, but also the option of adding the label as an extra line under the nodetype. Thanks!

chrisjsewell commented 5 years ago

@danieleongari that's my work thanks :)

I'd note that if you use the python API (see tutorials/visualising_graphs), you can control the output in a lot finer detail, including overriding the sub-label creation function. Something like:

from aiida import orm
from aiida.tools.visualization import Graph, default_node_sublabels

def custom_node_sublabels(node):
    sublabel = default_node_sublabels(node)
    # you probably want to only do this for certain types of node
    if isinstance(node, orm.ProcessNode):
        sublabel = node.label + "\n" + sublabel

graph = Graph(node_id_type="pk", node_sublabel_fn=custom_node_sublabels)
...
atztogo commented 5 years ago

@chrisjsewell . Thanks for your a lot of effort on improving the graph generation. This new graph drawing is very nicely colourful and easier to impress people haven't yet started AiiDA.

I suppose AiiDA will acquire many users very soon and many of them may expect as least as possible to touch python scripts. So perhaps it is a good idea to discuss on if we have a chance to improve the default graph output by verdi node graph generate. This is because, in my some little experience, in scientific community, general users are patient to read documentation but not to read/write scripts so much.

I agree with @danieleongari on label in addition to PK/uuid, especially for ArrayData and Dict.