chain_graph

menpo.shape.chain_graph(shape, graph_cls=<class 'menpo.shape.graph.PointDirectedGraph'>, closed=False)[source]

Returns a chain graph given the landmarks configuration of a shape instance.

Parameters:
  • shape (PointCloud or LandmarkGroup or subclass) – The shape instance that defines the landmarks configuration based on which the graph will be created.
  • graph_cls (Graph or PointGraph subclass) –

    The output graph type. Possible options are

    {:map:`UndirectedGraph`, :map:`DirectedGraph`, :map:`Tree`,
     :map:`PointUndirectedGraph`, :map:`PointDirectedGraph`,
     :map:`PointTree`}
    
  • closed (bool, optional) – If True, then the chain will be closed (i.e. edge between the first and last vertices).
Returns:

graph (Graph or PointGraph subclass) – The generated graph.

Raises:
  • ValueError – A closed chain graph cannot be a Tree or PointTree instance.
  • ValueError – graph_cls must be UndirectedGraph, DirectedGraph, Tree, PointUndirectedGraph, PointDirectedGraph or PointTree.