finesse.model.Model.plot_graph

Model.plot_graph(layout: str = 'neato', graphviz=True, network_type: str | finesse.utilities.network_filter.NetworkType = NetworkType.COMPONENT, root: str | finesse.element.ModelElement | finesse.components.node.Node | None = None, show_detectors: bool = False, radius: int | None = None, directed: bool = False, **kwargs)[source]

Plot the node network. See also Visualizing the model

Parameters
layoutstr, optional

The networkx plotting layout engine, see NetworkX manual for more details. Choose from:

circular, fruchterman_reingold, kamada_kawai, multipartite, planar, random, shell, spectral, spiral, spring, neato, dot, fdp, sfdp, or circo

graphvizbool, optional

Whether to use the graphviz library for better node layouts (needs optional dependency), by default True

network_typestr | NetworkType, optional

Which network to plot, can be one of ‘optical’, ‘component’, ‘full’, by default NetworkType.COMPONENT

rootstr | ModelElement | Node | None, optional

In combination with radius, the root node of the graph to use for distance based filtering, by default None. When network_type is components, None will default to the first finesse.components.laser.Laser found in the model.

show_detectorsbool, optional

Whether to add detectors to the graph, by default False

radiusint >= 1 | None, optional

Must be used in combination with root, only include nodes of the network that are radius or less edges away from the root node, by default None, meaning that no nodes are filtered out.

directedbool, optional

Whether to use directed distance-based filtering, by default False. If set to True, will only include outgoing edges from the root node. See also the undirected argument of networkx.generators.ego.ego_graph()

Notes

Uses networkx.generators.ego.ego_graph() for the distance-based filtering.